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