summaryrefslogtreecommitdiffstats
path: root/mount/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'mount/Makefile')
-rw-r--r--mount/Makefile110
1 files changed, 72 insertions, 38 deletions
diff --git a/mount/Makefile b/mount/Makefile
index 22c146ce0..cfbedd59d 100644
--- a/mount/Makefile
+++ b/mount/Makefile
@@ -1,19 +1,13 @@
-# To make "ext" the default file system type for mount
-# (used when no other type is specified), replace \"minix\" by \"ext2\".
-# Use iso9660 instead, since CDROMs are popular.
-DEFAULT_FSTYPE=\"iso9660\"
-
-# you need rpcgen and libc-4.2 or rpclib to compile in the NFS support
-DEFINES = -DHAVE_NFS -DFSTYPE_DEFAULT=$(DEFAULT_FSTYPE)
-
+ifeq (../MCONFIG,$(wildcard ../MCONFIG))
include ../MCONFIG
-#CC = gcc
-#OPTFLAGS= -O2 -m486 -fomit-frame-pointer
-##OPTFLAGS= -O2 -fomit-frame-pointer # or change on make's command line
-#CFLAGS = -pipe $(OPTFLAGS)
+endif
+
+CC = gcc
+CFLAGS = -O2
WARNFLAGS = -Wall -Wstrict-prototypes -Wmissing-prototypes
-#LDFLAGS = -s -N
-LDLIBS =
+DEFINES = -DHAVE_NFS
+LDFLAGS =
+
RPCSVCDIR = rpcsvc
RPC_CFLAGS = -Wno-unused
RPCGEN = rpcgen
@@ -21,12 +15,11 @@ RPCGEN = rpcgen
#INSTALL_SUID = $(INSTALL) -m 4755 -o root
#INSTALL_PROG = $(INSTALL) -m 755
#INSTALL_DATA = $(INSTALL) -m 644
-#prefix = /usr
## for suid progs (mount, umount)
#BINDIR = /bin
## for nosuid progs (swapon)
-#SBINDIR = /etc
+#SBINDIR = /sbin
# End of configuration section.
@@ -34,15 +27,15 @@ COMPILE = $(CC) -c $(WARNFLAGS) $(CFLAGS) $(DEFINES)
LINK = $(CC) $(LDFLAGS)
SUID_PROGS = mount umount
-NOSUID_PROGS = swapon
+NOSUID_PROGS = swapon losetup
PROGS = $(SUID_PROGS) $(NOSUID_PROGS)
MAN5 = fstab.5 nfs.5
-MAN8 = mount.8 swapoff.8 swapon.8 umount.8
+MAN8 = mount.8 swapoff.8 swapon.8 umount.8 losetup.8
# comment these out if you are not compiling in NFS support
-NFS_OBJS = nfsmount.o mount_xdr.o mount_clnt.o
+NFS_OBJS = nfsmount.o nfsmount_xdr.o nfsmount_clnt.o
# uncomment this if you don't have libc-4.2 but do have the rpclib
-GEN_FILES = mount.x mount.h mount_xdr.c mount_clnt.c
+GEN_FILES = nfsmount.x nfsmount.h nfsmount_xdr.c nfsmount_clnt.c
# comment these out if you are not compiling in loop support
LO_OBJS=lomount.o
@@ -61,34 +54,75 @@ install: $(PROGS)
%.o: %.c
$(COMPILE) $<
-mount: mount.o fstab.o sundries.o version.o $(NFS_OBJS) $(LO_OBJS)
+mount: mount.o fstab.o sundries.o realpath.o version.o $(NFS_OBJS) $(LO_OBJS)
$(LINK) $^ $(LDLIBS) -o $@
-umount: umount.o fstab.o sundries.o version.o $(LO_OBJS)
+umount: umount.o fstab.o sundries.o realpath.o version.o $(LO_OBJS)
$(LINK) $^ $(LDLIBS) -o $@
-swapon: swapon.o fstab.o version.o
+swapon: swapon.o version.o
$(LINK) $^ $(LDLIBS) -o $@
-nfsmount.o mount_xdr.o mount_clnt.o: mount.h
+losetup: losetup.o
+ $(LINK) $^ $(LDLIBS) -o $@
+
+mount.o umount.o nfsmount.o losetup.o fstab.o sundries.o: sundries.h
+
+mount.o umount.o fstab.o sundries.o: fstab.h
+
+mount.o umount.o losetup.o: lomount.h loop.h
+
+swapon.o: swap.h swapargs.h
-mount_clnt.o: mount_clnt.c
- $(COMPILE) $(RPC_CFLAGS) mount_clnt.c
+sundries.o nfsmount.o nfsmount_xdr.o nfsmount_clnt.o: nfsmount.h
-mount_xdr.o: mount_xdr.c
- $(COMPILE) $(RPC_CFLAGS) mount_xdr.c
+nfsmount_clnt.o: nfsmount_clnt.c
+ $(COMPILE) $(RPC_CFLAGS) nfsmount_clnt.c
-mount.h mount_xdr.c mount_clnt.c: mount.x
- rm -f mount.h mount_xdr.c mount_clnt.c
- $(RPCGEN) -h -o mount.h mount.x
- $(RPCGEN) -c -o mount_xdr.c mount.x
- $(RPCGEN) -l -o mount_clnt.c mount.x
+nfsmount_xdr.o: nfsmount_xdr.c
+ $(COMPILE) $(RPC_CFLAGS) nfsmount_xdr.c
-mount.x:
- cp $(RPCSVCDIR)/mount.x .
+# rpcgen generates files that do not compile - use the pregenerated ones
+# nfsmount.h nfsmount_xdr.c nfsmount_clnt.c: nfsmount.x
+# rm -f nfsmount.h nfsmount_xdr.c nfsmount_clnt.c
+# $(RPCGEN) -h -o nfsmount.h nfsmount.x
+# $(RPCGEN) -c -o nfsmount_xdr.c nfsmount.x
+# $(RPCGEN) -l -o nfsmount_clnt.c nfsmount.x
+
+nfsmount.x:
+ cp $(RPCSVCDIR)/nfsmount.x .
+
+nfsmount.o: nfs_mountversion.h nfs_mount3.h
+
+NFSMOUNTH=/usr/include/linux/nfs_mount.h
+SWAPH=/usr/include/linux/swap.h
+LOOPH=/usr/include/linux/loop.h
+
+nfs_mountversion.h:
+ rm -f nfs_mountversion.h
+ if [ -f $(NFSMOUNTH) ]; then \
+ grep NFS_MOUNT_VERSION $(NFSMOUNTH) \
+ | sed -e 's/NFS/KERNEL_NFS/'; \
+ else \
+ echo '#define KERNEL_NFS_MOUNT_VERSION 0'; \
+ fi > nfs_mountversion.h
+
+swap.h:
+ rm -f swap.h
+ if [ -f $(SWAPH) ]; then cp $(SWAPH) .; else touch swap.h; fi
+
+swapargs.h:
+ sh swap.configure
+
+loop.h:
+ rm -f loop.h
+ if [ -f $(LOOPH) ]; then cp $(LOOPH) .; else touch loop.h; fi
clean:
- rm -f a.out core *~ *.o $(PROGS)
+ rm -f a.out core *~ *.o swapargs.h $(PROGS)
+
+cleaner: clean
+ rm -f swap.h loop.h nfs_mountversion.h
-clobber: clean
- rm -f $(PROGS) $(GEN_FILES)
+clobber distclean realclean: cleaner
+# rm -f $(GEN_FILES)