Makefile.gmakehost revision 1.1
11.1Smrg# $NetBSD: Makefile.gmakehost,v 1.1 2006/05/11 01:17:53 mrg Exp $ 21.1Smrg# 31.1Smrg# Rules used when building a GNU host package. Expects MODULE to be set. 41.1Smrg# This version runs ${TOOL_GMAKE} instead of ${MAKE} 51.1Smrg# 61.1Smrg# There's not a lot we can do to build reliably in the face of many 71.1Smrg# available configuration options. To be as low-overhead as possible, 81.1Smrg# we follow the following scheme: 91.1Smrg# 101.1Smrg# * Configuration is only re-run when an autoconf source file (such as 111.1Smrg# "configure" or "config.sub") is changed. 121.1Smrg# 131.1Smrg# * "config.status" is run to rebuild Makefiles and .h files if an 141.1Smrg# autoconf-parsed file (such as Makefile.in) is changed. 151.1Smrg# 161.1Smrg# * If MKUPDATE != "no", "make install" is only run if a build has happened 171.1Smrg# since the last install in the current directory. 181.1Smrg 191.1Smrg.include <bsd.own.mk> 201.1Smrg 211.1Smrg# Disable use of pre-compiled headers on Darwin. 221.1SmrgBUILD_OSTYPE!= uname -s 231.1Smrg.if ${BUILD_OSTYPE} == "Darwin" 241.1SmrgHOST_CFLAGS+=-O2 -no-cpp-precomp 251.1Smrg.endif 261.1Smrg 271.1SmrgGNUHOSTDIST?= ${.CURDIR}/../../gnu/dist/${MODULE} 281.1Smrg 291.1SmrgFIND_ARGS+= \! \( -type d \( \ 301.1Smrg -name 'CVS' -o \ 311.1Smrg -name 'config' -o \ 321.1Smrg -name 'doc' -o \ 331.1Smrg -name 'po' -o \ 341.1Smrg -name 'nbsd.mt' -o \ 351.1Smrg -name 'tests*' \ 361.1Smrg \) -prune \) 371.1Smrg 381.1Smrg# Do this "find" only if actually building something. 391.1Smrg.if (${USETOOLS} == "yes") && empty(.MAKEFLAGS:M-V*) && \ 401.1Smrg (make(all) || make(realall) || (!make(clean) && !make(cleandir) && !make(obj))) && \ 411.1Smrg !defined(_GNU_CFGSRC) 421.1Smrg 431.1Smrg_GNU_CFGSRC!= find ${GNUHOSTDIST} ${FIND_ARGS} \ 441.1Smrg -type f \( -name 'config*' -o -name '*.in' \) -print 451.1Smrg.MAKEOVERRIDES+= _GNU_CFGSRC 461.1Smrg.endif 471.1Smrg 481.1SmrgCONFIGURE_ENV+= CC=${HOST_CC:Q} \ 491.1Smrg CFLAGS=${HOST_CFLAGS:Q} \ 501.1Smrg CPPFLAGS=${HOST_CPPFLAGS:Q} \ 511.1Smrg CXX=${HOST_CXX:Q} \ 521.1Smrg CXXFLAGS=${HOST_CXXFLAGS:Q} \ 531.1Smrg INSTALL=${HOST_INSTALL_FILE:Q} \ 541.1Smrg LDFLAGS=${HOST_LDFLAGS:Q} \ 551.1Smrg AR=${HOST_AR:Q} \ 561.1Smrg RANLIB=${HOST_RANLIB:Q} \ 571.1Smrg LEX=${LEX:Q} \ 581.1Smrg MAKE=${TOOL_GMAKE:Q} \ 591.1Smrg PATH="${TOOLDIR}/bin:$$PATH" \ 601.1Smrg YACC=${YACC:Q} 611.1Smrg 621.1SmrgBUILD_ENV+= ${CONFIGURE_ENV} 631.1Smrg 641.1SmrgCONFIGURE_ARGS+=--prefix=${TOOLDIR} 651.1Smrg.if ${MKPIC} == "no" 661.1SmrgCONFIGURE_ARGS+=--disable-shared 671.1Smrg.endif 681.1Smrg 691.1Smrg# don't need this for gmake? i hope. might need gmake equiv of -X? 701.1Smrg##.ifndef _NOWRAPPER 711.1Smrg### Some systems have a small ARG_MAX. On such systems, prevent Make 721.1Smrg### variables set on the command line from being exported in the 731.1Smrg### environment (they will still be set in MAKEOVERRIDES). 741.1Smrg##BUILD_OSTYPE!= uname -s 751.1Smrg##.if ${BUILD_OSTYPE} == "Darwin" || ${BUILD_OSTYPE} == "FreeBSD" 761.1Smrg##__noenvexport= -X 771.1Smrg##.endif 781.1Smrg##MAKE_ARGS:= ${__noenvexport} -f ${.PARSEDIR}/Makefile.gnuwrap ${MAKE_ARGS} 791.1Smrg##.else 801.1Smrg##MAKE_ARGS+= _NOWRAPPER=1 811.1Smrg##.endif 821.1Smrg 831.1SmrgMAKE_ARGS+= BISON=true DESTDIR= INSTALL=${HOST_INSTALL_FILE:Q} 841.1Smrg 851.1SmrgALL_TARGET?= all 861.1SmrgINSTALL_TARGET?=install 871.1Smrg 881.1Smrg.configure_done: ${_GNU_CFGSRC} ${.CURDIR}/Makefile 891.1Smrg @mkdir build 2>/dev/null || true 901.1Smrg @(cd build && /usr/bin/env ${CONFIGURE_ENV} ${HOST_SH} ${GNUHOSTDIST}/configure ${CONFIGURE_ARGS}) 911.1Smrg @touch $@ 921.1Smrg 931.1Smrg# The .build_done timestamp is only updated if a file actually changes 941.1Smrg# in the build tree during "make all". This way, if nothing has changed, 951.1Smrg# a "make install MKUPDATE=yes" will do nothing. 961.1Smrg 971.1Smrg# gmake version of this puts MAKE_ARGS in the environment to be sure that 981.1Smrg# sub-gmake's get them, otherwise tools/gcc tries to build libgcc and 991.1Smrg# fails. it also uses "env -i" to entirely clear out MAKEFLAGS. 1001.1Smrg 1011.1Smrg.build_done: .configure_done 1021.1Smrg @(cd build && /usr/bin/env -i ${BUILD_ENV} ${MAKE_ARGS} ${TOOL_GMAKE} -e ${ALL_TARGET}) 1031.1Smrg @if [ ! -f $@ ] || [ -n "$$(find build -type f -newer .build_done -print)" ]; \ 1041.1Smrg then touch $@; fi 1051.1Smrg 1061.1Smrg.install_done! ${BUILD:D.build_done} 1071.1Smrg @(cd ${.OBJDIR}/build && /usr/bin/env -i ${BUILD_ENV} ${MAKE_ARGS} ${TOOL_GMAKE} -e ${INSTALL_TARGET}) 1081.1Smrg @touch $@ 1091.1Smrg 1101.1Smrg.PHONY: .build_done .install_done 1111.1Smrg 1121.1Smrg# Mapping to standard targets. 1131.1Smrg 1141.1Smrg.if ${USETOOLS} == "yes" 1151.1Smrgrealall: .build_done 1161.1Smrgrealinstall: .install_done 1171.1Smrg.endif 1181.1Smrg 1191.1Smrgclean: clean.gnu 1201.1Smrgclean.gnu: 1211.1Smrg -rm -r -f .*_done build 1221.1Smrg 1231.1Smrg.include <bsd.hostprog.mk> 124