1321964Ssjg# $Id: Makefile,v 1.95 2017/07/20 19:36:13 sjg Exp $ 2246149Ssjg 3246149Ssjg# Base version on src date 4321964Ssjg_MAKE_VERSION= 20170720 5246149Ssjg 6246149SsjgPROG= bmake 7246149Ssjg 8246149SsjgSRCS= \ 9246149Ssjg arch.c \ 10246149Ssjg buf.c \ 11246149Ssjg compat.c \ 12246149Ssjg cond.c \ 13246149Ssjg dir.c \ 14246149Ssjg for.c \ 15246149Ssjg hash.c \ 16246149Ssjg job.c \ 17246149Ssjg main.c \ 18246149Ssjg make.c \ 19246149Ssjg make_malloc.c \ 20246149Ssjg meta.c \ 21292068Ssjg metachar.c \ 22246149Ssjg parse.c \ 23246149Ssjg str.c \ 24246149Ssjg strlist.c \ 25246149Ssjg suff.c \ 26246149Ssjg targ.c \ 27246149Ssjg trace.c \ 28246149Ssjg util.c \ 29246149Ssjg var.c 30246149Ssjg 31246149Ssjg# from lst.lib/ 32246149SsjgSRCS+= \ 33246149Ssjg lstAppend.c \ 34246149Ssjg lstAtEnd.c \ 35246149Ssjg lstAtFront.c \ 36246149Ssjg lstClose.c \ 37246149Ssjg lstConcat.c \ 38246149Ssjg lstDatum.c \ 39246149Ssjg lstDeQueue.c \ 40246149Ssjg lstDestroy.c \ 41246149Ssjg lstDupl.c \ 42246149Ssjg lstEnQueue.c \ 43246149Ssjg lstFind.c \ 44246149Ssjg lstFindFrom.c \ 45246149Ssjg lstFirst.c \ 46246149Ssjg lstForEach.c \ 47246149Ssjg lstForEachFrom.c \ 48246149Ssjg lstInit.c \ 49246149Ssjg lstInsert.c \ 50246149Ssjg lstIsAtEnd.c \ 51246149Ssjg lstIsEmpty.c \ 52246149Ssjg lstLast.c \ 53246149Ssjg lstMember.c \ 54246149Ssjg lstNext.c \ 55246149Ssjg lstOpen.c \ 56246149Ssjg lstPrev.c \ 57246149Ssjg lstRemove.c \ 58246149Ssjg lstReplace.c \ 59246149Ssjg lstSucc.c 60246149Ssjg 61246149Ssjg# this file gets generated by configure 62246149Ssjg.-include "Makefile.config" 63246149Ssjg 64246149Ssjg.if !empty(LIBOBJS) 65246149SsjgSRCS+= ${LIBOBJS:T:.o=.c} 66246149Ssjg.endif 67246149Ssjg 68246149Ssjg# just in case 69246149Ssjgprefix?= /usr 70246149Ssjgsrcdir?= ${.CURDIR} 71246149Ssjg 72276305SngieDEFAULT_SYS_PATH?= ${prefix}/share/mk 73246149Ssjg 74246149SsjgCPPFLAGS+= -DUSE_META 75246149SsjgCFLAGS+= ${CPPFLAGS} 76246149SsjgCFLAGS+= -D_PATH_DEFSYSPATH=\"${DEFAULT_SYS_PATH}\" 77246149SsjgCFLAGS+= -I. -I${srcdir} ${XDEFS} -DMAKE_NATIVE 78246149SsjgCFLAGS+= ${COPTS.${.ALLSRC:M*.c:T:u}} 79321964SsjgCOPTS.main.c+= "-DMAKE_VERSION=\"${_MAKE_VERSION}\"" 80246149Ssjg 81246149Ssjg# meta mode can be useful even without filemon 82246149SsjgFILEMON_H ?= /usr/include/dev/filemon/filemon.h 83246149Ssjg.if exists(${FILEMON_H}) && ${FILEMON_H:T} == "filemon.h" 84246149SsjgCOPTS.meta.c += -DHAVE_FILEMON_H -I${FILEMON_H:H} 85246149Ssjg.endif 86246149Ssjg 87246149Ssjg.PATH: ${srcdir} 88246149Ssjg.PATH: ${srcdir}/lst.lib 89246149Ssjg 90246149Ssjg.if make(obj) || make(clean) 91246149SsjgSUBDIR+= unit-tests 92246149Ssjg.endif 93246149Ssjg 94246149Ssjg# start-delete1 for bsd.after-import.mk 95246149Ssjg# we skip a lot of this when building as part of FreeBSD etc. 96246149Ssjg 97246149Ssjg# list of OS's which are derrived from BSD4.4 98292068SsjgBSD44_LIST= NetBSD FreeBSD OpenBSD DragonFly MirBSD Bitrig 99246149Ssjg# we are... 100246149SsjgOS!= uname -s 101246149Ssjg# are we 4.4BSD ? 102246149SsjgisBSD44:=${BSD44_LIST:M${OS}} 103246149Ssjg 104246149Ssjg.if ${isBSD44} == "" 105246149SsjgMANTARGET= cat 106246149SsjgINSTALL?=${srcdir}/install-sh 107246149Ssjg.if (${MACHINE} == "sun386") 108246149Ssjg# even I don't have one of these anymore :-) 109246149SsjgCFLAGS+= -DPORTAR 110246149Ssjg.elif (${MACHINE} != "sunos") 111246149SsjgSRCS+= sigcompat.c 112246149SsjgCFLAGS+= -DSIGNAL_FLAGS=SA_RESTART 113246149Ssjg.endif 114246149Ssjg.else 115246149SsjgMANTARGET?= man 116246149Ssjg.endif 117246149Ssjg 118246149Ssjg# turn this on by default - ignored if we are root 119246149SsjgWITH_INSTALL_AS_USER= 120246149Ssjg 121276305Sngie# suppress with -DWITHOUT_* 122246149SsjgOPTIONS_DEFAULT_YES+= \ 123246149Ssjg AUTOCONF_MK \ 124246149Ssjg INSTALL_MK \ 125246149Ssjg PROG_LINK 126246149Ssjg 127246149SsjgOPTIONS_DEFAULT_NO+= \ 128246149Ssjg PROG_VERSION 129246149Ssjg 130246149Ssjg# process options now 131246149Ssjg.include <own.mk> 132246149Ssjg 133246149Ssjg.if ${MK_PROG_VERSION} == "yes" 134321964SsjgPROG_NAME= ${PROG}-${_MAKE_VERSION} 135246149Ssjg.if ${MK_PROG_LINK} == "yes" 136321964SsjgSYMLINKS+= ${PROG_NAME} ${BINDIR}/${PROG} 137246149Ssjg.endif 138246149Ssjg.endif 139246149Ssjg 140246149SsjgEXTRACT_MAN=no 141246149Ssjg# end-delete1 142246149Ssjg 143246149SsjgMAN= ${PROG}.1 144246149SsjgMAN1= ${MAN} 145246149Ssjg 146246149Ssjg.if (${PROG} != "make") 147246149SsjgCLEANFILES+= my.history 148246149Ssjg.if make(${MAN}) || !exists(${srcdir}/${MAN}) 149246149Ssjgmy.history: ${MAKEFILE} 150246149Ssjg @(echo ".Nm"; \ 151246149Ssjg echo "is derived from NetBSD"; \ 152246149Ssjg echo ".Xr make 1 ."; \ 153246149Ssjg echo "It uses autoconf to facilitate portability to other platforms."; \ 154246149Ssjg echo ".Pp") > $@ 155246149Ssjg 156246149Ssjg.NOPATH: ${MAN} 157246149Ssjg${MAN}: make.1 my.history 158246149Ssjg @echo making $@ 159321964Ssjg @sed \ 160321964Ssjg -e '/^.Dt/s/MAKE/${PROG:tu}/' \ 161321964Ssjg -e 's/^.Nx/NetBSD/' \ 162321964Ssjg -e '/^.Nm/s/make/${PROG}/' \ 163246149Ssjg -e '/^.Sh HISTORY/rmy.history' \ 164246149Ssjg -e '/^.Sh HISTORY/,$$s,^.Nm,make,' ${srcdir}/make.1 > $@ 165246149Ssjg 166246149Ssjgall beforeinstall: ${MAN} 167246149Ssjg_mfromdir=. 168246149Ssjg.endif 169246149Ssjg.endif 170246149Ssjg 171246149SsjgMANTARGET?= cat 172246149SsjgMANDEST?= ${MANDIR}/${MANTARGET}1 173246149Ssjg 174246149Ssjg.if ${MANTARGET} == "cat" 175246149Ssjg_mfromdir=${srcdir} 176246149Ssjg.endif 177246149Ssjg 178246149Ssjg.include <prog.mk> 179246149Ssjg 180246149SsjgCPPFLAGS+= -DMAKE_NATIVE -DHAVE_CONFIG_H 181246149SsjgCOPTS.var.c += -Wno-cast-qual 182246149SsjgCOPTS.job.c += -Wno-format-nonliteral 183246149SsjgCOPTS.parse.c += -Wno-format-nonliteral 184246149SsjgCOPTS.var.c += -Wno-format-nonliteral 185246149Ssjg 186246149Ssjg# Force these 187292068SsjgSHAREDIR= ${SHAREDIR.bmake:U${prefix}/share} 188292068SsjgBINDIR= ${BINDIR.bmake:U${prefix}/bin} 189292068SsjgMANDIR= ${MANDIR.bmake:U${SHAREDIR}/man} 190246149Ssjg 191246149Ssjg.if !exists(.depend) 192246149Ssjg${OBJS}: config.h 193246149Ssjg.endif 194246149Ssjg 195246149Ssjg# make sure that MAKE_VERSION gets updated. 196246149Ssjgmain.o: ${SRCS} ${MAKEFILE} 197246149Ssjg 198246149Ssjg# start-delete2 for bsd.after-import.mk 199249033Ssjg.if ${MK_AUTOCONF_MK} == "yes" 200249033Ssjg.include <autoconf.mk> 201249033Ssjg.endif 202246149SsjgSHARE_MK?=${SHAREDIR}/mk 203246149SsjgMKSRC=${srcdir}/mk 204246149SsjgINSTALL?=${srcdir}/install-sh 205246149Ssjg 206246149Ssjg.if ${MK_INSTALL_MK} == "yes" 207246149Ssjginstall: install-mk 208246149Ssjg.endif 209246149Ssjg 210246149Ssjgbeforeinstall: 211246149Ssjg test -d ${DESTDIR}${BINDIR} || ${INSTALL} -m 775 -d ${DESTDIR}${BINDIR} 212246149Ssjg test -d ${DESTDIR}${MANDEST} || ${INSTALL} -m 775 -d ${DESTDIR}${MANDEST} 213246149Ssjg 214246149Ssjginstall-mk: 215246149Ssjg.if exists(${MKSRC}/install-mk) 216246149Ssjg test -d ${DESTDIR}${SHARE_MK} || ${INSTALL} -m 775 -d ${DESTDIR}${SHARE_MK} 217246149Ssjg sh ${MKSRC}/install-mk -v -m 644 ${DESTDIR}${SHARE_MK} 218246149Ssjg.else 219246149Ssjg @echo need to unpack mk.tar.gz under ${srcdir} or set MKSRC; false 220246149Ssjg.endif 221246149Ssjg# end-delete2 222246149Ssjg 223246149Ssjg# A simple unit-test driver to help catch regressions 224246149Ssjgaccept test: 225246149Ssjg cd ${.CURDIR}/unit-tests && MAKEFLAGS= ${.MAKE} -r -m / TEST_MAKE=${TEST_MAKE:U${.OBJDIR}/${PROG:T}} ${.TARGET} 226