Makefile.gnuhost revision 1.1
1# $NetBSD: Makefile.gnuhost,v 1.1 2001/11/12 23:16:23 tv Exp $ 2# 3# Rules used when building a GNU host package. Expects MODULE to be set. 4# 5# There's not a lot we can do to build reliably in the face of many 6# available configuration options. To be as low-overhead as possible, 7# we follow the following scheme: 8# 9# * Configuration is only re-run when an autoconf source file (such as 10# "configure" or "config.sub") is changed. 11# 12# * "config.status" is run to rebuild Makefiles and .h files if an 13# autoconf-parsed file (such as Makefile.in) is changed. 14# 15# * If UPDATE is set, "make install" is only run if a build has happened 16# since the last install in the current directory. 17 18.include <bsd.own.mk> 19 20.MAKEFLAGS: -j1 21 22DIST= ${.CURDIR}/../../gnu/dist/${MODULE} 23WRAPPER:= ${.PARSEDIR}/Makefile.gnuwrap 24 25FIND_ARGS+= \! \( -type d \( \ 26 -name 'CVS' -o \ 27 -name 'config' -o \ 28 -name 'doc' -o \ 29 -name 'po' -o \ 30 -name 'tests*' \ 31 \) -prune \) 32 33# Do this "find" only if actually building something. 34.if (${USETOOLS} == "yes") && empty(.MAKEFLAGS:M-V*) && \ 35 (make(all) || make(realall) || (!make(clean) && !make(cleandir) && !make(obj))) && \ 36 !defined(_GNU_CFGSRC) 37 38_GNU_CFGSRC!= find ${DIST} ${FIND_ARGS} \ 39 -type f \( -name 'config*' -o -name '*.in' \) -print 40.MAKEOVERRIDES+= _GNU_CFGSRC 41.endif 42 43CONFIGURE_ENV+= CC=${HOST_CC:Q} \ 44 CFLAGS=${HOST_CFLAGS:Q} \ 45 CPPFLAGS=${HOST_CPPFLAGS:Q} \ 46 CXX=${HOST_CXX:Q} \ 47 CXXFLAGS=${HOST_CXXFLAGS:Q} \ 48 INSTALL=${INSTALL:Q} \ 49 LDFLAGS=${HOST_LDFLAGS:Q} \ 50 PATH="${TOOLDIR}/bin:$$PATH" 51 52CONFIGURE_ARGS+=--prefix=${TOOLDIR} --disable-shared 53 54MAKE_ARGS+= LEX=true BISON=true DESTDIR= INSTALL="${INSTALL_FILE}" 55 56ALL_TARGET?= all 57INSTALL_TARGET?=install 58 59.configure_done: ${_GNU_CFGSRC} 60 @mkdir build 2>/dev/null || true 61 @echo ${?:T} 62 @(cd build && ${CONFIGURE_ENV} ${DIST}/configure ${CONFIGURE_ARGS}) 63 @touch $@ 64 65.build_done: .configure_done 66 @(cd build && ${MAKE} -f ${WRAPPER} ${ALL_TARGET}) 67 @touch $@ 68 69.install_done: 70.if defined(UPDATE) 71 @if [ ! -f .install_done ] || [ .build_done -nt .install_done ]; then \ 72 (cd build && ${MAKE} -f ${WRAPPER} ${MAKE_ARGS} ${INSTALL_TARGET}); \ 73 fi 74.else 75 @(cd build && ${MAKE} -f ${WRAPPER} ${MAKE_ARGS} ${INSTALL_TARGET}) 76.endif 77 @touch $@ 78 79.PHONY: .build_done .install_done 80.ORDER: .build_done .install_done 81 82# Mapping to standard targets. 83 84.if ${USETOOLS} == "yes" 85realall: .build_done 86realinstall: .install_done 87.endif 88 89clean: clean.gnu 90clean.gnu: 91 -rm -r -f .*_done build 92 93.include <bsd.hostprog.mk> 94