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