1# $Id: Makefile,v 1.77 2016/12/12 07:34:19 sjg Exp $ 2 3# Base version on src date 4_MAKE_VERSION= 20161212 5 6PROG= bmake 7 8SRCS= \ 9 arch.c \ 10 buf.c \ 11 compat.c \ 12 cond.c \ 13 dir.c \ 14 for.c \ 15 hash.c \ 16 job.c \ 17 main.c \ 18 make.c \ 19 make_malloc.c \ 20 meta.c \ 21 metachar.c \ 22 parse.c \ 23 str.c \ 24 strlist.c \ 25 suff.c \ 26 targ.c \ 27 trace.c \ 28 util.c \ 29 var.c 30 31# from lst.lib/ 32SRCS+= \ 33 lstAppend.c \ 34 lstAtEnd.c \ 35 lstAtFront.c \ 36 lstClose.c \ 37 lstConcat.c \ 38 lstDatum.c \ 39 lstDeQueue.c \ 40 lstDestroy.c \ 41 lstDupl.c \ 42 lstEnQueue.c \ 43 lstFind.c \ 44 lstFindFrom.c \ 45 lstFirst.c \ 46 lstForEach.c \ 47 lstForEachFrom.c \ 48 lstInit.c \ 49 lstInsert.c \ 50 lstIsAtEnd.c \ 51 lstIsEmpty.c \ 52 lstLast.c \ 53 lstMember.c \ 54 lstNext.c \ 55 lstOpen.c \ 56 lstPrev.c \ 57 lstRemove.c \ 58 lstReplace.c \ 59 lstSucc.c 60 61# this file gets generated by configure 62.-include "Makefile.config" 63 64.if !empty(LIBOBJS) 65SRCS+= ${LIBOBJS:T:.o=.c} 66.endif 67 68# just in case 69prefix?= /usr 70srcdir?= ${.CURDIR} 71 72DEFAULT_SYS_PATH?= ${prefix}/share/mk 73 74CPPFLAGS+= -DUSE_META 75CFLAGS+= ${CPPFLAGS} 76CFLAGS+= -D_PATH_DEFSYSPATH=\"${DEFAULT_SYS_PATH}\" 77CFLAGS+= -I. -I${srcdir} ${XDEFS} -DMAKE_NATIVE 78CFLAGS+= ${COPTS.${.ALLSRC:M*.c:T:u}} 79COPTS.main.c+= "-DMAKE_VERSION=\"${_MAKE_VERSION}\"" 80 81# meta mode can be useful even without filemon 82FILEMON_H ?= /usr/include/dev/filemon/filemon.h 83.if exists(${FILEMON_H}) && ${FILEMON_H:T} == "filemon.h" 84COPTS.meta.c += -DHAVE_FILEMON_H -I${FILEMON_H:H} 85.endif 86 87.PATH: ${srcdir} 88.PATH: ${srcdir}/lst.lib 89 90.if make(obj) || make(clean) 91SUBDIR+= unit-tests 92.endif 93 94# start-delete1 for bsd.after-import.mk 95# we skip a lot of this when building as part of FreeBSD etc. 96 97# list of OS's which are derrived from BSD4.4 98BSD44_LIST= NetBSD FreeBSD OpenBSD DragonFly MirBSD Bitrig 99# we are... 100OS!= uname -s 101# are we 4.4BSD ? 102isBSD44:=${BSD44_LIST:M${OS}} 103 104.if ${isBSD44} == "" 105MANTARGET= cat 106INSTALL?=${srcdir}/install-sh 107.if (${MACHINE} == "sun386") 108# even I don't have one of these anymore :-) 109CFLAGS+= -DPORTAR 110.elif (${MACHINE} != "sunos") 111SRCS+= sigcompat.c 112CFLAGS+= -DSIGNAL_FLAGS=SA_RESTART 113.endif 114.else 115MANTARGET?= man 116.endif 117 118# turn this on by default - ignored if we are root 119WITH_INSTALL_AS_USER= 120 121# suppress with -DWITHOUT_* 122OPTIONS_DEFAULT_YES+= \ 123 AUTOCONF_MK \ 124 INSTALL_MK \ 125 PROG_LINK 126 127OPTIONS_DEFAULT_NO+= \ 128 PROG_VERSION 129 130# process options now 131.include <own.mk> 132 133.if ${MK_PROG_VERSION} == "yes" 134PROG_NAME= ${PROG}-${_MAKE_VERSION} 135.if ${MK_PROG_LINK} == "yes" 136SYMLINKS+= ${PROG_NAME} ${BINDIR}/${PROG} 137.endif 138.endif 139 140EXTRACT_MAN=no 141# end-delete1 142 143MAN= ${PROG}.1 144MAN1= ${MAN} 145 146.if (${PROG} != "make") 147CLEANFILES+= my.history 148.if make(${MAN}) || !exists(${srcdir}/${MAN}) 149my.history: ${MAKEFILE} 150 @(echo ".Nm"; \ 151 echo "is derived from NetBSD"; \ 152 echo ".Xr make 1 ."; \ 153 echo "It uses autoconf to facilitate portability to other platforms."; \ 154 echo ".Pp") > $@ 155 156.NOPATH: ${MAN} 157${MAN}: make.1 my.history 158 @echo making $@ 159 @sed \ 160 -e '/^.Dt/s/MAKE/${PROG:tu}/' \ 161 -e 's/^.Nx/NetBSD/' \ 162 -e '/^.Nm/s/make/${PROG}/' \ 163 -e '/^.Sh HISTORY/rmy.history' \ 164 -e '/^.Sh HISTORY/,$$s,^.Nm,make,' ${srcdir}/make.1 > $@ 165 166all beforeinstall: ${MAN} 167_mfromdir=. 168.endif 169.endif 170 171MANTARGET?= cat 172MANDEST?= ${MANDIR}/${MANTARGET}1 173 174.if ${MANTARGET} == "cat" 175_mfromdir=${srcdir} 176.endif 177 178.include <prog.mk> 179 180CPPFLAGS+= -DMAKE_NATIVE -DHAVE_CONFIG_H 181COPTS.var.c += -Wno-cast-qual 182COPTS.job.c += -Wno-format-nonliteral 183COPTS.parse.c += -Wno-format-nonliteral 184COPTS.var.c += -Wno-format-nonliteral 185 186# Force these 187SHAREDIR= ${SHAREDIR.bmake:U${prefix}/share} 188BINDIR= ${BINDIR.bmake:U${prefix}/bin} 189MANDIR= ${MANDIR.bmake:U${SHAREDIR}/man} 190 191.if !exists(.depend) 192${OBJS}: config.h 193.endif 194 195# make sure that MAKE_VERSION gets updated. 196main.o: ${SRCS} ${MAKEFILE} 197 198# start-delete2 for bsd.after-import.mk 199.if ${MK_AUTOCONF_MK} == "yes" 200.include <autoconf.mk> 201.endif 202SHARE_MK?=${SHAREDIR}/mk 203MKSRC=${srcdir}/mk 204INSTALL?=${srcdir}/install-sh 205 206.if ${MK_INSTALL_MK} == "yes" 207install: install-mk 208.endif 209 210beforeinstall: 211 test -d ${DESTDIR}${BINDIR} || ${INSTALL} -m 775 -d ${DESTDIR}${BINDIR} 212 test -d ${DESTDIR}${MANDEST} || ${INSTALL} -m 775 -d ${DESTDIR}${MANDEST} 213 214install-mk: 215.if exists(${MKSRC}/install-mk) 216 test -d ${DESTDIR}${SHARE_MK} || ${INSTALL} -m 775 -d ${DESTDIR}${SHARE_MK} 217 sh ${MKSRC}/install-mk -v -m 644 ${DESTDIR}${SHARE_MK} 218.else 219 @echo need to unpack mk.tar.gz under ${srcdir} or set MKSRC; false 220.endif 221# end-delete2 222 223# A simple unit-test driver to help catch regressions 224accept test: 225 cd ${.CURDIR}/unit-tests && MAKEFLAGS= ${.MAKE} -r -m / TEST_MAKE=${TEST_MAKE:U${.OBJDIR}/${PROG:T}} ${.TARGET} 226