Makefile.gnuhost revision 1.26
11.26Sskrll# $NetBSD: Makefile.gnuhost,v 1.26 2004/02/27 14:52:01 skrll Exp $ 21.1Stv# 31.1Stv# Rules used when building a GNU host package. Expects MODULE to be set. 41.1Stv# 51.1Stv# There's not a lot we can do to build reliably in the face of many 61.1Stv# available configuration options. To be as low-overhead as possible, 71.1Stv# we follow the following scheme: 81.1Stv# 91.1Stv# * Configuration is only re-run when an autoconf source file (such as 101.1Stv# "configure" or "config.sub") is changed. 111.1Stv# 121.1Stv# * "config.status" is run to rebuild Makefiles and .h files if an 131.1Stv# autoconf-parsed file (such as Makefile.in) is changed. 141.1Stv# 151.19Slukem# * If MKUPDATE != "no", "make install" is only run if a build has happened 161.1Stv# since the last install in the current directory. 171.1Stv 181.1Stv.include <bsd.own.mk> 191.20Sdbj 201.20Sdbj# Disable use of pre-compiled headers on Darwin. 211.20SdbjBUILD_OSTYPE!= uname -s 221.20Sdbj.if ${BUILD_OSTYPE} == "Darwin" 231.21SdbjHOST_CFLAGS+=-O2 -no-cpp-precomp 241.20Sdbj.endif 251.1Stv 261.17SlukemGNUHOSTDIST?= ${.CURDIR}/../../gnu/dist/${MODULE} 271.1Stv 281.1StvFIND_ARGS+= \! \( -type d \( \ 291.1Stv -name 'CVS' -o \ 301.1Stv -name 'config' -o \ 311.1Stv -name 'doc' -o \ 321.1Stv -name 'po' -o \ 331.8Stv -name 'nbsd.mt' -o \ 341.1Stv -name 'tests*' \ 351.1Stv \) -prune \) 361.1Stv 371.1Stv# Do this "find" only if actually building something. 381.1Stv.if (${USETOOLS} == "yes") && empty(.MAKEFLAGS:M-V*) && \ 391.1Stv (make(all) || make(realall) || (!make(clean) && !make(cleandir) && !make(obj))) && \ 401.1Stv !defined(_GNU_CFGSRC) 411.1Stv 421.17Slukem_GNU_CFGSRC!= find ${GNUHOSTDIST} ${FIND_ARGS} \ 431.1Stv -type f \( -name 'config*' -o -name '*.in' \) -print 441.1Stv.MAKEOVERRIDES+= _GNU_CFGSRC 451.1Stv.endif 461.1Stv 471.1StvCONFIGURE_ENV+= CC=${HOST_CC:Q} \ 481.1Stv CFLAGS=${HOST_CFLAGS:Q} \ 491.1Stv CPPFLAGS=${HOST_CPPFLAGS:Q} \ 501.1Stv CXX=${HOST_CXX:Q} \ 511.1Stv CXXFLAGS=${HOST_CXXFLAGS:Q} \ 521.9Sperry INSTALL=${HOST_INSTALL_FILE:Q} \ 531.1Stv LDFLAGS=${HOST_LDFLAGS:Q} \ 541.14Stv LEX=${LEX:Q} \ 551.14Stv PATH="${TOOLDIR}/bin:$$PATH" \ 561.14Stv YACC=${YACC:Q} 571.1Stv 581.25SskrllCONFIGURE_ARGS+=--prefix=${TOOLDIR} 591.26Sskrll.if ${MKPIC} == "no" 601.26SskrllCONFIGURE_ARGS+=--disable-shared 611.26Sskrll.endif 621.1Stv 631.2Stv.ifndef _NOWRAPPER 641.18Sthorpej# Some systems have a small ARG_MAX. On such systems, prevent Make 651.18Sthorpej# variables set on the command line from being exported in the 661.18Sthorpej# environment (they will still be set in MAKEOVERRIDES). 671.18SthorpejBUILD_OSTYPE!= uname -s 681.18Sthorpej.if ${BUILD_OSTYPE} == "Darwin" || ${BUILD_OSTYPE} == "FreeBSD" 691.18Sthorpej__noenvexport= -X 701.18Sthorpej.endif 711.18SthorpejMAKE_ARGS:= ${__noenvexport} -f ${.PARSEDIR}/Makefile.gnuwrap ${MAKE_ARGS} 721.2Stv.else 731.2StvMAKE_ARGS+= _NOWRAPPER=1 741.2Stv.endif 751.3Stv 761.15StvMAKE_ARGS+= BISON=true DESTDIR= INSTALL=${HOST_INSTALL_FILE:Q} 771.2Stv 781.1StvALL_TARGET?= all 791.1StvINSTALL_TARGET?=install 801.1Stv 811.7Stv.configure_done: ${_GNU_CFGSRC} ${.CURDIR}/Makefile 821.1Stv @mkdir build 2>/dev/null || true 831.24Slukem @(cd build && ${CONFIGURE_ENV} ${HOST_SH} ${GNUHOSTDIST}/configure ${CONFIGURE_ARGS}) 841.1Stv @touch $@ 851.1Stv 861.12Stv# The .build_done timestamp is only updated if a file actually changes 871.12Stv# in the build tree during "make all". This way, if nothing has changed, 881.19Slukem# a "make install MKUPDATE=yes" will do nothing. 891.12Stv 901.1Stv.build_done: .configure_done 911.2Stv @(cd build && ${MAKE} ${MAKE_ARGS} ${ALL_TARGET}) 921.15Stv @if [ ! -f $@ ] || [ -n "$$(find build -type f -newer .build_done -print)" ]; \ 931.13Stv then touch $@; fi 941.1Stv 951.12Stv.install_done: ${BUILD:D.build_done} 961.19Slukem.if ${MKUPDATE} != "no" 971.15Stv @cd ${.OBJDIR}; \ 981.15Stv if [ ! -f .install_done ] || [ ! -f .build_done ] || \ 991.15Stv [ -n "$$(find .build_done -prune -newer .install_done -print)" ]; then \ 1001.15Stv (cd build && ${MAKE} ${MAKE_ARGS} ${INSTALL_TARGET}); \ 1011.1Stv fi 1021.1Stv.else 1031.8Stv @(cd ${.OBJDIR}/build && ${MAKE} ${MAKE_ARGS} ${INSTALL_TARGET}) 1041.1Stv.endif 1051.1Stv @touch $@ 1061.12Stv 1071.15Stv.PHONY: .build_done .install_done 1081.1Stv 1091.1Stv# Mapping to standard targets. 1101.1Stv 1111.1Stv.if ${USETOOLS} == "yes" 1121.1Stvrealall: .build_done 1131.1Stvrealinstall: .install_done 1141.1Stv.endif 1151.1Stv 1161.1Stvclean: clean.gnu 1171.1Stvclean.gnu: 1181.22Slukem rm -r -f .*_done build 1191.1Stv 1201.1Stv.include <bsd.hostprog.mk> 121