Deleted Added
full compact
bsd.after-import.mk (236769) bsd.after-import.mk (237578)
1# $Id: bsd.after-import.mk,v 1.3 2012/06/06 17:48:14 sjg Exp $
1# $Id: bsd.after-import.mk,v 1.5 2012/06/20 22:45:07 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
12all: ${.CURDIR}/Makefile
13all: after-import
14
15# we rely on bmake
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: ${.CURDIR}/Makefile
13all: after-import
14
15# we rely on bmake
16.if !defined(.MAKE.LEVEL)
17.error this makefile requires bmake
18.endif
19
16_this := ${MAKEFILE:tA}
17BMAKE_SRC := ${.PARSEDIR}
18
19# it helps to know where the top of the tree is.
20.if !defined(SRCTOP)
21srctop := ${.MAKE.MAKEFILES:M*src/share/mk/sys.mk:H:H:H}
20_this := ${MAKEFILE:tA}
21BMAKE_SRC := ${.PARSEDIR}
22
23# it helps to know where the top of the tree is.
24.if !defined(SRCTOP)
25srctop := ${.MAKE.MAKEFILES:M*src/share/mk/sys.mk:H:H:H}
26.if empty(srctop)
27# likely locations?
28.for d in contrib/bmake external/bsd/bmake/dist
29.if ${BMAKE_SRC:M*/$d} != ""
30srctop := ${BMAKE_SRC:tA:S,/$d,,}
31.endif
32.endfor
33.endif
22.if !empty(srctop)
23SRCTOP := ${srctop}
24.endif
25.endif
26
27# This lets us match what boot-strap does
28.if !defined(HOST_OS)
29HOST_OS!= uname

--- 12 unchanged lines hidden (view full) ---

42# run boot-strap with minimal influence
43bootstrap: ${BMAKE_SRC}/boot-strap ${MAKEFILE}
44 HOME=/ ${BMAKE_SRC}/boot-strap ${BOOTSTRAP_ARGS} ${BOOTSTRAP_XTRAS}
45 touch ${.TARGET}
46
47# Makefiles need a little more tweaking than say config.h
48MAKEFILE_SED = sed -e '/^MACHINE/d' \
49 -e '/^PROG/s,bmake,${.CURDIR:T},' \
34.if !empty(srctop)
35SRCTOP := ${srctop}
36.endif
37.endif
38
39# This lets us match what boot-strap does
40.if !defined(HOST_OS)
41HOST_OS!= uname

--- 12 unchanged lines hidden (view full) ---

54# run boot-strap with minimal influence
55bootstrap: ${BMAKE_SRC}/boot-strap ${MAKEFILE}
56 HOME=/ ${BMAKE_SRC}/boot-strap ${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' \
61 -e '/^PROG/s,bmake,${.CURDIR:T},' \
62 -e 's,^.-include,.sinclude,' \
50 -e 's,${SRCTOP},$${SRCTOP},g'
51
52# These are the simple files we want to capture
53configured_files= config.h unit-tests/Makefile
54
55after-import: bootstrap ${MAKEFILE}
56.for f in ${configured_files:N*Makefile}
57 @echo Capturing $f
63 -e 's,${SRCTOP},$${SRCTOP},g'
64
65# These are the simple files we want to capture
66configured_files= config.h unit-tests/Makefile
67
68after-import: bootstrap ${MAKEFILE}
69.for f in ${configured_files:N*Makefile}
70 @echo Capturing $f
71 @mkdir -p ${${.CURDIR}/$f:L:H}
58 @cmp -s ${.CURDIR}/$f ${HOST_OS}/$f || \
59 cp ${HOST_OS}/$f ${.CURDIR}/$f
60.endfor
61.for f in ${configured_files:M*Makefile}
62 @echo Capturing $f
72 @cmp -s ${.CURDIR}/$f ${HOST_OS}/$f || \
73 cp ${HOST_OS}/$f ${.CURDIR}/$f
74.endfor
75.for f in ${configured_files:M*Makefile}
76 @echo Capturing $f
77 @mkdir -p ${${.CURDIR}/$f:L:H}
63 @${MAKEFILE_SED} ${HOST_OS}/$f > ${.CURDIR}/$f
64.endfor
65
66# this needs the most work
67${.CURDIR}/Makefile: bootstrap ${MAKEFILE} .PRECIOUS
68 @echo Generating ${.TARGET:T}
69 @(echo '# This is a generated file, do NOT edit!'; \
70 echo '# See ${_this:S,${SRCTOP}/,,}'; \
78 @${MAKEFILE_SED} ${HOST_OS}/$f > ${.CURDIR}/$f
79.endfor
80
81# this needs the most work
82${.CURDIR}/Makefile: bootstrap ${MAKEFILE} .PRECIOUS
83 @echo Generating ${.TARGET:T}
84 @(echo '# This is a generated file, do NOT edit!'; \
85 echo '# See ${_this:S,${SRCTOP}/,,}'; \
86 echo '#'; echo '# $$${OS}$$'; echo; \
87 echo 'SRCTOP?= $${.CURDIR:${.CURDIR:S,${SRCTOP}/,,:C,[^/]+,H,g:S,/,:,g}}'; echo; \
71 echo; echo '# look here first for config.h'; \
72 echo 'CFLAGS+= -I$${.CURDIR}'; echo; \
73 ${MAKEFILE_SED} ${HOST_OS}/Makefile; \
74 echo; echo '# override some simple things'; \
75 echo 'BINDIR= /usr/bin'; \
76 echo 'MANDIR= /usr/share/man'; \
77 echo; echo '# make sure we get this'; \
78 echo 'CFLAGS+= $${COPTS.$${.IMPSRC:T}}'; \
79 echo 'CLEANFILES+= bootstrap'; \
80 echo; echo 'after-import: ${_this:S,${SRCTOP},\${SRCTOP},}'; \
81 echo ' cd $${.CURDIR} && $${.MAKE} -f ${_this:S,${SRCTOP},\${SRCTOP},}'; \
88 echo; echo '# look here first for config.h'; \
89 echo 'CFLAGS+= -I$${.CURDIR}'; echo; \
90 ${MAKEFILE_SED} ${HOST_OS}/Makefile; \
91 echo; echo '# override some simple things'; \
92 echo 'BINDIR= /usr/bin'; \
93 echo 'MANDIR= /usr/share/man'; \
94 echo; echo '# make sure we get this'; \
95 echo 'CFLAGS+= $${COPTS.$${.IMPSRC:T}}'; \
96 echo 'CLEANFILES+= bootstrap'; \
97 echo; echo 'after-import: ${_this:S,${SRCTOP},\${SRCTOP},}'; \
98 echo ' cd $${.CURDIR} && $${.MAKE} -f ${_this:S,${SRCTOP},\${SRCTOP},}'; \
82 echo; echo '.-include "Makefile.inc"'; \
99 echo; echo '.sinclude "Makefile.inc"'; \
83 echo ) > ${.TARGET:T}.new
84 @mv ${.TARGET:T}.new ${.TARGET}
85
86.include <bsd.obj.mk>
87
100 echo ) > ${.TARGET:T}.new
101 @mv ${.TARGET:T}.new ${.TARGET}
102
103.include <bsd.obj.mk>
104