]> git.ipfire.org Git - thirdparty/util-linux.git/blob - mount/Makefile.standalone
Imported from util-linux-2.7.1 tarball.
[thirdparty/util-linux.git] / mount / Makefile.standalone
1 # ifeq (../MCONFIG,$(wildcard ../MCONFIG))
2 # include ../MCONFIG
3 # endif
4
5 # For now: a standalone version
6
7 CC = gcc
8 CFLAGS = -O2
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
26 INSTALL_SUID = $(INSTALL) -m 4755 -o root
27 INSTALL_PROG = $(INSTALL) -m 755
28 INSTALL_DATA = $(INSTALL) -m 644
29 INSTALL_DIR = mkdir -p
30 INSTALL_MAN = $(INSTALL_DATA)
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)
60 $(INSTALL_DIR) $(BINDIR) $(SBINDIR)
61 $(INSTALL_SUID) -s $(SUID_PROGS) $(BINDIR)
62 $(INSTALL_PROG) -s $(NOSUID_PROGS) $(SBINDIR)
63 (cd $(SBINDIR); ln -sf swapon swapoff)
64 $(INSTALL_DIR) $(MANDIR)/man5 $(MANDIR)/man8
65 $(INSTALL_MAN) $(MAN5) $(MANDIR)/man5
66 $(INSTALL_MAN) $(MAN8) $(MANDIR)/man8
67
68 %.o: %.c
69 $(COMPILE) $<
70
71 mount: mount.o fstab.o sundries.o realpath.o version.o $(NFS_OBJS) $(LO_OBJS)
72 $(LINK) $^ -o $@
73
74 umount: umount.o fstab.o sundries.o realpath.o version.o $(LO_OBJS)
75 $(LINK) $^ -o $@
76
77 swapon: swapon.o version.o
78 $(LINK) $^ -o $@
79
80 losetup: losetup.o
81 $(LINK) $^ -o $@
82
83 mount.o umount.o nfsmount.o losetup.o fstab.o sundries.o: sundries.h
84
85 mount.o umount.o fstab.o sundries.o: fstab.h
86
87 mount.o umount.o losetup.o: lomount.h loop.h
88
89 swapon.o: swap.h swapargs.h
90
91 sundries.o nfsmount.o nfsmount_xdr.o nfsmount_clnt.o: nfsmount.h
92
93 umount.o: mount_constants.h
94
95 nfsmount_clnt.o: nfsmount_clnt.c
96 $(COMPILE) $(RPC_CFLAGS) nfsmount_clnt.c
97
98 nfsmount_xdr.o: nfsmount_xdr.c
99 $(COMPILE) $(RPC_CFLAGS) nfsmount_xdr.c
100
101 nfsmount.h nfsmount_xdr.c nfsmount_clnt.c: nfsmount.x
102 rm -f nfsmount.h nfsmount_xdr.c nfsmount_clnt.c
103 $(RPCGEN) -h -o nfsmount.h nfsmount.x
104 $(RPCGEN) -c -o nfsmount_xdr.c nfsmount.x
105 $(RPCGEN) -l -o nfsmount_clnt.c nfsmount.x
106
107 nfsmount.x:
108 cp $(RPCSVCDIR)/nfsmount.x .
109
110 nfsmount.o: nfs_mountversion.h nfs_mount3.h
111
112 NFSMOUNTH=/usr/include/linux/nfs_mount.h
113 SWAPH=/usr/include/linux/swap.h
114 LOOPH=/usr/include/linux/loop.h
115
116 nfs_mountversion.h:
117 rm -f nfs_mountversion.h
118 if [ -f $(NFSMOUNTH) ]; then \
119 grep NFS_MOUNT_VERSION $(NFSMOUNTH) \
120 | sed -e 's/NFS/KERNEL_NFS/'; \
121 else \
122 echo '#define KERNEL_NFS_MOUNT_VERSION 0'; \
123 fi > nfs_mountversion.h
124
125 swap.h:
126 rm -f swap.h
127 if [ -f $(SWAPH) ]; then cp $(SWAPH) .; else touch swap.h; fi
128
129 swapargs.h:
130 sh swap.configure
131
132 loop.h:
133 rm -f loop.h
134 if [ -f $(LOOPH) ]; then cp $(LOOPH) .; else touch loop.h; fi
135
136 clean:
137 rm -f a.out core *~ *.o swapargs.h $(PROGS) swapoff
138
139 cleaner: clean
140 rm -f swap.h loop.h nfs_mountversion.h
141
142 clobber distclean realclean: cleaner
143 rm -f $(GEN_FILES)