1 # $NetBSD: Makefile,v 1.50 2010/04/22 19:15:23 sjg Exp $
2 # @(#)Makefile 5.2 (Berkeley) 12/28/90
4 # $Id: Makefile.in,v 1.1.1.9 2010/09/07 14:11:16 joerg 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= 20100808
26 MACHINE_ARCH=@machine_arch@
27 DEFAULT_SYS_PATH = @default_sys_path@
29 CFLAGS+= -D_PATH_DEFSYSPATH=\"${DEFAULT_SYS_PATH}\"
30 CFLAGS+= -I. -I${srcdir} @DEFS@ @CPPFLAGS@ ${XDEFS} -DMAKE_NATIVE
31 CFLAGS+= ${CFLAGS_${.TARGET:T}}
32 CFLAGS_main.o= "-DMAKE_VERSION=\"${MAKE_VERSION}\""
38 SRCS+= ${LIBOBJS:T:.o=.c}
42 .PATH: ${srcdir}/lst.lib
45 ARCH!= uname -p 2>/dev/null || uname -m
47 # list of OS's which are derrived from BSD4.4
48 isBSD44= NetBSD FreeBSD OpenBSD DragonFly
51 # Don't set these for anyone else since we don't know what the effect may be.
52 # On FreeBSD WARNS=2 sets a bunch of -W flags that make does not handle.
56 .if make(install) && exists(${DESTDIR}/usr/share/doc)
61 .if empty(isBSD44:M${OS})
62 # XXX not sure if we still want this given that configure
63 # lets us force or not the definition of MACHINE.
64 CFLAGS_main.o+= "-DFORCE_MACHINE=\"${MACHINE}\""
66 INSTALL?=${srcdir}/install-sh
67 .if (${MACHINE} == "sun386")
68 # even I don't have one of these anymore :-)
70 .elif (${MACHINE} != "sunos")
72 CFLAGS+= -DSIGNAL_FLAGS=SA_RESTART
75 .if make(obj) || make(clean)
79 # many systems use gcc these days
81 .if ${CC_IS_GCC} == "yes"
83 CFLAGS_var.o+= -Wno-cast-qual
86 CFLAGS_main.o+= "-D@force_machine@MACHINE=\"${MACHINE}\"" "-DMACHINE_ARCH=\"${MACHINE_ARCH}\""
91 .if (${PROG} != "make")
93 @echo making ${PROG}.1
94 @sed -e '/^.Nm/s/make/${PROG}/' -e '/^.Sh HISTORY/,$$d' ${srcdir}/make.1 > $@
95 @(echo ".Sh HISTORY"; echo ".Nm"; echo "is derived from NetBSD's"; echo ".Xr make 1 ."; echo It uses autoconf to facilitate portability to other platforms.) >> $@
99 .if !empty(isBSD44:M${OS})
100 .if "${OS}" != "NetBSD"
107 MANDEST?= ${MANDIR}/${MANTARGET}1
109 .if ${MANTARGET} == "cat"
113 .if exists(${srcdir}/../Makefile.inc)
114 .include "${srcdir}/../Makefile.inc"
116 .-include <bsd.prog.mk>
117 # sigh, FreeBSD at least includes bsd.subdir.mk via bsd.obj.mk
118 # so the inclusion below, results in complaints about re-defined
119 # targets. For NetBSD though we need to explicitly include it.
120 .if defined(SUBDIR) && !target(${SUBDIR:[1]})
121 .-include <bsd.subdir.mk>
125 BINDIR= ${prefix}/bin
126 MANDIR= ${prefix}/man
129 # make sure that MAKE_VERSION gets updated.
130 main.o: ${SRCS} ${MAKEFILE}
132 MK?=${prefix}/share/mk
134 INSTALL?=${srcdir}/install-sh
137 test -d ${DESTDIR}${BINDIR} || ${INSTALL} -m 775 -d ${DESTDIR}${BINDIR}
138 test -d ${DESTDIR}${MANDEST} || ${INSTALL} -m 775 -d ${DESTDIR}${MANDEST}
140 # latest version of *.mk includes an installer.
141 # you should not need to set USE_OS
143 .if exists(${MKSRC}/install-mk)
144 test -d ${DESTDIR}${MK} || ${INSTALL} -m 775 -d ${DESTDIR}${MK}
145 ${MKSRC}/install-mk -v -m 644 ${DESTDIR}${MK} ${USE_OS}
147 @echo need to unpack mk.tar.gz under ${srcdir} or set MKSRC; false
149 CFLAGS_var.o += -Wno-cast-qual
152 # this is a native netbsd build,
153 # use libutil rather than the local emalloc etc.
154 CPPFLAGS+= -DUSE_EMALLOC
159 # A simple unit-test driver to help catch regressions
161 cd ${.CURDIR}/unit-tests && ${.MAKE} -r -m / TEST_MAKE=${TEST_MAKE:U${.OBJDIR}/${PROG:T}} ${.TARGET}