]>
Commit | Line | Data |
---|---|---|
fd6b7a7f KZ |
1 | # ifeq (../MCONFIG,$(wildcard ../MCONFIG)) |
2 | # include ../MCONFIG | |
3 | # endif | |
4 | ||
5 | # For now: a standalone version | |
6 | ||
7 | CC = gcc | |
5c36a0eb | 8 | CFLAGS = -O2 -I../lib |
fd6b7a7f KZ |
9 | |
10 | #WARNFLAGS = -Wall -Wstrict-prototypes | |
11 | # We really want | |
12 | WARNFLAGS = -Wall -Wstrict-prototypes -Wmissing-prototypes | |
13 | # but at the moment that yields | |
14 | #<linux/socket.h>:72: warning: no previous prototype for `cmsg_nxthdr' | |
15 | ||
16 | # you need rpcgen and libc-4.2 or rpclib to compile in the NFS support | |
17 | # pregenerated files are included. | |
18 | # Make sure nfsmount_clnt.c is newer than nfsmount.x to avoid gcc complaints. | |
19 | DEFINES = -DHAVE_NFS | |
20 | ||
21 | RPCSVCDIR = rpcsvc | |
22 | RPC_CFLAGS = -Wno-unused | |
23 | RPCGEN = rpcgen | |
24 | ||
25 | INSTALL = install | |
5c36a0eb KZ |
26 | INSTALLSUID = $(INSTALL) -m 4755 -o root |
27 | INSTALLPROG = $(INSTALL) -m 755 | |
28 | INSTALLDATA = $(INSTALL) -m 644 | |
29 | INSTALLDIR = mkdir -p | |
30 | INSTALLMAN = $(INSTALLDATA) | |
fd6b7a7f KZ |
31 | |
32 | MANDIR = /usr/man | |
33 | ## for suid progs (mount, umount) | |
34 | BINDIR = /bin | |
35 | ## for nosuid progs (swapon) | |
36 | SBINDIR = /sbin | |
37 | ||
38 | # End of configuration section. | |
39 | ||
40 | COMPILE = $(CC) -c $(WARNFLAGS) $(CFLAGS) $(DEFINES) | |
41 | LINK = $(CC) $(LDFLAGS) | |
42 | ||
43 | SUID_PROGS = mount umount | |
44 | NOSUID_PROGS = swapon losetup | |
45 | PROGS = $(SUID_PROGS) $(NOSUID_PROGS) | |
46 | MAN5 = fstab.5 nfs.5 | |
47 | MAN8 = mount.8 swapoff.8 swapon.8 umount.8 losetup.8 | |
48 | ||
49 | # comment these out if you are not compiling in NFS support | |
50 | NFS_OBJS = nfsmount.o nfsmount_xdr.o nfsmount_clnt.o | |
51 | # uncomment this if you don't have libc-4.2 but do have the rpclib | |
52 | GEN_FILES = nfsmount.x nfsmount.h nfsmount_xdr.c nfsmount_clnt.c | |
53 | ||
54 | # comment these out if you are not compiling in loop support | |
55 | LO_OBJS=lomount.o | |
56 | ||
57 | all: $(PROGS) | |
58 | ||
59 | install: $(PROGS) | |
5c36a0eb KZ |
60 | $(INSTALLDIR) $(BINDIR) $(SBINDIR) |
61 | $(INSTALLSUID) -s $(SUID_PROGS) $(BINDIR) | |
62 | $(INSTALLPROG) -s $(NOSUID_PROGS) $(SBINDIR) | |
fd6b7a7f | 63 | (cd $(SBINDIR); ln -sf swapon swapoff) |
5c36a0eb KZ |
64 | $(INSTALLDIR) $(MANDIR)/man5 $(MANDIR)/man8 |
65 | $(INSTALLMAN) $(MAN5) $(MANDIR)/man5 | |
66 | $(INSTALLMAN) $(MAN8) $(MANDIR)/man8 | |
fd6b7a7f KZ |
67 | |
68 | %.o: %.c | |
69 | $(COMPILE) $< | |
70 | ||
5c36a0eb KZ |
71 | mount: mount.o fstab.o sundries.o realpath.o mntent.o version.o \ |
72 | mount_guess_fstype.o mount_by_label.o ../lib/setproctitle.o $(NFS_OBJS) $(LO_OBJS) | |
fd6b7a7f KZ |
73 | $(LINK) $^ -o $@ |
74 | ||
5c36a0eb | 75 | umount: umount.o fstab.o sundries.o realpath.o mntent.o version.o $(LO_OBJS) |
fd6b7a7f KZ |
76 | $(LINK) $^ -o $@ |
77 | ||
78 | swapon: swapon.o version.o | |
79 | $(LINK) $^ -o $@ | |
80 | ||
81 | losetup: losetup.o | |
82 | $(LINK) $^ -o $@ | |
83 | ||
84 | mount.o umount.o nfsmount.o losetup.o fstab.o sundries.o: sundries.h | |
85 | ||
86 | mount.o umount.o fstab.o sundries.o: fstab.h | |
87 | ||
5c36a0eb | 88 | mount.o fstab.o mntent.o: mntent.h |
fd6b7a7f | 89 | |
5c36a0eb KZ |
90 | mount.o mount_guess_fstype.o: mount_guess_fstype.h |
91 | ||
92 | mount.o umount.o losetup.o lomount.o: lomount.h loop.h | |
93 | ||
94 | swapon.o: swap_constants.h swapargs.h | |
fd6b7a7f KZ |
95 | |
96 | sundries.o nfsmount.o nfsmount_xdr.o nfsmount_clnt.o: nfsmount.h | |
97 | ||
98 | umount.o: mount_constants.h | |
99 | ||
5c36a0eb KZ |
100 | mount.o mount_by_label.o mount_guess_fstype.o: linux_fs.h |
101 | ||
fd6b7a7f KZ |
102 | nfsmount_clnt.o: nfsmount_clnt.c |
103 | $(COMPILE) $(RPC_CFLAGS) nfsmount_clnt.c | |
104 | ||
105 | nfsmount_xdr.o: nfsmount_xdr.c | |
106 | $(COMPILE) $(RPC_CFLAGS) nfsmount_xdr.c | |
107 | ||
108 | nfsmount.h nfsmount_xdr.c nfsmount_clnt.c: nfsmount.x | |
109 | rm -f nfsmount.h nfsmount_xdr.c nfsmount_clnt.c | |
110 | $(RPCGEN) -h -o nfsmount.h nfsmount.x | |
111 | $(RPCGEN) -c -o nfsmount_xdr.c nfsmount.x | |
112 | $(RPCGEN) -l -o nfsmount_clnt.c nfsmount.x | |
113 | ||
114 | nfsmount.x: | |
115 | cp $(RPCSVCDIR)/nfsmount.x . | |
116 | ||
117 | nfsmount.o: nfs_mountversion.h nfs_mount3.h | |
118 | ||
119 | NFSMOUNTH=/usr/include/linux/nfs_mount.h | |
fd6b7a7f KZ |
120 | |
121 | nfs_mountversion.h: | |
122 | rm -f nfs_mountversion.h | |
123 | if [ -f $(NFSMOUNTH) ]; then \ | |
124 | grep NFS_MOUNT_VERSION $(NFSMOUNTH) \ | |
125 | | sed -e 's/NFS/KERNEL_NFS/'; \ | |
126 | else \ | |
127 | echo '#define KERNEL_NFS_MOUNT_VERSION 0'; \ | |
128 | fi > nfs_mountversion.h | |
129 | ||
fd6b7a7f KZ |
130 | swapargs.h: |
131 | sh swap.configure | |
132 | ||
133 | loop.h: | |
5c36a0eb | 134 | sh mk_loop_h |
fd6b7a7f KZ |
135 | |
136 | clean: | |
137 | rm -f a.out core *~ *.o swapargs.h $(PROGS) swapoff | |
5c36a0eb | 138 | rm -f loop.h nfs_mountversion.h |
fd6b7a7f | 139 | |
2b6fc908 | 140 | clobber distclean realclean: clean |
fd6b7a7f | 141 | rm -f $(GEN_FILES) |