Makefile.gnuhost revision 1.3
1# $NetBSD: Makefile.gnuhost,v 1.3 2001/11/13 04:43:25 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} 23 24FIND_ARGS+= \! \( -type d \( \ 25 -name 'CVS' -o \ 26 -name 'config' -o \ 27 -name 'doc' -o \ 28 -name 'po' -o \ 29 -name 'tests*' \ 30 \) -prune \) 31 32# Do this "find" only if actually building something. 33.if (${USETOOLS} == "yes") && empty(.MAKEFLAGS:M-V*) && \ 34 (make(all) || make(realall) || (!make(clean) && !make(cleandir) && !make(obj))) && \ 35 !defined(_GNU_CFGSRC) 36 37_GNU_CFGSRC!= find ${DIST} ${FIND_ARGS} \ 38 -type f \( -name 'config*' -o -name '*.in' \) -print 39.MAKEOVERRIDES+= _GNU_CFGSRC 40.endif 41 42CONFIGURE_ENV+= CC=${HOST_CC:Q} \ 43 CFLAGS=${HOST_CFLAGS:Q} \ 44 CPPFLAGS=${HOST_CPPFLAGS:Q} \ 45 CXX=${HOST_CXX:Q} \ 46 CXXFLAGS=${HOST_CXXFLAGS:Q} \ 47 INSTALL=${INSTALL:Q} \ 48 LDFLAGS=${HOST_LDFLAGS:Q} \ 49 PATH="${TOOLDIR}/bin:$$PATH" 50 51CONFIGURE_ARGS+=--prefix=${TOOLDIR} --disable-shared 52 53.ifndef _NOWRAPPER 54MAKE_ARGS:= -f ${.PARSEDIR}/Makefile.gnuwrap ${MAKE_ARGS} 55.else 56MAKE_ARGS+= _NOWRAPPER=1 57.endif 58 59MAKE_ARGS+= LEX=true BISON=true DESTDIR= INSTALL="${INSTALL_FILE}" 60 61ALL_TARGET?= all 62INSTALL_TARGET?=install 63 64.configure_done: ${_GNU_CFGSRC} 65 @mkdir build 2>/dev/null || true 66 @echo ${?:T} 67 @(cd build && ${CONFIGURE_ENV} ${DIST}/configure ${CONFIGURE_ARGS}) 68 @touch $@ 69 70.build_done: .configure_done 71 @(cd build && ${MAKE} ${MAKE_ARGS} ${ALL_TARGET}) 72 @touch $@ 73 74.install_done: 75.if defined(UPDATE) 76 @if [ ! -f .install_done ] || [ .build_done -nt .install_done ]; then \ 77 (cd build && ${MAKE} ${MAKE_ARGS} ${INSTALL_TARGET}); \ 78 fi 79.else 80 @(cd build && ${MAKE} ${MAKE_ARGS} ${INSTALL_TARGET}) 81.endif 82 @touch $@ 83 84.PHONY: .build_done .install_done 85.ORDER: .build_done .install_done 86 87# Mapping to standard targets. 88 89.if ${USETOOLS} == "yes" 90realall: .build_done 91realinstall: .install_done 92.endif 93 94clean: clean.gnu 95clean.gnu: 96 -rm -r -f .*_done build 97 98.include <bsd.hostprog.mk> 99