Makefile.gnuhost revision 1.30
11.30Sskrll# $NetBSD: Makefile.gnuhost,v 1.30 2004/10/18 08:33:48 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.30Sskrll AR=${HOST_AR:Q} \ 551.30Sskrll RANLIB=${HOST_RANLIB:Q} \ 561.14Stv LEX=${LEX:Q} \ 571.28Sjmc MAKE=${MAKE:Q} \ 581.14Stv PATH="${TOOLDIR}/bin:$$PATH" \ 591.14Stv YACC=${YACC:Q} 601.1Stv 611.25SskrllCONFIGURE_ARGS+=--prefix=${TOOLDIR} 621.26Sskrll.if ${MKPIC} == "no" 631.26SskrllCONFIGURE_ARGS+=--disable-shared 641.26Sskrll.endif 651.1Stv 661.2Stv.ifndef _NOWRAPPER 671.18Sthorpej# Some systems have a small ARG_MAX. On such systems, prevent Make 681.18Sthorpej# variables set on the command line from being exported in the 691.18Sthorpej# environment (they will still be set in MAKEOVERRIDES). 701.18SthorpejBUILD_OSTYPE!= uname -s 711.18Sthorpej.if ${BUILD_OSTYPE} == "Darwin" || ${BUILD_OSTYPE} == "FreeBSD" 721.18Sthorpej__noenvexport= -X 731.18Sthorpej.endif 741.18SthorpejMAKE_ARGS:= ${__noenvexport} -f ${.PARSEDIR}/Makefile.gnuwrap ${MAKE_ARGS} 751.2Stv.else 761.2StvMAKE_ARGS+= _NOWRAPPER=1 771.2Stv.endif 781.3Stv 791.15StvMAKE_ARGS+= BISON=true DESTDIR= INSTALL=${HOST_INSTALL_FILE:Q} 801.2Stv 811.1StvALL_TARGET?= all 821.1StvINSTALL_TARGET?=install 831.1Stv 841.7Stv.configure_done: ${_GNU_CFGSRC} ${.CURDIR}/Makefile 851.1Stv @mkdir build 2>/dev/null || true 861.24Slukem @(cd build && ${CONFIGURE_ENV} ${HOST_SH} ${GNUHOSTDIST}/configure ${CONFIGURE_ARGS}) 871.1Stv @touch $@ 881.1Stv 891.12Stv# The .build_done timestamp is only updated if a file actually changes 901.12Stv# in the build tree during "make all". This way, if nothing has changed, 911.19Slukem# a "make install MKUPDATE=yes" will do nothing. 921.12Stv 931.1Stv.build_done: .configure_done 941.2Stv @(cd build && ${MAKE} ${MAKE_ARGS} ${ALL_TARGET}) 951.15Stv @if [ ! -f $@ ] || [ -n "$$(find build -type f -newer .build_done -print)" ]; \ 961.13Stv then touch $@; fi 971.1Stv 981.27Sjmc.install_done! ${BUILD:D.build_done} 991.8Stv @(cd ${.OBJDIR}/build && ${MAKE} ${MAKE_ARGS} ${INSTALL_TARGET}) 1001.1Stv @touch $@ 1011.12Stv 1021.15Stv.PHONY: .build_done .install_done 1031.1Stv 1041.1Stv# Mapping to standard targets. 1051.1Stv 1061.1Stv.if ${USETOOLS} == "yes" 1071.1Stvrealall: .build_done 1081.1Stvrealinstall: .install_done 1091.1Stv.endif 1101.1Stv 1111.1Stvclean: clean.gnu 1121.1Stvclean.gnu: 1131.29Sjmc -rm -r -f .*_done build 1141.1Stv 1151.1Stv.include <bsd.hostprog.mk> 116