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