# $NetBSD: Makefile,v 1.23 2002/09/01 08:10:53 taca Exp $ # @(#)Makefile 8.6 (Berkeley) 5/8/95 .include PROG= mount MAN= mount.8 SRCS= mount.c vfslist.c # We do NOT install the getmntopts.3 man page. # getmntopts.c in this directory isn't used by mount anymore, but it # is used by other mount programs which use .PATH directives to use # the version here. SRCS+= getmntopts.c fattr.c checkname.c CPPFLAGS+= -I${.CURDIR} -DMOUNT_NOMAIN .if defined(RESCUEDIR) CPPFLAGS+= -D_PATH_RESCUE=\"${RESCUEDIR}\" .endif # Note: mount_portal is excluded by purpose, mainly because it contains # more stuff and hence cannot be made to export only mount_FOO() symbol MOUNT_PROGS= mount_ados mount_cd9660 mount_ext2fs mount_fdesc mount_ffs \ mount_filecore mount_kernfs mount_lfs mount_msdos mount_nfs \ mount_ntfs mount_null mount_overlay mount_procfs mount_umap \ mount_union # include individual source files and manpages to build process .for p in ${MOUNT_PROGS} .PATH: ${NETBSDSRCDIR}/sbin/${p} SRCS+= ${p}.c MAN+= ${p}.8 LINKS+= ${BINDIR}/${PROG} ${BINDIR}/${p} .endfor # make mount_ufs alias for mount_ffs (this needs also support in checkname.c) LINKS+= ${BINDIR}/mount_ffs ${BINDIR}/mount_ufs MLINKS+= mount_ffs.8 mount_ufs.8 CLEANFILES+= checkname.c # generate checkname.c - code which runs appropriate mount_FOO() routine # according to program name checkname.c: ${.CURDIR}/Makefile @if true; then \ echo "/* File generated by make - DO NOT EDIT */"; \ echo "#include "; \ echo "#include "; \ echo "#include "; \ echo "#include "; \ for p in ${MOUNT_PROGS}; do \ echo "int $$p __P((int argc, char **argv));"; \ done; \ echo "void checkname(int, char **);"; \ echo; \ echo "void checkname(int argc, char **argv) {"; \ echo "if (strcmp(getprogname(), \"mount\") == 0) return;"; \ for p in ${MOUNT_PROGS}; do \ echo "if (strcmp(getprogname(), \"$$p\") == 0)"; \ echo " exit($$p(argc, argv));"; \ done; \ echo "if (strcmp(getprogname(), \"mount_ufs\") == 0)"; \ echo " exit(mount_ffs(argc, argv));"; \ echo "}"; \ fi > ${.TARGET} .include