]> git.ipfire.org Git - thirdparty/util-linux.git/blob - mount/Makefile
Imported from util-linux-2.10f tarball.
[thirdparty/util-linux.git] / mount / Makefile
1 include ../make_include
2 include ../MCONFIG
3
4 CFLAGS = -I$(LIB) $(OPT)
5 WARNFLAGS = -Wall -Wstrict-prototypes -Wmissing-prototypes
6 DEFINES = -DHAVE_NFS
7
8 RPCSVCDIR = rpcsvc
9 RPC_CFLAGS = -Wno-unused
10 RPCGEN = rpcgen
11
12 COMPILE = $(CC) -c $(WARNFLAGS) $(CFLAGS) $(DEFINES)
13 LINK = $(CC) $(LDFLAGS)
14
15 SUID_PROGS = mount umount
16 NOSUID_PROGS = swapon losetup
17 PROGS = $(SUID_PROGS) $(NOSUID_PROGS)
18 MAN5 = fstab.5 nfs.5
19 MAN8 = mount.8 swapoff.8 swapon.8 umount.8 losetup.8
20
21 # comment these out if you are not compiling in NFS support
22 NFS_OBJS = nfsmount.o nfsmount_xdr.o nfsmount_clnt.o
23 # uncomment this if you don't have libc-4.2 but do have the rpclib
24 GEN_FILES = nfsmount.x nfsmount.h nfsmount_xdr.c nfsmount_clnt.c
25
26 # comment these out if you are not compiling in loop support
27 LO_OBJS=lomount.o
28
29 all: $(PROGS)
30
31 install: $(PROGS)
32 $(INSTALLDIR) $(BINDIR) $(SBINDIR)
33 $(INSTALLSUID) -s $(SUID_PROGS) $(BINDIR)
34 $(INSTALLBIN) -s $(NOSUID_PROGS) $(SBINDIR)
35 (cd $(SBINDIR); ln -sf swapon swapoff)
36 $(INSTALLDIR) $(MAN5DIR) $(MAN8DIR)
37 $(INSTALLMAN) $(MAN5) $(MAN5DIR)
38 $(INSTALLMAN) $(MAN8) $(MAN8DIR)
39
40 %.o: %.c
41 $(COMPILE) $<
42
43 mount: mount.o fstab.o sundries.o realpath.o mntent.o version.o \
44 mount_guess_fstype.o mount_by_label.o getusername.o \
45 $(LIB)/setproctitle.o $(NFS_OBJS) $(LO_OBJS)
46 $(LINK) $^ -o $@
47
48 umount: umount.o fstab.o sundries.o realpath.o mntent.o getusername.o \
49 version.o $(LO_OBJS)
50 $(LINK) $^ -o $@
51
52 swapon: swapon.o version.o
53 $(LINK) $^ -o $@
54
55 losetup: losetup.o
56 $(LINK) $^ -o $@
57
58 mount.o umount.o nfsmount.o losetup.o fstab.o realpath.o sundries.o: sundries.h
59
60 mount.o umount.o fstab.o sundries.o: fstab.h
61
62 mount.o fstab.o mntent.o: mntent.h
63
64 mount.o mount_guess_fstype.o: mount_guess_fstype.h
65
66 mount.o: $(LIB)/setproctitle.h
67
68 mount.o umount.o getusername.o: getusername.h
69
70 mount.o umount.o losetup.o lomount.o: lomount.h loop.h
71
72 swapon.o: swap_constants.h swapargs.h
73
74 sundries.o nfsmount.o nfsmount_xdr.o nfsmount_clnt.o: nfsmount.h
75
76 umount.o: mount_constants.h
77
78 mount.o mount_by_label.o mount_guess_fstype.o: linux_fs.h
79
80 sundries.o realpath.o: realpath.h
81
82 nfsmount_clnt.o: nfsmount_clnt.c
83 $(COMPILE) $(RPC_CFLAGS) nfsmount_clnt.c
84
85 nfsmount_xdr.o: nfsmount_xdr.c
86 $(COMPILE) $(RPC_CFLAGS) nfsmount_xdr.c
87
88 # rpcgen generates files that do not compile - use the pregenerated ones
89 # nfsmount.h nfsmount_xdr.c nfsmount_clnt.c: nfsmount.x
90 # rm -f nfsmount.h nfsmount_xdr.c nfsmount_clnt.c
91 # $(RPCGEN) -h -o nfsmount.h nfsmount.x
92 # $(RPCGEN) -c -o nfsmount_xdr.c nfsmount.x
93 # $(RPCGEN) -l -o nfsmount_clnt.c nfsmount.x
94
95 nfsmount.x:
96 cp $(RPCSVCDIR)/nfsmount.x .
97
98 nfsmount.o: nfs_mountversion.h nfs_mount3.h
99
100 NFSMOUNTH=/usr/include/linux/nfs_mount.h
101
102 nfs_mountversion.h:
103 rm -f nfs_mountversion.h
104 if [ -f $(NFSMOUNTH) ]; then \
105 grep NFS_MOUNT_VERSION $(NFSMOUNTH) \
106 | sed -e 's/NFS/KERNEL_NFS/'; \
107 else \
108 echo '#define KERNEL_NFS_MOUNT_VERSION 0'; \
109 fi > nfs_mountversion.h
110
111 swapargs.h:
112 sh swap.configure
113
114 loop.h:
115 sh mk_loop_h
116
117 clean:
118 rm -f a.out core *~ *.o swapargs.h $(PROGS) swapoff
119 rm -f loop.h nfs_mountversion.h
120
121 clobber distclean realclean: clean
122 # rm -f $(GEN_FILES)