Home | History | Annotate | Line # | Download | only in mount
Makefile revision 1.21
      1 #	$NetBSD: Makefile,v 1.21 2002/08/19 10:16:55 lukem Exp $
      2 #	@(#)Makefile	8.6 (Berkeley) 5/8/95
      3 
      4 .include <bsd.own.mk>
      5 
      6 PROG=	mount
      7 MAN=	mount.8
      8 SRCS=	mount.c vfslist.c
      9 # We do NOT install the getmntopts.3 man page.
     10 # getmntopts.c in this directory isn't used by mount anymore, but it
     11 # is used by other mount programs which use .PATH directives to use
     12 # the version here.
     13 
     14 SRCS+= getmntopts.c fattr.c checkname.c
     15 CPPFLAGS+= -I${.CURDIR} -DMOUNT_NOMAIN
     16 
     17 # Note: mount_portal is excluded by purpose, mainly because it contains
     18 # more stuff and hence cannot be made to export only mount_FOO() symbol
     19 MOUNT_PROGS=	mount_ados mount_cd9660 mount_ext2fs mount_fdesc mount_ffs \
     20 		mount_filecore mount_kernfs mount_lfs mount_msdos mount_nfs \
     21 		mount_ntfs mount_null mount_overlay mount_procfs mount_umap \
     22 		mount_union
     23 	
     24 # include individual source files and manpages to build process
     25 .for p in ${MOUNT_PROGS}
     26 .PATH: ${NETBSDSRCDIR}/sbin/${p}
     27 SRCS+=	${p}.c
     28 MAN+=	${p}.8
     29 LINKS+=	${BINDIR}/${PROG} ${BINDIR}/${p}
     30 .endfor
     31 
     32 # make mount_ufs alias for mount_ffs (this needs also support in checkname.c)
     33 LINKS+= ${BINDIR}/mount_ffs ${BINDIR}/mount_ufs
     34 MLINKS+= mount_ffs.8 mount_ufs.8
     35 
     36 CLEANFILES+=	checkname.c
     37 
     38 # generate checkname.c - code which runs appropriate mount_FOO() routine
     39 # according to program name
     40 checkname.c: ${.CURDIR}/Makefile
     41 	@if true; then \
     42 	  echo "/* File generated by make - DO NOT EDIT */";	\
     43 	  echo "#include <sys/types.h>";			\
     44 	  echo "#include <stdlib.h>";				\
     45 	  echo "#include <string.h>";				\
     46 	  echo "#include <mntopts.h>";				\
     47 	  for p in ${MOUNT_PROGS}; do 				\
     48 		echo "int $$p __P((int argc, char **argv));";	\
     49 	  done;							\
     50 	  echo "void checkname(int, char **);";			\
     51 	  echo;							\
     52 	  echo "void checkname(int argc, char **argv) {"; 	\
     53 	  echo "if (strcmp(getprogname(), \"mount\") == 0) return;";	\
     54 	  for p in ${MOUNT_PROGS}; do				\
     55 		echo "if (strcmp(getprogname(), \"$$p\") == 0)";	\
     56 		echo " exit($$p(argc, argv));";			\
     57 	  done;		\
     58 	  echo "if (strcmp(getprogname(), \"mount_ufs\") == 0)";	\
     59 	  echo " exit(mount_ffs(argc, argv));";			\
     60 	  echo "}";	\
     61 	fi > ${.TARGET}
     62 
     63 .include <bsd.prog.mk>
     64