Makefile revision 1.15
1#	$NetBSD: Makefile,v 1.15 2000/10/30 21:31:50 jdolecek Exp $
2#	@(#)Makefile	8.6 (Berkeley) 5/8/95
3
4PROG=	mount
5MAN=	mount.8
6SRCS=	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
12SRCS+= getmntopts.c fattr.c checkname.c
13CPPFLAGS+= -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
17MOUNT_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}
25SRCS+=	${p}.c
26MAN+=	${p}.8
27LINKS+=	${BINDIR}/${PROG} ${BINDIR}/${p}
28.endfor
29
30# make mount_ufs alias for mount_ffs (this needs also support in checkname.c)
31LINKS+= ${BINDIR}/mount_ffs ${BINDIR}/mount_ufs
32
33# generate checkname.c - code which runs appropriate mount_FOO() routine
34# according to program name
35checkname.c: ${.CURDIR}/Makefile
36	@if true; then \
37	  echo "/* File generated by make - DO NOT EDIT */";	\
38	  echo "#include <sys/types.h>";			\
39	  echo "#include <mntopts.h>";				\
40	  for p in ${MOUNT_PROGS}; do 				\
41		echo "int $$p __P((int argc, char **argv));";	\
42	  done;							\
43	  echo "void checkname(int, char **);";			\
44	  echo;							\
45	  echo "void checkname(int argc, char **argv) {"; 	\
46	  echo "  extern const char *__progname;";		\
47	  echo "if (strcmp(__progname, \"mount\") == 0) return;";	\
48	  for p in ${MOUNT_PROGS}; do				\
49		echo "if (strcmp(__progname, \"$$p\") == 0)";	\
50		echo " exit($$p(argc, argv));";			\
51	  done;		\
52	  echo "if (strcmp(__progname, \"mount_ufs\") == 0)";	\
53	  echo " exit(mount_ffs(argc, argv));";			\
54	  echo "}";	\
55	fi > ${.TARGET}
56
57.include <bsd.prog.mk>
58