-# 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\"
+include ../make_include
+include ../MCONFIG
-# you need rpcgen and libc-4.2 or rpclib to compile in the NFS support
-DEFINES = -DHAVE_NFS -DFSTYPE_DEFAULT=$(DEFAULT_FSTYPE)
+DEFINES = -DHAVE_NFS
-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)
-WARNFLAGS = -Wall -Wstrict-prototypes -Wmissing-prototypes
-#LDFLAGS = -s -N
-LDLIBS =
RPCSVCDIR = rpcsvc
RPC_CFLAGS = -Wno-unused
RPCGEN = rpcgen
-#INSTALL = install
-#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
-
-# End of configuration section.
-COMPILE = $(CC) -c $(WARNFLAGS) $(CFLAGS) $(DEFINES)
+COMPILE = $(CC) -c $(CFLAGS) $(DEFINES)
LINK = $(CC) $(LDFLAGS)
SUID_PROGS = mount umount
-NOSUID_PROGS = swapon
-PROGS = $(SUID_PROGS) $(NOSUID_PROGS)
+NOSUID_PROGS = swapon losetup
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
+
+ifeq "$(HAVE_PIVOT_ROOT)" "yes"
+NOSUID_PROGS := $(NOSUID_PROGS) pivot_root
+MAN8 := $(MAN8) pivot_root.8
+endif
-# comment these out if you are not compiling in NFS support
-NFS_OBJS = nfsmount.o mount_xdr.o mount_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
+PROGS = $(SUID_PROGS) $(NOSUID_PROGS)
-# comment these out if you are not compiling in loop support
-LO_OBJS=lomount.o
+MAYBE = pivot_root swapoff
+
+LO_OBJS = lomount.o $(LIB)/xstrncpy.o
+NFS_OBJS = nfsmount.o nfsmount_xdr.o nfsmount_clnt.o
+GEN_FILES = nfsmount.h nfsmount_xdr.c nfsmount_clnt.c
all: $(PROGS)
install: $(PROGS)
$(INSTALLDIR) $(BINDIR) $(SBINDIR)
- $(INSTALLSUID) -s $(SUID_PROGS) $(BINDIR)
- $(INSTALLBIN) -s $(NOSUID_PROGS) $(SBINDIR)
+ $(INSTALLSUID) $(SUID_PROGS) $(BINDIR)
+ $(INSTALLBIN) $(NOSUID_PROGS) $(SBINDIR)
(cd $(SBINDIR); ln -sf swapon swapoff)
$(INSTALLDIR) $(MAN5DIR) $(MAN8DIR)
$(INSTALLMAN) $(MAN5) $(MAN5DIR)
%.o: %.c
$(COMPILE) $<
-mount: mount.o fstab.o sundries.o version.o $(NFS_OBJS) $(LO_OBJS)
- $(LINK) $^ $(LDLIBS) -o $@
+mount: mount.o fstab.o sundries.o realpath.o mntent.o version.o \
+ mount_guess_fstype.o get_label_uuid.o mount_by_label.o getusername.o \
+ $(LIB)/setproctitle.o $(LIB)/env.o $(NFS_OBJS) $(LO_OBJS)
+ $(LINK) $^ -o $@
+
+umount: umount.o fstab.o sundries.o realpath.o mntent.o getusername.o \
+ get_label_uuid.o version.o $(LIB)/env.o $(LO_OBJS)
+ $(LINK) $^ -o $@
+
+swapon: swapon.o version.o
+ $(LINK) $^ -o $@
+
+main_losetup.o: lomount.c
+ $(COMPILE) -DMAIN lomount.c -o $@
+
+losetup: main_losetup.o $(LIB)/xstrncpy.o
+ $(LINK) $^ -o $@
+
+mount.o umount.o nfsmount.o losetup.o fstab.o realpath.o sundries.o: sundries.h
+
+mount.o umount.o fstab.o sundries.o: fstab.h
+
+mount.o fstab.o mntent.o: mntent.h
+
+mount.o mount_guess_fstype.o: mount_guess_fstype.h
+
+mount.o: $(LIB)/setproctitle.h
+
+mount.o umount.o getusername.o: getusername.h
+
+mount.o umount.o losetup.o lomount.o: lomount.h loop.h my_dev_t.h
+
+swapon.o: swap_constants.h swapargs.h
+
+sundries.o nfsmount.o nfsmount_xdr.o nfsmount_clnt.o: nfsmount.h
+
+umount.o: mount_constants.h
+
+mount.o mount_by_label.o mount_guess_fstype.o: linux_fs.h
+
+sundries.o realpath.o: realpath.h
+
+nfsmount_clnt.o: nfsmount_clnt.c
+ $(COMPILE) $(RPC_CFLAGS) nfsmount_clnt.c
+
+nfsmount_xdr.o: nfsmount_xdr.c
+ $(COMPILE) $(RPC_CFLAGS) nfsmount_xdr.c
-umount: umount.o fstab.o sundries.o version.o $(LO_OBJS)
- $(LINK) $^ $(LDLIBS) -o $@
+ifeq "$(HAVE_GOOD_RPC)" "yes"
+nfsmount.h: nfsmount.x
+ rm -f nfsmount.h
+ $(RPCGEN) -h -o nfsmount.h nfsmount.x
-swapon: swapon.o fstab.o version.o
- $(LINK) $^ $(LDLIBS) -o $@
+nfsmount_xdr.c: nfsmount.x
+ rm -f nfsmount_xdr.c
+ $(RPCGEN) -c -o nfsmount_xdr.c nfsmount.x
-nfsmount.o mount_xdr.o mount_clnt.o: mount.h
+nfsmount_clnt.c: nfsmount.x
+ rm -f nfsmount_clnt.c
+ $(RPCGEN) -l -o nfsmount_clnt.c nfsmount.x
+else
+nfsmount.h:
+ cp $(RPCSVCDIR)/nfsmount.h .
-mount_clnt.o: mount_clnt.c
- $(COMPILE) $(RPC_CFLAGS) mount_clnt.c
+nfsmount_xdr.c:
+ cp $(RPCSVCDIR)/nfsmount_xdr.c .
-mount_xdr.o: mount_xdr.c
- $(COMPILE) $(RPC_CFLAGS) mount_xdr.c
+nfsmount_clnt.c:
+ cp $(RPCSVCDIR)/nfsmount_clnt.c .
+endif
-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.o: nfs_mount4.h
-mount.x:
- cp $(RPCSVCDIR)/mount.x .
+swapargs.h:
+ sh swap.configure
clean:
- rm -f a.out core *~ *.o $(PROGS)
+ rm -f a.out core *~ *.o swapargs.h $(PROGS) $(MAYBE)
+ rm -f nfs_mountversion.h
-clobber: clean
- rm -f $(PROGS) $(GEN_FILES)
+clobber distclean realclean: clean
+ rm -f $(GEN_FILES)