3 ms·
BSD make (bmake) and its .mk includes are really simple, it's basically make with batteries included. Many makefiles may be reduced to two lines while no new s
by gkya 10y ago
BSD make (bmake) and its .mk includes are really simple, it's basically make with batteries included. Many makefiles may be reduced to two lines while no new syntax is introduced:
PROG=${.CURDIR:T}
.include <prog.mk>
It indirectly extends original BSD make. There are some syntactic differences from GNU make, but no big depart.
See http://www.crufty.net/help/sjg/bmake.htm http://www.crufty.net/help/sjg/bmake.htm
Here is a custom BSDmakefile for my website, a more extensive example where the mk libraries can't apply:
# makefile -- Build the website.
#
# $Id: makefile,v 1.10 2016/08/15 12:55:49 igk Exp $
#
#
M4=m4
AWK=awk
SED=sed
TIDY=tidy5
TARGS=-i -utf8
include config.mk
# Common templates for each output file.
MACROES=html.m4 config.m4
TMPL=${MACROES} meta.m4 header.html.m4 HERE footer.html.m4
HTML+=${LISTS:S/$/.html/}
ATOM=${LISTS:S/$/.atom.xml/}
OUT=${HTML} ${HTML:S/html$/&.m4/} ${HTML:S/html$/&.dirty/} ${ATOM}
.MAIN: ${HTML} ${ATOM}
# Generate lists.
.for L in ${LISTS}
$L.txt: $L.list
${AWK} -f list.awk ${.ALLSRC} > ${.TARGET}
$L.atom.xml: $L.list
${AWK} -f atom.awk ${.ALLSRC} \
| ${M4} ${MACROES} - \
| ${SED} '1,2d' > ${.TARGET}
.endfor
.ifndef NOTIDY
.for P in ${HTML}
$P : ${P}.dirty
${TIDY} ${TARGS} ${.ALLSRC} 2>/dev/null > ${.TARGET} || true
.endfor
.for P in ${HTML}
$P.dirty : ${TMPL:S/HERE/$P.m4/}
$(M4) ${.ALLSRC} > ${.TARGET}
.endfor
.else
.for P in ${HTML}
$P : ${TMPL:S/HERE/$P.m4/}
$(M4) ${.ALLSRC} > ${.TARGET}
.endfor
.endif # NOTIDY
.for P in ${HTML}
${P}.m4 : ${P:S/html$/txt/}
$(AWK) -f page.awk ${.ALLSRC} > ${.TARGET}
.endfor
clean:
rm -f ${OUT}
.PHONY: uuid pub ssh anal
uuid:
sh ./make-uuid.sh
pub:
sh ./publish.sh
ssh:
sh ./s.sh
anal:
sh ./analytics.sh