Makefile revision 1.19 1 # $NetBSD: Makefile,v 1.19 2001/02/04 20:12:32 christos Exp $
2 # @(#)Makefile 8.6 (Berkeley) 5/8/95
3
4 PROG= mount
5 MAN= mount.8
6 SRCS= 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
12 SRCS+= getmntopts.c fattr.c checkname.c
13 CPPFLAGS+= -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
17 MOUNT_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}
25 SRCS+= ${p}.c
26 MAN+= ${p}.8
27 LINKS+= ${BINDIR}/${PROG} ${BINDIR}/${p}
28 .endfor
29
30 # make mount_ufs alias for mount_ffs (this needs also support in checkname.c)
31 LINKS+= ${BINDIR}/mount_ffs ${BINDIR}/mount_ufs
32 MLINKS+= mount_ffs.8 mount_ufs.8
33
34 CLEANFILES+= checkname.c
35
36 # generate checkname.c - code which runs appropriate mount_FOO() routine
37 # according to program name
38 checkname.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 <stdlib.h>"; \
43 echo "#include <string.h>"; \
44 echo "#include <mntopts.h>"; \
45 for p in ${MOUNT_PROGS}; do \
46 echo "int $$p __P((int argc, char **argv));"; \
47 done; \
48 echo "void checkname(int, char **);"; \
49 echo; \
50 echo "extern const char *__progname;"; \
51 echo; \
52 echo "void checkname(int argc, char **argv) {"; \
53 echo "if (strcmp(__progname, \"mount\") == 0) return;"; \
54 for p in ${MOUNT_PROGS}; do \
55 echo "if (strcmp(__progname, \"$$p\") == 0)"; \
56 echo " exit($$p(argc, argv));"; \
57 done; \
58 echo "if (strcmp(__progname, \"mount_ufs\") == 0)"; \
59 echo " exit(mount_ffs(argc, argv));"; \
60 echo "}"; \
61 fi > ${.TARGET}
62
63 .include <bsd.prog.mk>
64