Makefile revision 1.17
1#	$NetBSD: Makefile,v 1.17 2000/11/02 18:02:16 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
32MLINKS+= mount_ffs.8 mount_ufs.8
33
34CLEANFILES+=	checkname.c
35
36# generate checkname.c - code which runs appropriate mount_FOO() routine
37# according to program name
38checkname.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 <mntopts.h>";				\
43	  for p in ${MOUNT_PROGS}; do 				\
44		echo "int $$p __P((int argc, char **argv));";	\
45	  done;							\
46	  echo "void checkname(int, char **);";			\
47	  echo;							\
48	  echo "void checkname(int argc, char **argv) {"; 	\
49	  echo "  extern const char *__progname;";		\
50	  echo "if (strcmp(__progname, \"mount\") == 0) return;";	\
51	  for p in ${MOUNT_PROGS}; do				\
52		echo "if (strcmp(__progname, \"$$p\") == 0)";	\
53		echo " exit($$p(argc, argv));";			\
54	  done;		\
55	  echo "if (strcmp(__progname, \"mount_ufs\") == 0)";	\
56	  echo " exit(mount_ffs(argc, argv));";			\
57	  echo "}";	\
58	fi > ${.TARGET}
59
60.include <bsd.prog.mk>
61