specfs: suppress set but not used warnings
[unleashed.git] / bin / make / Makefile
blobe8c4cdaa056942474cc30d62ea14645021a39827
1 # $Id: Makefile,v 1.92 2017/05/10 22:29:04 sjg Exp $
3 # Base version on src date
4 _MAKE_VERSION= 20170510
6 PROG= make
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 LINKS= ${BINDIR}/make ${BINDIR}/bmake
63 # this file gets generated by configure
64 .-include "Makefile.config"
66 .if !empty(LIBOBJS)
67 SRCS+= ${LIBOBJS:T:.o=.c}
68 .endif
70 # just in case
71 prefix?= /usr
72 srcdir?= ${.CURDIR}
74 DEFAULT_SYS_PATH?= ${prefix}/share/mk
76 CPPFLAGS+= -DUSE_META
77 CFLAGS+= ${CPPFLAGS}
78 CFLAGS+= -D_PATH_DEFSYSPATH=\"${DEFAULT_SYS_PATH}\"
79 CFLAGS+= -I. -I${srcdir} ${XDEFS} -DMAKE_NATIVE
80 CFLAGS+= ${COPTS.${.ALLSRC:M*.c:T:u}}
81 COPTS.main.c+= "-DMAKE_VERSION=\"${_MAKE_VERSION}\""
83 # meta mode can be useful even without filemon
84 FILEMON_H ?= /usr/include/dev/filemon/filemon.h
85 .if exists(${FILEMON_H}) && ${FILEMON_H:T} == "filemon.h"
86 COPTS.meta.c += -DHAVE_FILEMON_H -I${FILEMON_H:H}
87 .endif
89 .PATH: ${srcdir}
90 .PATH: ${srcdir}/lst.lib
92 .if make(obj) || make(clean)
93 SUBDIR+= unit-tests
94 .endif
96 MAN= ${PROG}.1
97 MAN1= ${MAN}
99 .if (${PROG} != "make")
100 CLEANFILES+= my.history
101 .if make(${MAN}) || !exists(${srcdir}/${MAN})
102 my.history: ${MAKEFILE}
103 @(echo ".Nm"; \
104 echo "is derived from NetBSD"; \
105 echo ".Xr make 1 ."; \
106 echo "It uses autoconf to facilitate portability to other platforms."; \
107 echo ".Pp") > $@
109 .NOPATH: ${MAN}
110 ${MAN}: make.1 my.history
111 @echo making $@
112 @sed \
113 -e '/^.Dt/s/MAKE/${PROG:tu}/' \
114 -e 's/^.Nx/NetBSD/' \
115 -e '/^.Nm/s/make/${PROG}/' \
116 -e '/^.Sh HISTORY/rmy.history' \
117 -e '/^.Sh HISTORY/,$$s,^.Nm,make,' ${srcdir}/make.1 > $@
119 all beforeinstall: ${MAN}
120 _mfromdir=.
121 .endif
122 .endif
124 MANTARGET?= cat
125 MANDEST?= ${MANDIR}/${MANTARGET}1
127 .if ${MANTARGET} == "cat"
128 _mfromdir=${srcdir}
129 .endif
131 .include <prog.mk>
133 CPPFLAGS+= -DMAKE_NATIVE -DHAVE_CONFIG_H
134 COPTS.var.c += -Wno-cast-qual
135 COPTS.job.c += -Wno-format-nonliteral
136 COPTS.parse.c += -Wno-format-nonliteral
137 COPTS.var.c += -Wno-format-nonliteral
139 # Force these
140 SHAREDIR= ${SHAREDIR.bmake:U${prefix}/share}
141 BINDIR= ${BINDIR.bmake:U${prefix}/bin}
142 MANDIR= ${MANDIR.bmake:U${SHAREDIR}/man}
144 .if !exists(.depend)
145 ${OBJS}: config.h
146 .endif
148 # make sure that MAKE_VERSION gets updated.
149 main.o: ${SRCS} ${MAKEFILE}
151 # A simple unit-test driver to help catch regressions
152 accept test:
153 cd ${.CURDIR}/unit-tests && MAKEFLAGS= ${.MAKE} -r -m / TEST_MAKE=${TEST_MAKE:U${.OBJDIR}/${PROG:T}} ${.TARGET}