Makefile revision 1.23 1 # $NetBSD: Makefile,v 1.23 2002/09/01 08:10:53 taca Exp $
2 # @(#)Makefile 8.6 (Berkeley) 5/8/95
3
4 .include <bsd.own.mk>
5
6 PROG= mount
7 MAN= mount.8
8 SRCS= mount.c vfslist.c
9 # We do NOT install the getmntopts.3 man page.
10 # getmntopts.c in this directory isn't used by mount anymore, but it
11 # is used by other mount programs which use .PATH directives to use
12 # the version here.
13
14 SRCS+= getmntopts.c fattr.c checkname.c
15 CPPFLAGS+= -I${.CURDIR} -DMOUNT_NOMAIN
16
17 .if defined(RESCUEDIR)
18 CPPFLAGS+= -D_PATH_RESCUE=\"${RESCUEDIR}\"
19 .endif
20
21 # Note: mount_portal is excluded by purpose, mainly because it contains
22 # more stuff and hence cannot be made to export only mount_FOO() symbol
23 MOUNT_PROGS= mount_ados mount_cd9660 mount_ext2fs mount_fdesc mount_ffs \
24 mount_filecore mount_kernfs mount_lfs mount_msdos mount_nfs \
25 mount_ntfs mount_null mount_overlay mount_procfs mount_umap \
26 mount_union
27
28 # include individual source files and manpages to build process
29 .for p in ${MOUNT_PROGS}
30 .PATH: ${NETBSDSRCDIR}/sbin/${p}
31 SRCS+= ${p}.c
32 MAN+= ${p}.8
33 LINKS+= ${BINDIR}/${PROG} ${BINDIR}/${p}
34 .endfor
35
36 # make mount_ufs alias for mount_ffs (this needs also support in checkname.c)
37 LINKS+= ${BINDIR}/mount_ffs ${BINDIR}/mount_ufs
38 MLINKS+= mount_ffs.8 mount_ufs.8
39
40 CLEANFILES+= checkname.c
41
42 # generate checkname.c - code which runs appropriate mount_FOO() routine
43 # according to program name
44 checkname.c: ${.CURDIR}/Makefile
45 @if true; then \
46 echo "/* File generated by make - DO NOT EDIT */"; \
47 echo "#include <sys/types.h>"; \
48 echo "#include <stdlib.h>"; \
49 echo "#include <string.h>"; \
50 echo "#include <mntopts.h>"; \
51 for p in ${MOUNT_PROGS}; do \
52 echo "int $$p __P((int argc, char **argv));"; \
53 done; \
54 echo "void checkname(int, char **);"; \
55 echo; \
56 echo "void checkname(int argc, char **argv) {"; \
57 echo "if (strcmp(getprogname(), \"mount\") == 0) return;"; \
58 for p in ${MOUNT_PROGS}; do \
59 echo "if (strcmp(getprogname(), \"$$p\") == 0)"; \
60 echo " exit($$p(argc, argv));"; \
61 done; \
62 echo "if (strcmp(getprogname(), \"mount_ufs\") == 0)"; \
63 echo " exit(mount_ffs(argc, argv));"; \
64 echo "}"; \
65 fi > ${.TARGET}
66
67 .include <bsd.prog.mk>
68