Makefile revision 1.24 1 # $NetBSD: Makefile,v 1.24 2002/09/21 18:43:31 christos 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 DPADD+=${LIBUTIL}
43 LDADD+=-lutil
44
45 # generate checkname.c - code which runs appropriate mount_FOO() routine
46 # according to program name
47 checkname.c: ${.CURDIR}/Makefile
48 @if true; then \
49 echo "/* File generated by make - DO NOT EDIT */"; \
50 echo "#include <sys/types.h>"; \
51 echo "#include <stdlib.h>"; \
52 echo "#include <string.h>"; \
53 echo "#include <mntopts.h>"; \
54 for p in ${MOUNT_PROGS}; do \
55 echo "int $$p __P((int argc, char **argv));"; \
56 done; \
57 echo "void checkname(int, char **);"; \
58 echo; \
59 echo "void checkname(int argc, char **argv) {"; \
60 echo "if (strcmp(getprogname(), \"mount\") == 0) return;"; \
61 for p in ${MOUNT_PROGS}; do \
62 echo "if (strcmp(getprogname(), \"$$p\") == 0)"; \
63 echo " exit($$p(argc, argv));"; \
64 done; \
65 echo "if (strcmp(getprogname(), \"mount_ufs\") == 0)"; \
66 echo " exit(mount_ffs(argc, argv));"; \
67 echo "}"; \
68 fi > ${.TARGET}
69
70 .include <bsd.prog.mk>
71