Upgrading build system to new NetBSD revision
The tested targets are the followgin ones:
* tools
* distribution
* sets
* release
The remaining NetBSD targets have not been disabled nor tested
*at all*. Try them at your own risk, they may reboot the earth.
For all compliant Makefiles, objects and generated files are put in
MAKEOBJDIR, which means you can now keep objects between two branch
switching. Same for DESTDIR, please refer to build.sh options.
Regarding new or modifications of Makefiles a few things:
* Read share/mk/bsd.README
* If you add a subdirectory, add a Makefile in it, and have it called
by the parent through the SUBDIR variable.
* Do not add arbitrary inclusion which crosses to another branch of
the hierarchy; If you can't do without it, put a comment on why.
If possible, do not use inclusion at all.
* Use as much as possible the infrastructure, it is here to make
life easier, do not fight it.
Sets and package are now used to track files.
We have one set called "minix", composed of one package called "minix-sys"
2012-09-12 09:37:05 +02:00
|
|
|
# $NetBSD: Makefile.gnuhost,v 1.39 2012/06/19 21:48:33 hans Exp $
|
2012-06-06 16:46:00 +02:00
|
|
|
#
|
|
|
|
# Rules used when building a GNU host package. Expects MODULE to be set.
|
|
|
|
#
|
|
|
|
# There's not a lot we can do to build reliably in the face of many
|
|
|
|
# available configuration options. To be as low-overhead as possible,
|
|
|
|
# we follow the following scheme:
|
|
|
|
#
|
|
|
|
# * Configuration is only re-run when an autoconf source file (such as
|
|
|
|
# "configure" or "config.sub") is changed.
|
|
|
|
#
|
|
|
|
# * "config.status" is run to rebuild Makefiles and .h files if an
|
|
|
|
# autoconf-parsed file (such as Makefile.in) is changed.
|
|
|
|
#
|
|
|
|
# * If MKUPDATE != "no", "make install" is only run if a build has happened
|
|
|
|
# since the last install in the current directory.
|
|
|
|
|
|
|
|
.include <bsd.own.mk>
|
|
|
|
|
|
|
|
# Disable use of pre-compiled headers on Darwin.
|
|
|
|
BUILD_OSTYPE!= uname -s
|
|
|
|
.if ${BUILD_OSTYPE} == "Darwin"
|
|
|
|
HOST_CFLAGS+=-O2 -no-cpp-precomp
|
|
|
|
.endif
|
|
|
|
MAKE_PROGRAM?= ${MAKE}
|
|
|
|
|
2013-01-21 15:30:17 +01:00
|
|
|
GNUHOSTDIST?= ${.CURDIR}/../../gnu/dist/${MODULE}
|
|
|
|
|
|
|
|
# AL - MINIX /usr/src does not have the sources for the GNU utilities
|
|
|
|
# in-tree (they are much bigger than Minix itself!) So to successfully
|
|
|
|
# use them while cross-compiling, we have to fetch them. The success of
|
|
|
|
# that operation is indicated by the presence of a .gitignore file in
|
|
|
|
# the corresponding ${.CURDIR}, which also conveniently hides from git.
|
|
|
|
.if exists(${GNUHOSTDIST:H}/fetch.sh)
|
|
|
|
${GNUHOSTDIST:H}/.gitignore: ${GNUHOSTDIST:H}/fetch.sh
|
|
|
|
${HOST_SH} ${GNUHOSTDIST:H}/fetch.sh
|
|
|
|
@test -e ${GNUHOSTDIST}/configure
|
2013-04-10 18:13:48 +02:00
|
|
|
@echo "${MODULE:U${.CURDIR:T}:C,gcc[0-9]*,gcc,}-*.tar.*z*" >> $@
|
2013-01-21 15:30:17 +01:00
|
|
|
@echo ${GNUHOSTDIST:T} >> $@
|
|
|
|
_gnu_get_src=${GNUHOSTDIST:H}/.gitignore
|
|
|
|
.endif # exists(GNUHOSTDIST:H/fetch.sh) on MINIX
|
2012-06-06 16:46:00 +02:00
|
|
|
|
|
|
|
FIND_ARGS+= \! \( -type d \( \
|
|
|
|
-name 'CVS' -o \
|
|
|
|
-name 'config' -o \
|
|
|
|
-name 'doc' -o \
|
|
|
|
-name 'po' -o \
|
|
|
|
-name 'nbsd.mt' -o \
|
|
|
|
-name 'tests*' \
|
|
|
|
\) -prune \)
|
2012-10-26 15:22:39 +02:00
|
|
|
|
2012-06-06 16:46:00 +02:00
|
|
|
# Do this "find" only if actually building something.
|
2013-01-21 15:30:17 +01:00
|
|
|
# AL - ... and on MINIX, if the source has already being fetched
|
2012-06-06 16:46:00 +02:00
|
|
|
.if (${USETOOLS} == "yes") && empty(.MAKEFLAGS:M-V*) && \
|
|
|
|
(make(all) || make(realall) || (!make(clean) && !make(cleandir) && !make(obj))) && \
|
2013-01-21 15:30:17 +01:00
|
|
|
!defined(_GNU_CFGSRC) && exists(${GNUHOSTDIST}/configure)
|
2012-06-06 16:46:00 +02:00
|
|
|
|
|
|
|
_GNU_CFGSRC!= find ${GNUHOSTDIST} ${FIND_ARGS} \
|
|
|
|
-type f \( -name 'config*' -o -name '*.in' \) -print
|
|
|
|
.MAKEOVERRIDES+= _GNU_CFGSRC
|
|
|
|
.endif
|
|
|
|
|
|
|
|
CONFIGURE_ENV+= \
|
|
|
|
AR=${HOST_AR:Q} \
|
|
|
|
AWK=${TOOL_AWK:Q} \
|
|
|
|
CC=${HOST_CC:Q} \
|
|
|
|
CFLAGS=${HOST_CFLAGS:Q} \
|
|
|
|
CPPFLAGS=${HOST_CPPFLAGS:Q} \
|
|
|
|
CXX=${HOST_CXX:Q} \
|
|
|
|
CXXFLAGS=${HOST_CXXFLAGS:Q} \
|
|
|
|
INSTALL=${HOST_INSTALL_FILE:Q} \
|
|
|
|
LDFLAGS=${HOST_LDFLAGS:Q} \
|
|
|
|
LEX=${LEX:Q} \
|
|
|
|
M4=${TOOL_M4:Q} \
|
|
|
|
MAKE=${MAKE_PROGRAM:Q} \
|
|
|
|
PATH="${TOOLDIR}/bin:$$PATH" \
|
|
|
|
RANLIB=${HOST_RANLIB:Q} \
|
|
|
|
YACC=${YACC:Q}
|
|
|
|
|
|
|
|
BUILD_ENV+= ${CONFIGURE_ENV}
|
|
|
|
|
|
|
|
CONFIGURE_ARGS+=--prefix=${TOOLDIR}
|
|
|
|
.if ${MKPIC} == "no"
|
|
|
|
CONFIGURE_ARGS+=--disable-shared
|
|
|
|
.endif
|
|
|
|
|
|
|
|
.if ${MAKE_PROGRAM} == ${MAKE}
|
|
|
|
.ifndef _NOWRAPPER
|
|
|
|
# Some systems have a small ARG_MAX. On such systems, prevent Make
|
|
|
|
# variables set on the command line from being exported in the
|
|
|
|
# environment (they will still be set in MAKEOVERRIDES).
|
|
|
|
.if ${BUILD_OSTYPE} == "Darwin" || ${BUILD_OSTYPE} == "FreeBSD"
|
|
|
|
__noenvexport= -X
|
|
|
|
.endif
|
|
|
|
MAKE_ARGS:= ${__noenvexport} -f ${.PARSEDIR}/Makefile.gnuwrap ${MAKE_ARGS}
|
|
|
|
.else
|
|
|
|
MAKE_ARGS+= _NOWRAPPER=1
|
|
|
|
.endif
|
|
|
|
BUILD_COMMAND= ${BUILD_ENV} ${MAKE} ${MAKE_ARGS}
|
|
|
|
.else
|
|
|
|
|
|
|
|
# gmake version of this puts MAKE_ARGS in the environment to be sure that
|
|
|
|
# sub-gmake's get them, otherwise tools/gcc tries to build libgcc and
|
|
|
|
# fails. it also uses "env -i" to entirely clear out MAKEFLAGS.
|
|
|
|
GMAKE_J_ARGS?= ${MAKEFLAGS:[*]:M*-j*:C/.*(-j ?[0-9]*).*/\1/W}
|
|
|
|
BUILD_COMMAND= /usr/bin/env -i ${BUILD_ENV} ${MAKE_ARGS} ${TOOL_GMAKE} ${GMAKE_J_ARGS} -e ${MAKE_ARGS}
|
|
|
|
|
|
|
|
.endif
|
|
|
|
|
|
|
|
MAKE_ARGS+= BISON=true DESTDIR= INSTALL=${HOST_INSTALL_FILE:Q}
|
|
|
|
|
|
|
|
ALL_TARGET?= all
|
|
|
|
INSTALL_TARGET?=install
|
|
|
|
|
Upgrading build system to new NetBSD revision
The tested targets are the followgin ones:
* tools
* distribution
* sets
* release
The remaining NetBSD targets have not been disabled nor tested
*at all*. Try them at your own risk, they may reboot the earth.
For all compliant Makefiles, objects and generated files are put in
MAKEOBJDIR, which means you can now keep objects between two branch
switching. Same for DESTDIR, please refer to build.sh options.
Regarding new or modifications of Makefiles a few things:
* Read share/mk/bsd.README
* If you add a subdirectory, add a Makefile in it, and have it called
by the parent through the SUBDIR variable.
* Do not add arbitrary inclusion which crosses to another branch of
the hierarchy; If you can't do without it, put a comment on why.
If possible, do not use inclusion at all.
* Use as much as possible the infrastructure, it is here to make
life easier, do not fight it.
Sets and package are now used to track files.
We have one set called "minix", composed of one package called "minix-sys"
2012-09-12 09:37:05 +02:00
|
|
|
BUILD_PLATFORM!= uname -srm | tr ' ()' '-'
|
2012-06-06 16:46:00 +02:00
|
|
|
CONFIGURE_PLATFORM!= if [ -s .configure_done ]; then cat .configure_done; else echo none; fi
|
|
|
|
.if "${BUILD_PLATFORM}" != "${CONFIGURE_PLATFORM}"
|
|
|
|
configure_cleanup:
|
|
|
|
@mkdir build 2>/dev/null || true
|
|
|
|
@(echo "Cleaning stale cache files ${BUILD_PLATFORM} != ${CONFIGURE_PLATFORM}")
|
Upgrading build system to new NetBSD revision
The tested targets are the followgin ones:
* tools
* distribution
* sets
* release
The remaining NetBSD targets have not been disabled nor tested
*at all*. Try them at your own risk, they may reboot the earth.
For all compliant Makefiles, objects and generated files are put in
MAKEOBJDIR, which means you can now keep objects between two branch
switching. Same for DESTDIR, please refer to build.sh options.
Regarding new or modifications of Makefiles a few things:
* Read share/mk/bsd.README
* If you add a subdirectory, add a Makefile in it, and have it called
by the parent through the SUBDIR variable.
* Do not add arbitrary inclusion which crosses to another branch of
the hierarchy; If you can't do without it, put a comment on why.
If possible, do not use inclusion at all.
* Use as much as possible the infrastructure, it is here to make
life easier, do not fight it.
Sets and package are now used to track files.
We have one set called "minix", composed of one package called "minix-sys"
2012-09-12 09:37:05 +02:00
|
|
|
@(cd build && find . -name config.cache | xargs rm -f)
|
2012-06-06 16:46:00 +02:00
|
|
|
configure_cleanup=configure_cleanup
|
|
|
|
.endif
|
|
|
|
|
2013-01-21 15:30:17 +01:00
|
|
|
# AL For MINIX, fetch the source if not there
|
|
|
|
.configure_done: ${_gnu_get_src} .WAIT ${_GNU_CFGSRC} ${.CURDIR}/Makefile ${configure_cleanup}
|
2012-06-06 16:46:00 +02:00
|
|
|
@mkdir build 2>/dev/null || true
|
|
|
|
@(cd build && ${CONFIGURE_ENV} ${HOST_SH} ${GNUHOSTDIST}/configure ${CONFIGURE_ARGS})
|
|
|
|
@echo ${BUILD_PLATFORM} > $@
|
|
|
|
|
|
|
|
# The .build_done timestamp is only updated if a file actually changes
|
|
|
|
# in the build tree during "make all". This way, if nothing has changed,
|
|
|
|
# a "make install MKUPDATE=yes" will do nothing.
|
|
|
|
|
|
|
|
.build_done: .configure_done
|
|
|
|
@(cd build && ${BUILD_COMMAND} ${ALL_TARGET})
|
|
|
|
@if [ ! -f $@ ] || [ -n "$$(find build -type f -newer .build_done -print)" ]; \
|
|
|
|
then touch $@; fi
|
|
|
|
|
|
|
|
.install_done! ${BUILD:D.build_done}
|
|
|
|
@(cd ${.OBJDIR}/build && ${BUILD_COMMAND} ${INSTALL_TARGET})
|
|
|
|
@touch $@
|
|
|
|
|
|
|
|
# Mapping to standard targets.
|
|
|
|
|
|
|
|
.if ${USETOOLS} == "yes"
|
|
|
|
realall: .build_done
|
|
|
|
realinstall: .install_done
|
|
|
|
.endif
|
|
|
|
|
|
|
|
clean: clean.gnu
|
|
|
|
clean.gnu:
|
|
|
|
-rm -r -f .*_done build
|
|
|
|
|
2013-01-21 15:30:17 +01:00
|
|
|
# AL - Special target for MINIX, reset the source tree as pristine
|
|
|
|
.if ${CLEANFETCHED:Uno} == "yes" && exists(${GNUHOSTDIST:H}/fetch.sh)
|
|
|
|
cleandir: clean_gnu_src
|
|
|
|
clean_gnu_src:
|
|
|
|
-rm -r -f ${GNUHOSTDIST} ${GNUHOSTDIST:H}/.gitignore
|
|
|
|
# XXX CHECKME: could have used the content of .gitignore as well?
|
|
|
|
.endif # CLEANFETCHED == yes
|
|
|
|
|
2012-06-06 16:46:00 +02:00
|
|
|
.include <bsd.hostprog.mk>
|