Makefile revision 1.16
1#	$NetBSD: Makefile,v 1.16 2000/11/01 08:45:20 veego 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
33CLEANFILES+=	checkname.c
34
35# generate checkname.c - code which runs appropriate mount_FOO() routine
36# according to program name
37checkname.c: ${.CURDIR}/Makefile
38	@if true; then \
39	  echo "/* File generated by make - DO NOT EDIT */";	\
40	  echo "#include <sys/types.h>";			\
41	  echo "#include <mntopts.h>";				\
42	  for p in ${MOUNT_PROGS}; do 				\
43		echo "int $$p __P((int argc, char **argv));";	\
44	  done;							\
45	  echo "void checkname(int, char **);";			\
46	  echo;							\
47	  echo "void checkname(int argc, char **argv) {"; 	\
48	  echo "  extern const char *__progname;";		\
49	  echo "if (strcmp(__progname, \"mount\") == 0) return;";	\
50	  for p in ${MOUNT_PROGS}; do				\
51		echo "if (strcmp(__progname, \"$$p\") == 0)";	\
52		echo " exit($$p(argc, argv));";			\
53	  done;		\
54	  echo "if (strcmp(__progname, \"mount_ufs\") == 0)";	\
55	  echo " exit(mount_ffs(argc, argv));";			\
56	  echo "}";	\
57	fi > ${.TARGET}
58
59.include <bsd.prog.mk>
60