Home | History | Annotate | Line # | Download | only in tools
Makefile.gmakehost revision 1.2.20.1
      1  1.2.20.1  wrstuden #	$NetBSD: Makefile.gmakehost,v 1.2.20.1 2008/09/18 04:37:35 wrstuden Exp $
      2       1.1       mrg #
      3       1.1       mrg # Rules used when building a GNU host package.  Expects MODULE to be set.
      4       1.1       mrg # This version runs ${TOOL_GMAKE} instead of ${MAKE}
      5       1.1       mrg #
      6       1.1       mrg # There's not a lot we can do to build reliably in the face of many
      7       1.1       mrg # available configuration options.  To be as low-overhead as possible,
      8       1.1       mrg # we follow the following scheme:
      9       1.1       mrg #
     10       1.1       mrg # * Configuration is only re-run when an autoconf source file (such as
     11       1.1       mrg #   "configure" or "config.sub") is changed.
     12       1.1       mrg #
     13       1.1       mrg # * "config.status" is run to rebuild Makefiles and .h files if an
     14       1.1       mrg #   autoconf-parsed file (such as Makefile.in) is changed.
     15       1.1       mrg #
     16       1.1       mrg # * If MKUPDATE != "no", "make install" is only run if a build has happened
     17       1.1       mrg #   since the last install in the current directory.
     18       1.1       mrg 
     19       1.1       mrg .include <bsd.own.mk>
     20       1.1       mrg 
     21       1.1       mrg # Disable use of pre-compiled headers on Darwin.
     22       1.1       mrg BUILD_OSTYPE!=  uname -s
     23       1.1       mrg .if ${BUILD_OSTYPE} == "Darwin"
     24       1.1       mrg HOST_CFLAGS+=-O2 -no-cpp-precomp
     25       1.1       mrg .endif
     26       1.1       mrg 
     27       1.1       mrg GNUHOSTDIST?=	${.CURDIR}/../../gnu/dist/${MODULE}
     28       1.1       mrg 
     29       1.1       mrg FIND_ARGS+=	\! \( -type d \( \
     30       1.1       mrg 			-name 'CVS' -o \
     31       1.1       mrg 			-name 'config' -o \
     32       1.1       mrg 			-name 'doc' -o \
     33       1.1       mrg 			-name 'po' -o \
     34       1.1       mrg 			-name 'nbsd.mt' -o \
     35       1.1       mrg 			-name 'tests*' \
     36       1.1       mrg 		\) -prune \)
     37       1.1       mrg 
     38       1.1       mrg # Do this "find" only if actually building something.
     39       1.1       mrg .if (${USETOOLS} == "yes") && empty(.MAKEFLAGS:M-V*) && \
     40       1.1       mrg     (make(all) || make(realall) || (!make(clean) && !make(cleandir) && !make(obj))) && \
     41       1.1       mrg     !defined(_GNU_CFGSRC)
     42       1.1       mrg 
     43       1.1       mrg _GNU_CFGSRC!=	find ${GNUHOSTDIST} ${FIND_ARGS} \
     44       1.1       mrg 		-type f \( -name 'config*' -o -name '*.in' \) -print
     45       1.1       mrg .MAKEOVERRIDES+= _GNU_CFGSRC
     46       1.1       mrg .endif
     47       1.1       mrg 
     48       1.1       mrg CONFIGURE_ENV+=	CC=${HOST_CC:Q} \
     49       1.1       mrg 		CFLAGS=${HOST_CFLAGS:Q} \
     50       1.1       mrg 		CPPFLAGS=${HOST_CPPFLAGS:Q} \
     51       1.1       mrg 		CXX=${HOST_CXX:Q} \
     52       1.1       mrg 		CXXFLAGS=${HOST_CXXFLAGS:Q} \
     53       1.1       mrg 		INSTALL=${HOST_INSTALL_FILE:Q} \
     54       1.1       mrg 		LDFLAGS=${HOST_LDFLAGS:Q} \
     55       1.1       mrg 		AR=${HOST_AR:Q} \
     56       1.1       mrg 		RANLIB=${HOST_RANLIB:Q} \
     57       1.1       mrg 		LEX=${LEX:Q} \
     58       1.1       mrg 		MAKE=${TOOL_GMAKE:Q} \
     59       1.1       mrg 		PATH="${TOOLDIR}/bin:$$PATH" \
     60       1.1       mrg 		YACC=${YACC:Q}
     61       1.1       mrg 
     62       1.1       mrg BUILD_ENV+=	${CONFIGURE_ENV}
     63       1.1       mrg 
     64       1.1       mrg CONFIGURE_ARGS+=--prefix=${TOOLDIR}
     65       1.1       mrg .if ${MKPIC} == "no"
     66       1.1       mrg CONFIGURE_ARGS+=--disable-shared
     67       1.1       mrg .endif
     68       1.1       mrg 
     69       1.1       mrg # don't need this for gmake? i hope.  might need gmake equiv of -X?
     70       1.1       mrg ##.ifndef _NOWRAPPER
     71       1.1       mrg ### Some systems have a small ARG_MAX.  On such systems, prevent Make
     72       1.1       mrg ### variables set on the command line from being exported in the
     73       1.1       mrg ### environment (they will still be set in MAKEOVERRIDES).
     74       1.1       mrg ##BUILD_OSTYPE!=	uname -s
     75       1.1       mrg ##.if ${BUILD_OSTYPE} == "Darwin" || ${BUILD_OSTYPE} == "FreeBSD"
     76       1.1       mrg ##__noenvexport=	-X
     77       1.1       mrg ##.endif
     78       1.1       mrg ##MAKE_ARGS:=	${__noenvexport} -f ${.PARSEDIR}/Makefile.gnuwrap ${MAKE_ARGS}
     79       1.1       mrg ##.else
     80       1.1       mrg ##MAKE_ARGS+=	_NOWRAPPER=1
     81       1.1       mrg ##.endif
     82       1.1       mrg 
     83       1.1       mrg MAKE_ARGS+=	BISON=true DESTDIR= INSTALL=${HOST_INSTALL_FILE:Q}
     84       1.1       mrg 
     85       1.1       mrg ALL_TARGET?=	all
     86       1.1       mrg INSTALL_TARGET?=install
     87       1.1       mrg 
     88       1.1       mrg .configure_done: ${_GNU_CFGSRC} ${.CURDIR}/Makefile
     89       1.1       mrg 	@mkdir build 2>/dev/null || true
     90       1.1       mrg 	@(cd build && /usr/bin/env ${CONFIGURE_ENV} ${HOST_SH} ${GNUHOSTDIST}/configure ${CONFIGURE_ARGS})
     91       1.1       mrg 	@touch $@
     92       1.1       mrg 
     93       1.1       mrg # The .build_done timestamp is only updated if a file actually changes
     94       1.1       mrg # in the build tree during "make all".  This way, if nothing has changed,
     95       1.1       mrg # a "make install MKUPDATE=yes" will do nothing.
     96       1.1       mrg 
     97       1.1       mrg # gmake version of this puts MAKE_ARGS in the environment to be sure that
     98       1.1       mrg # sub-gmake's get them, otherwise tools/gcc tries to build libgcc and
     99       1.1       mrg # fails.  it also uses "env -i" to entirely clear out MAKEFLAGS.
    100       1.1       mrg 
    101  1.2.20.1  wrstuden GMAKE_J_ARGS?=	${MAKEFLAGS:[*]:M*-j*:C/.*(-j ?[0-9]*).*/\1/W}
    102  1.2.20.1  wrstuden 
    103       1.1       mrg .build_done: .configure_done
    104  1.2.20.1  wrstuden 	@(cd build && /usr/bin/env -i ${BUILD_ENV} ${MAKE_ARGS} ${TOOL_GMAKE} ${GMAKE_J_ARGS} -e ${MAKE_ARGS} ${ALL_TARGET})
    105       1.1       mrg 	@if [ ! -f $@ ] || [ -n "$$(find build -type f -newer .build_done -print)" ]; \
    106       1.1       mrg 		then touch $@; fi
    107       1.1       mrg 
    108       1.1       mrg .install_done! ${BUILD:D.build_done}
    109       1.2       mrg 	@(cd ${.OBJDIR}/build && /usr/bin/env -i ${BUILD_ENV} ${MAKE_ARGS} ${TOOL_GMAKE} -e ${MAKE_ARGS} ${INSTALL_TARGET})
    110       1.1       mrg 	@touch $@
    111       1.1       mrg 
    112       1.1       mrg .PHONY: .build_done .install_done
    113       1.1       mrg 
    114       1.1       mrg # Mapping to standard targets.
    115       1.1       mrg 
    116       1.1       mrg .if ${USETOOLS} == "yes"
    117       1.1       mrg realall: .build_done
    118       1.1       mrg realinstall: .install_done
    119       1.1       mrg .endif
    120       1.1       mrg 
    121       1.1       mrg clean: clean.gnu
    122       1.1       mrg clean.gnu:
    123       1.1       mrg 	-rm -r -f .*_done build
    124       1.1       mrg 
    125       1.1       mrg .include <bsd.hostprog.mk>
    126