NetBSD/sbin/mount/Makefile
2001-02-04 20:09:40 +00:00

64 lines
2.1 KiB
Makefile

# $NetBSD: Makefile,v 1.19 2001/02/04 20:12:32 christos Exp $
# @(#)Makefile 8.6 (Berkeley) 5/8/95
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
# 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: ${.CURDIR}/../${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 <sys/types.h>"; \
echo "#include <stdlib.h>"; \
echo "#include <string.h>"; \
echo "#include <mntopts.h>"; \
for p in ${MOUNT_PROGS}; do \
echo "int $$p __P((int argc, char **argv));"; \
done; \
echo "void checkname(int, char **);"; \
echo; \
echo "extern const char *__progname;"; \
echo; \
echo "void checkname(int argc, char **argv) {"; \
echo "if (strcmp(__progname, \"mount\") == 0) return;"; \
for p in ${MOUNT_PROGS}; do \
echo "if (strcmp(__progname, \"$$p\") == 0)"; \
echo " exit($$p(argc, argv));"; \
done; \
echo "if (strcmp(__progname, \"mount_ufs\") == 0)"; \
echo " exit(mount_ffs(argc, argv));"; \
echo "}"; \
fi > ${.TARGET}
.include <bsd.prog.mk>