]> git.ipfire.org Git - thirdparty/util-linux.git/blame - mount/Makefile.standalone
Imported from util-linux-2.9i tarball.
[thirdparty/util-linux.git] / mount / Makefile.standalone
CommitLineData
fd6b7a7f
KZ
1# ifeq (../MCONFIG,$(wildcard ../MCONFIG))
2# include ../MCONFIG
3# endif
4
5# For now: a standalone version
6
7CC = gcc
5c36a0eb 8CFLAGS = -O2 -I../lib
fd6b7a7f
KZ
9
10#WARNFLAGS = -Wall -Wstrict-prototypes
11# We really want
12WARNFLAGS = -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.
19DEFINES = -DHAVE_NFS
20
21RPCSVCDIR = rpcsvc
22RPC_CFLAGS = -Wno-unused
23RPCGEN = rpcgen
24
25INSTALL = install
5c36a0eb
KZ
26INSTALLSUID = $(INSTALL) -m 4755 -o root
27INSTALLPROG = $(INSTALL) -m 755
28INSTALLDATA = $(INSTALL) -m 644
29INSTALLDIR = mkdir -p
30INSTALLMAN = $(INSTALLDATA)
fd6b7a7f
KZ
31
32MANDIR = /usr/man
33## for suid progs (mount, umount)
34BINDIR = /bin
35## for nosuid progs (swapon)
36SBINDIR = /sbin
37
38# End of configuration section.
39
40COMPILE = $(CC) -c $(WARNFLAGS) $(CFLAGS) $(DEFINES)
41LINK = $(CC) $(LDFLAGS)
42
43SUID_PROGS = mount umount
44NOSUID_PROGS = swapon losetup
45PROGS = $(SUID_PROGS) $(NOSUID_PROGS)
46MAN5 = fstab.5 nfs.5
47MAN8 = mount.8 swapoff.8 swapon.8 umount.8 losetup.8
48
49# comment these out if you are not compiling in NFS support
50NFS_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
52GEN_FILES = nfsmount.x nfsmount.h nfsmount_xdr.c nfsmount_clnt.c
53
54# comment these out if you are not compiling in loop support
55LO_OBJS=lomount.o
56
57all: $(PROGS)
58
59install: $(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
71mount: 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 75umount: umount.o fstab.o sundries.o realpath.o mntent.o version.o $(LO_OBJS)
fd6b7a7f
KZ
76 $(LINK) $^ -o $@
77
78swapon: swapon.o version.o
79 $(LINK) $^ -o $@
80
81losetup: losetup.o
82 $(LINK) $^ -o $@
83
84mount.o umount.o nfsmount.o losetup.o fstab.o sundries.o: sundries.h
85
86mount.o umount.o fstab.o sundries.o: fstab.h
87
5c36a0eb 88mount.o fstab.o mntent.o: mntent.h
fd6b7a7f 89
5c36a0eb
KZ
90mount.o mount_guess_fstype.o: mount_guess_fstype.h
91
92mount.o umount.o losetup.o lomount.o: lomount.h loop.h
93
94swapon.o: swap_constants.h swapargs.h
fd6b7a7f
KZ
95
96sundries.o nfsmount.o nfsmount_xdr.o nfsmount_clnt.o: nfsmount.h
97
98umount.o: mount_constants.h
99
5c36a0eb
KZ
100mount.o mount_by_label.o mount_guess_fstype.o: linux_fs.h
101
fd6b7a7f
KZ
102nfsmount_clnt.o: nfsmount_clnt.c
103 $(COMPILE) $(RPC_CFLAGS) nfsmount_clnt.c
104
105nfsmount_xdr.o: nfsmount_xdr.c
106 $(COMPILE) $(RPC_CFLAGS) nfsmount_xdr.c
107
108nfsmount.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
114nfsmount.x:
115 cp $(RPCSVCDIR)/nfsmount.x .
116
117nfsmount.o: nfs_mountversion.h nfs_mount3.h
118
119NFSMOUNTH=/usr/include/linux/nfs_mount.h
fd6b7a7f
KZ
120
121nfs_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
130swapargs.h:
131 sh swap.configure
132
133loop.h:
5c36a0eb 134 sh mk_loop_h
fd6b7a7f
KZ
135
136clean:
137 rm -f a.out core *~ *.o swapargs.h $(PROGS) swapoff
5c36a0eb 138 rm -f loop.h nfs_mountversion.h
fd6b7a7f 139
2b6fc908 140clobber distclean realclean: clean
fd6b7a7f 141 rm -f $(GEN_FILES)