2001-11-15 01:07:03 +03:00
|
|
|
# $NetBSD: Makefile.gnuhost,v 1.6 2001/11/14 22:07:03 tv Exp $
|
2001-11-13 02:16:17 +03: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 UPDATE is set, "make install" is only run if a build has happened
|
|
|
|
# since the last install in the current directory.
|
|
|
|
|
|
|
|
.include <bsd.own.mk>
|
|
|
|
|
|
|
|
DIST= ${.CURDIR}/../../gnu/dist/${MODULE}
|
|
|
|
|
|
|
|
FIND_ARGS+= \! \( -type d \( \
|
|
|
|
-name 'CVS' -o \
|
|
|
|
-name 'config' -o \
|
|
|
|
-name 'doc' -o \
|
|
|
|
-name 'po' -o \
|
|
|
|
-name 'tests*' \
|
|
|
|
\) -prune \)
|
|
|
|
|
|
|
|
# Do this "find" only if actually building something.
|
|
|
|
.if (${USETOOLS} == "yes") && empty(.MAKEFLAGS:M-V*) && \
|
|
|
|
(make(all) || make(realall) || (!make(clean) && !make(cleandir) && !make(obj))) && \
|
|
|
|
!defined(_GNU_CFGSRC)
|
|
|
|
|
|
|
|
_GNU_CFGSRC!= find ${DIST} ${FIND_ARGS} \
|
|
|
|
-type f \( -name 'config*' -o -name '*.in' \) -print
|
|
|
|
.MAKEOVERRIDES+= _GNU_CFGSRC
|
|
|
|
.endif
|
|
|
|
|
|
|
|
CONFIGURE_ENV+= CC=${HOST_CC:Q} \
|
|
|
|
CFLAGS=${HOST_CFLAGS:Q} \
|
|
|
|
CPPFLAGS=${HOST_CPPFLAGS:Q} \
|
|
|
|
CXX=${HOST_CXX:Q} \
|
|
|
|
CXXFLAGS=${HOST_CXXFLAGS:Q} \
|
2001-11-15 01:07:03 +03:00
|
|
|
INSTALL=${INSTALL_FILE:N-U:Q} \
|
2001-11-13 02:16:17 +03:00
|
|
|
LDFLAGS=${HOST_LDFLAGS:Q} \
|
|
|
|
PATH="${TOOLDIR}/bin:$$PATH"
|
|
|
|
|
|
|
|
CONFIGURE_ARGS+=--prefix=${TOOLDIR} --disable-shared
|
|
|
|
|
2001-11-13 09:17:45 +03:00
|
|
|
MAKE_ARGS:= -j1 ${MAKE_ARGS}
|
|
|
|
|
2001-11-13 07:28:27 +03:00
|
|
|
.ifndef _NOWRAPPER
|
|
|
|
MAKE_ARGS:= -f ${.PARSEDIR}/Makefile.gnuwrap ${MAKE_ARGS}
|
|
|
|
.else
|
|
|
|
MAKE_ARGS+= _NOWRAPPER=1
|
|
|
|
.endif
|
|
|
|
|
2001-11-15 01:07:03 +03:00
|
|
|
MAKE_ARGS+= LEX=true BISON=true DESTDIR= INSTALL=${INSTALL_FILE:N-U:Q}
|
2001-11-13 07:43:25 +03:00
|
|
|
|
2001-11-13 02:16:17 +03:00
|
|
|
ALL_TARGET?= all
|
|
|
|
INSTALL_TARGET?=install
|
|
|
|
|
|
|
|
.configure_done: ${_GNU_CFGSRC}
|
|
|
|
@mkdir build 2>/dev/null || true
|
|
|
|
@(cd build && ${CONFIGURE_ENV} ${DIST}/configure ${CONFIGURE_ARGS})
|
|
|
|
@touch $@
|
|
|
|
|
|
|
|
.build_done: .configure_done
|
2001-11-13 07:28:27 +03:00
|
|
|
@(cd build && ${MAKE} ${MAKE_ARGS} ${ALL_TARGET})
|
2001-11-13 02:16:17 +03:00
|
|
|
@touch $@
|
|
|
|
|
|
|
|
.install_done:
|
|
|
|
.if defined(UPDATE)
|
|
|
|
@if [ ! -f .install_done ] || [ .build_done -nt .install_done ]; then \
|
2001-11-13 07:28:27 +03:00
|
|
|
(cd build && ${MAKE} ${MAKE_ARGS} ${INSTALL_TARGET}); \
|
2001-11-13 02:16:17 +03:00
|
|
|
fi
|
|
|
|
.else
|
2001-11-13 07:28:27 +03:00
|
|
|
@(cd build && ${MAKE} ${MAKE_ARGS} ${INSTALL_TARGET})
|
2001-11-13 02:16:17 +03:00
|
|
|
.endif
|
|
|
|
@touch $@
|
|
|
|
|
|
|
|
.PHONY: .build_done .install_done
|
|
|
|
.ORDER: .build_done .install_done
|
|
|
|
|
|
|
|
# Mapping to standard targets.
|
|
|
|
|
|
|
|
.if ${USETOOLS} == "yes"
|
|
|
|
realall: .build_done
|
|
|
|
realinstall: .install_done
|
|
|
|
.endif
|
|
|
|
|
|
|
|
clean: clean.gnu
|
|
|
|
clean.gnu:
|
|
|
|
-rm -r -f .*_done build
|
|
|
|
|
|
|
|
.include <bsd.hostprog.mk>
|