bsd.after-import.mk (a34d5fb1) | bsd.after-import.mk (6a91b982) |
---|---|
1# $Id: bsd.after-import.mk,v 1.16 2020/07/12 03:39:01 sjg Exp $ | 1# $Id: bsd.after-import.mk,v 1.12 2014/02/14 23:45:49 sjg Exp $ |
2 3# This makefile is for use when integrating bmake into a BSD build 4# system. Use this makefile after importing bmake. 5# It will bootstrap the new version, 6# capture the generated files we need, and add an after-import 7# target to allow the process to be easily repeated. 8 9# The goal is to allow the benefits of autoconf without 10# the overhead of running configure. 11 | 2 3# This makefile is for use when integrating bmake into a BSD build 4# system. Use this makefile after importing bmake. 5# It will bootstrap the new version, 6# capture the generated files we need, and add an after-import 7# target to allow the process to be easily repeated. 8 9# The goal is to allow the benefits of autoconf without 10# the overhead of running configure. 11 |
12all: _makefile _utmakefile | 12all: _makefile |
13all: after-import 14 15# we rely on bmake 16.if !defined(.PARSEDIR) 17.error this makefile requires bmake 18.endif 19 20_this := ${MAKEFILE:tA} --- 11 unchanged lines hidden (view full) --- 32.endfor 33.endif 34.if !empty(srctop) 35SRCTOP := ${srctop} 36.endif 37.endif 38 39# This lets us match what boot-strap does | 13all: after-import 14 15# we rely on bmake 16.if !defined(.PARSEDIR) 17.error this makefile requires bmake 18.endif 19 20_this := ${MAKEFILE:tA} --- 11 unchanged lines hidden (view full) --- 32.endfor 33.endif 34.if !empty(srctop) 35SRCTOP := ${srctop} 36.endif 37.endif 38 39# This lets us match what boot-strap does |
40.if defined(.MAKE.OS) 41HOST_OS:= ${.MAKE.OS} 42.elif !defined(HOST_OS) | 40.if !defined(HOST_OS) |
43HOST_OS!= uname 44.endif 45 46BOOTSTRAP_ARGS = \ 47 --prefix /usr \ 48 --share /usr/share 49 50.if !empty(DEFAULT_SYS_PATH) 51BOOTSTRAP_ARGS += --with-default-sys-path='${DEFAULT_SYS_PATH}' 52.endif 53 54# run boot-strap with minimal influence 55bootstrap: ${BMAKE_SRC}/boot-strap ${MAKEFILE} 56 HOME=/ ${BMAKE_SRC}/boot-strap -o ${HOST_OS} ${BOOTSTRAP_ARGS} ${BOOTSTRAP_XTRAS} 57 touch ${.TARGET} 58 59# Makefiles need a little more tweaking than say config.h 60MAKEFILE_SED = sed -e '/^MACHINE/d' \ | 41HOST_OS!= uname 42.endif 43 44BOOTSTRAP_ARGS = \ 45 --prefix /usr \ 46 --share /usr/share 47 48.if !empty(DEFAULT_SYS_PATH) 49BOOTSTRAP_ARGS += --with-default-sys-path='${DEFAULT_SYS_PATH}' 50.endif 51 52# run boot-strap with minimal influence 53bootstrap: ${BMAKE_SRC}/boot-strap ${MAKEFILE} 54 HOME=/ ${BMAKE_SRC}/boot-strap -o ${HOST_OS} ${BOOTSTRAP_ARGS} ${BOOTSTRAP_XTRAS} 55 touch ${.TARGET} 56 57# Makefiles need a little more tweaking than say config.h 58MAKEFILE_SED = sed -e '/^MACHINE/d' \ |
61 -e '/include.*VERSION/d' \ | |
62 -e '/^PROG/ { s,=,?=,;s,bmake,$${.CURDIR:T},; }' \ 63 -e 's,^.-include,.sinclude,' \ 64 -e '/^\..*include *</ { s,<,<bsd.,;/autoconf/d; }' \ 65 -e 's,${SRCTOP},$${SRCTOP},g' 66 67# These are the simple files we want to capture | 59 -e '/^PROG/ { s,=,?=,;s,bmake,$${.CURDIR:T},; }' \ 60 -e 's,^.-include,.sinclude,' \ 61 -e '/^\..*include *</ { s,<,<bsd.,;/autoconf/d; }' \ 62 -e 's,${SRCTOP},$${SRCTOP},g' 63 64# These are the simple files we want to capture |
68configured_files= config.h Makefile.config unit-tests/Makefile.config | 65configured_files= config.h Makefile.config unit-tests/Makefile |
69 70after-import: bootstrap ${MAKEFILE} 71.for f in ${configured_files:M*.[ch]} 72 @echo Capturing $f 73 @mkdir -p ${${.CURDIR}/$f:L:H} 74 @(echo '/* $$${HOST_OS}$$ */'; cat ${HOST_OS}/$f) > ${.CURDIR}/$f 75.endfor 76.for f in ${configured_files:M*Makefile*} --- 7 unchanged lines hidden (view full) --- 84.endfor 85 86# this needs the most work 87_makefile: bootstrap ${MAKEFILE} 88 @echo Generating ${.CURDIR}/Makefile 89 @(echo '# This is a generated file, do NOT edit!'; \ 90 echo '# See ${_this:S,${SRCTOP}/,,}'; \ 91 echo '#'; echo '# $$${HOST_OS}$$'; \ | 66 67after-import: bootstrap ${MAKEFILE} 68.for f in ${configured_files:M*.[ch]} 69 @echo Capturing $f 70 @mkdir -p ${${.CURDIR}/$f:L:H} 71 @(echo '/* $$${HOST_OS}$$ */'; cat ${HOST_OS}/$f) > ${.CURDIR}/$f 72.endfor 73.for f in ${configured_files:M*Makefile*} --- 7 unchanged lines hidden (view full) --- 81.endfor 82 83# this needs the most work 84_makefile: bootstrap ${MAKEFILE} 85 @echo Generating ${.CURDIR}/Makefile 86 @(echo '# This is a generated file, do NOT edit!'; \ 87 echo '# See ${_this:S,${SRCTOP}/,,}'; \ 88 echo '#'; echo '# $$${HOST_OS}$$'; \ |
89 echo; echo '.sinclude "Makefile.inc"'; \ |
|
92 echo; echo 'SRCTOP?= $${.CURDIR:${.CURDIR:S,${SRCTOP}/,,:C,[^/]+,H,g:S,/,:,g}}'; \ 93 echo; echo '# look here first for config.h'; \ 94 echo 'CFLAGS+= -I$${.CURDIR}'; echo; \ 95 echo '# for after-import'; \ 96 echo 'CLEANDIRS+= ${HOST_OS}'; \ 97 echo 'CLEANFILES+= bootstrap'; echo; \ 98 ${MAKEFILE_SED} \ 99 ${1 2:L:@n@-e '/start-delete$n/,/end-delete$n/d'@} \ --- 4 unchanged lines hidden (view full) --- 104 echo; echo '# make sure we get this'; \ 105 echo 'CFLAGS+= $${COPTS.$${.IMPSRC:T}}'; \ 106 echo; echo 'after-import: ${_this:S,${SRCTOP},\${SRCTOP},}'; \ 107 echo ' cd $${.CURDIR} && $${.MAKE} -f ${_this:S,${SRCTOP},\${SRCTOP},}'; \ 108 echo ) > ${.TARGET} 109 @cmp -s ${.TARGET} ${.CURDIR}/Makefile || \ 110 mv ${.TARGET} ${.CURDIR}/Makefile 111 | 90 echo; echo 'SRCTOP?= $${.CURDIR:${.CURDIR:S,${SRCTOP}/,,:C,[^/]+,H,g:S,/,:,g}}'; \ 91 echo; echo '# look here first for config.h'; \ 92 echo 'CFLAGS+= -I$${.CURDIR}'; echo; \ 93 echo '# for after-import'; \ 94 echo 'CLEANDIRS+= ${HOST_OS}'; \ 95 echo 'CLEANFILES+= bootstrap'; echo; \ 96 ${MAKEFILE_SED} \ 97 ${1 2:L:@n@-e '/start-delete$n/,/end-delete$n/d'@} \ --- 4 unchanged lines hidden (view full) --- 102 echo; echo '# make sure we get this'; \ 103 echo 'CFLAGS+= $${COPTS.$${.IMPSRC:T}}'; \ 104 echo; echo 'after-import: ${_this:S,${SRCTOP},\${SRCTOP},}'; \ 105 echo ' cd $${.CURDIR} && $${.MAKE} -f ${_this:S,${SRCTOP},\${SRCTOP},}'; \ 106 echo ) > ${.TARGET} 107 @cmp -s ${.TARGET} ${.CURDIR}/Makefile || \ 108 mv ${.TARGET} ${.CURDIR}/Makefile 109 |
112_utmakefile: bootstrap ${MAKEFILE} 113 @echo Generating ${.CURDIR}/unit-tests/Makefile 114 @mkdir -p ${.CURDIR}/unit-tests 115 @(echo '# This is a generated file, do NOT edit!'; \ 116 echo '# See ${_this:S,${SRCTOP}/,,}'; \ 117 echo '#'; echo '# $$${HOST_OS}$$'; \ 118 ${MAKEFILE_SED} \ 119 -e '/^UNIT_TESTS/s,=.*,= $${srcdir},' \ 120 ${BMAKE_SRC}/unit-tests/Makefile ) > ${.TARGET} 121 @cmp -s ${.TARGET} ${.CURDIR}/unit-tests/Makefile || \ 122 mv ${.TARGET} ${.CURDIR}/unit-tests/Makefile 123 124 | |
125.include <bsd.obj.mk> 126 | 110.include <bsd.obj.mk> 111 |