svc.startd: remove metainit dependency
[unleashed.git] / bin / bmake / Makefile
blobb217d8f7b2e86ac3ac07305c647e5c2a405b6f8d
1 # $Id: Makefile,v 1.67 2016/06/07 00:46:12 sjg Exp $
3 # Base version on src date
4 _MAKE_VERSION= 20160606
6 PROG= bmake
8 SRCS= \
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
31 # from lst.lib/
32 SRCS+= \
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
61 # this file gets generated by configure
62 .-include "Makefile.config"
64 .if !empty(LIBOBJS)
65 SRCS+= ${LIBOBJS:T:.o=.c}
66 .endif
68 # just in case
69 prefix?= /usr
70 srcdir?= ${.CURDIR}
72 DEFAULT_SYS_PATH?= ${prefix}/share/mk
74 CPPFLAGS+= -DUSE_META
75 CFLAGS+= -D_PATH_DEFSYSPATH=\"${DEFAULT_SYS_PATH}\"
76 CFLAGS+= ${COPTS.${.ALLSRC:M*.c:T:u}}
77 COPTS.main.c+= "-DMAKE_VERSION=\"${_MAKE_VERSION}\""
79 # meta mode can be useful even without filemon
80 FILEMON_H ?= /usr/include/dev/filemon/filemon.h
81 .if exists(${FILEMON_H}) && ${FILEMON_H:T} == "filemon.h"
82 COPTS.meta.c += -DHAVE_FILEMON_H -I${FILEMON_H:H}
83 .endif
85 .PATH: ${srcdir}
86 .PATH: ${srcdir}/lst.lib
88 .if make(obj) || make(clean)
89 SUBDIR+= unit-tests
90 .endif
92 MAN= ${PROG}.1
93 MAN1= ${MAN}
95 .if (${PROG} != "make")
96 CLEANFILES+= my.history
97 .if make(${MAN}) || !exists(${srcdir}/${MAN})
98 my.history: ${MAKEFILE}
99 @(echo ".Nm"; \
100 echo "is derived from NetBSD"; \
101 echo ".Xr make 1 ."; \
102 echo "It uses autoconf to facilitate portability to other platforms."; \
103 echo ".Pp") > $@
105 .NOPATH: ${MAN}
106 ${MAN}: make.1 my.history
107 @echo making $@
108 @sed -e 's/^.Nx/NetBSD/' -e '/^.Nm/s/make/${PROG}/' \
109 -e '/^.Sh HISTORY/rmy.history' \
110 -e '/^.Sh HISTORY/,$$s,^.Nm,make,' ${srcdir}/make.1 > $@
112 all beforeinstall: ${MAN}
113 _mfromdir=.
114 .endif
115 .endif
117 MANTARGET?= cat
118 MANDEST?= ${MANDIR}/${MANTARGET}1
120 .if ${MANTARGET} == "cat"
121 _mfromdir=${srcdir}
122 .endif
124 .include <prog.mk>
126 CPPFLAGS+= -DMAKE_NATIVE -DHAVE_CONFIG_H
127 COPTS.var.c += -Wno-cast-qual
128 COPTS.job.c += -Wno-format-nonliteral
129 COPTS.parse.c += -Wno-format-nonliteral
130 COPTS.var.c += -Wno-format-nonliteral
132 # Force these
133 SHAREDIR= ${SHAREDIR.bmake:U${prefix}/share}
134 BINDIR= ${BINDIR.bmake:U${prefix}/bin}
135 MANDIR= ${MANDIR.bmake:U${SHAREDIR}/man}
137 .if !exists(.depend)
138 ${OBJS}: config.h
139 .endif
141 # make sure that MAKE_VERSION gets updated.
142 main.o: ${SRCS} ${MAKEFILE}
144 SHARE_MK?=${SHAREDIR}/mk
145 MKSRC=${srcdir}/mk
146 install: install-mk
147 install-mk:
148 .if exists(${MKSRC}/install-mk)
149 test -d ${DESTDIR}${SHARE_MK} || ${INSTALL} -m ${DIRMODE} -d ${DESTDIR}${SHARE_MK}
150 sh ${MKSRC}/install-mk -v -m ${NONBINMODE} ${DESTDIR}${SHARE_MK}
151 .else
152 @echo need to unpack mk.tar.gz under ${srcdir} or set MKSRC; false
153 .endif
155 # A simple unit-test driver to help catch regressions
156 accept test:
157 cd ${.CURDIR}/unit-tests && MAKEFLAGS= ${.MAKE} -r -m / TEST_MAKE=${TEST_MAKE:U${.OBJDIR}/${PROG:T}} ${.TARGET}