1 # $NetBSD: Makefile,v 1.56 2012/05/30 21:54:23 sjg Exp $
2 # @(#)Makefile 5.2 (Berkeley) 12/28/90
4 # $Id: Makefile.in,v 1.174 2012/10/10 18:46:24 sjg Exp $
7 SRCS= arch.c buf.c compat.c cond.c dir.c for.c hash.c job.c main.c \
8 make.c parse.c str.c suff.c targ.c trace.c var.c util.c
11 SRCS+= lstAppend.c lstAtEnd.c lstAtFront.c lstClose.c lstConcat.c \
12 lstDatum.c lstDeQueue.c lstDestroy.c lstDupl.c lstEnQueue.c \
13 lstFind.c lstFindFrom.c lstFirst.c lstForEach.c lstForEachFrom.c \
14 lstInit.c lstInsert.c lstIsAtEnd.c lstIsEmpty.c lstLast.c \
15 lstMember.c lstNext.c lstOpen.c lstRemove.c lstReplace.c lstSucc.c
18 # you can use this Makefile if you have an earlier version of bmake.
23 # Base version on src date
24 MAKE_VERSION= 20121010
26 MACHINE_ARCH=@machine_arch@
27 DEFAULT_SYS_PATH = @default_sys_path@
31 CFLAGS+= -D_PATH_DEFSYSPATH=\"${DEFAULT_SYS_PATH}\"
32 CFLAGS+= -I. -I${srcdir} @DEFS@ ${XDEFS} -DMAKE_NATIVE
33 CFLAGS+= ${CFLAGS_${.TARGET:T}}
34 CFLAGS+= ${COPTS.${.ALLSRC:M*.c:T:u}}
35 COPTS.main.c+= "-DMAKE_VERSION=\"${MAKE_VERSION}\""
41 SRCS+= ${LIBOBJS:T:.o=.c}
45 .if ${USE_META} != "no"
48 FILEMON_H ?= @filemon_h@
49 .if exists(${FILEMON_H}) && ${FILEMON_H:T} == "filemon.h"
50 COPTS.meta.c += -DHAVE_FILEMON_H -I${FILEMON_H:H}
55 .PATH: ${srcdir}/lst.lib
58 ARCH!= uname -p 2>/dev/null || uname -m
60 # list of OS's which are derrived from BSD4.4
61 isBSD44= NetBSD FreeBSD OpenBSD DragonFly
64 # Don't set these for anyone else since we don't know what the effect may be.
65 # On FreeBSD WARNS=2 sets a bunch of -W flags that make does not handle.
69 .if make(install) && exists(${DESTDIR}/usr/share/doc)
74 .if defined(.PARSEDIR)
75 # we cannot rely on anything but bmake to parse this correctly.
76 .if empty(isBSD44:M${OS})
78 INSTALL?=${srcdir}/install-sh
79 .if (${MACHINE} == "sun386")
80 # even I don't have one of these anymore :-)
82 .elif (${MACHINE} != "sunos")
84 CFLAGS+= -DSIGNAL_FLAGS=SA_RESTART
88 .if make(obj) || make(clean)
93 # many systems use gcc these days
95 .if ${CC_IS_GCC} == "yes"
97 CFLAGS_var.o+= -Wno-cast-qual
100 CFLAGS_main.o+= "-D@force_machine@MACHINE=\"${MACHINE}\"" "-DMACHINE_ARCH=\"${MACHINE_ARCH}\""
105 .if (${PROG} != "make")
106 my.history: ${MAKEFILE}
108 echo "is derived from NetBSD"; \
109 echo ".Xr make 1 ."; \
110 echo "It uses autoconf to facilitate portability to other platforms."; \
113 ${MAN}: make.1 my.history
114 @echo making ${PROG}.1
115 @sed -e 's/^.Nx/NetBSD/' -e '/^.Nm/s/make/${PROG}/' \
116 -e '/^.Sh HISTORY/rmy.history' \
117 -e '/^.Sh HISTORY/,$$s,^.Nm,make,' ${.CURDIR}/make.1 > $@
121 .if !empty(isBSD44:M${OS})
122 .if "${OS}" != "NetBSD"
129 MANDEST?= ${MANDIR}/${MANTARGET}1
131 .if ${MANTARGET} == "cat"
135 .if exists(${srcdir}/../Makefile.inc)
136 .include "${srcdir}/../Makefile.inc"
138 .-include <bsd.prog.mk>
139 # sigh, FreeBSD at least includes bsd.subdir.mk via bsd.obj.mk
140 # so the inclusion below, results in complaints about re-defined
141 # targets. For NetBSD though we need to explicitly include it.
142 .if defined(.PARSEDIR)
143 .if defined(SUBDIR) && !target(${SUBDIR:[1]})
144 .-include <bsd.subdir.mk>
148 CPPFLAGS+= -DMAKE_NATIVE
149 COPTS.var.c += -Wno-cast-qual
150 COPTS.job.c += -Wno-format-nonliteral
151 COPTS.parse.c += -Wno-format-nonliteral
152 COPTS.var.c += -Wno-format-nonliteral
155 BINDIR= ${prefix}/bin
156 MANDIR= ${prefix}/man
159 # make sure that MAKE_VERSION gets updated.
160 main.o: ${SRCS} ${MAKEFILE}
162 MK?=${prefix}/share/mk
164 INSTALL?=${srcdir}/install-sh
167 test -d ${DESTDIR}${BINDIR} || ${INSTALL} -m 775 -d ${DESTDIR}${BINDIR}
168 test -d ${DESTDIR}${MANDEST} || ${INSTALL} -m 775 -d ${DESTDIR}${MANDEST}
170 # latest version of *.mk includes an installer.
171 # you should not need to set USE_OS
173 .if exists(${MKSRC}/install-mk)
174 test -d ${DESTDIR}${MK} || ${INSTALL} -m 775 -d ${DESTDIR}${MK}
175 ${MKSRC}/install-mk -v -m 644 ${DESTDIR}${MK} ${USE_OS}
177 @echo need to unpack mk.tar.gz under ${srcdir} or set MKSRC; false
181 # this is a native netbsd build,
182 # use libutil rather than the local emalloc etc.
183 CPPFLAGS+= -DUSE_EMALLOC
188 # A simple unit-test driver to help catch regressions
190 cd ${.CURDIR}/unit-tests && MAKEFLAGS= ${.MAKE} -r -m / TEST_MAKE=${TEST_MAKE:U${.OBJDIR}/${PROG:T}} ${.TARGET}