summaryrefslogtreecommitdiffstats
path: root/mount/Makefile
blob: 22c146ce0530d958e0d0641a6f31d89ed087e9e7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# To make "ext" the default file system type for mount
#  (used when no other type is specified), replace \"minix\" by \"ext2\".
# Use iso9660 instead, since CDROMs are popular.
DEFAULT_FSTYPE=\"iso9660\"

# you need rpcgen and libc-4.2 or rpclib to compile in the NFS support
DEFINES = -DHAVE_NFS -DFSTYPE_DEFAULT=$(DEFAULT_FSTYPE)

include ../MCONFIG
#CC = gcc
#OPTFLAGS=	-O2 -m486 -fomit-frame-pointer
##OPTFLAGS=	-O2 -fomit-frame-pointer  # or change on make's command line
#CFLAGS = -pipe $(OPTFLAGS)
WARNFLAGS = -Wall -Wstrict-prototypes -Wmissing-prototypes
#LDFLAGS = -s -N
LDLIBS =
RPCSVCDIR = rpcsvc
RPC_CFLAGS = -Wno-unused 
RPCGEN = rpcgen
#INSTALL = install
#INSTALL_SUID = $(INSTALL) -m 4755 -o root
#INSTALL_PROG = $(INSTALL) -m 755
#INSTALL_DATA = $(INSTALL) -m 644
#prefix = /usr

## for suid progs (mount, umount)
#BINDIR = /bin
## for nosuid progs (swapon)
#SBINDIR = /etc

# End of configuration section.

COMPILE = $(CC) -c $(WARNFLAGS) $(CFLAGS) $(DEFINES)
LINK = $(CC) $(LDFLAGS)

SUID_PROGS = mount umount
NOSUID_PROGS = swapon
PROGS = $(SUID_PROGS) $(NOSUID_PROGS)
MAN5 = fstab.5 nfs.5
MAN8 = mount.8 swapoff.8 swapon.8 umount.8

# comment these out if you are not compiling in NFS support
NFS_OBJS = nfsmount.o mount_xdr.o mount_clnt.o
# uncomment this if you don't have libc-4.2 but do have the rpclib
GEN_FILES = mount.x mount.h mount_xdr.c mount_clnt.c

# comment these out if you are not compiling in loop support
LO_OBJS=lomount.o

all: $(PROGS)

install: $(PROGS)
	$(INSTALLDIR) $(BINDIR) $(SBINDIR)
	$(INSTALLSUID) -s $(SUID_PROGS) $(BINDIR)
	$(INSTALLBIN) -s $(NOSUID_PROGS) $(SBINDIR)
	(cd $(SBINDIR); ln -sf swapon swapoff)
	$(INSTALLDIR) $(MAN5DIR) $(MAN8DIR)
	$(INSTALLMAN) $(MAN5) $(MAN5DIR)
	$(INSTALLMAN) $(MAN8) $(MAN8DIR)

%.o: %.c
	$(COMPILE) $<

mount: mount.o fstab.o sundries.o version.o $(NFS_OBJS) $(LO_OBJS)
	$(LINK) $^ $(LDLIBS) -o $@

umount: umount.o fstab.o sundries.o version.o $(LO_OBJS)
	$(LINK) $^ $(LDLIBS) -o $@

swapon:	swapon.o fstab.o version.o
	$(LINK) $^ $(LDLIBS) -o $@

nfsmount.o mount_xdr.o mount_clnt.o: mount.h

mount_clnt.o: mount_clnt.c
	$(COMPILE) $(RPC_CFLAGS) mount_clnt.c

mount_xdr.o: mount_xdr.c
	$(COMPILE) $(RPC_CFLAGS) mount_xdr.c

mount.h mount_xdr.c mount_clnt.c: mount.x
	rm -f mount.h mount_xdr.c mount_clnt.c
	$(RPCGEN) -h -o mount.h mount.x
	$(RPCGEN) -c -o mount_xdr.c mount.x
	$(RPCGEN) -l -o mount_clnt.c mount.x

mount.x:
	cp $(RPCSVCDIR)/mount.x .

clean:
	rm -f a.out core *~ *.o $(PROGS)

clobber: clean
	rm -f $(PROGS) $(GEN_FILES)