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