[BACK]Return to Makefile.gnuhost CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / tools

File: [cvs.NetBSD.org] / src / tools / Makefile.gnuhost (download)

Revision 1.44.8.2, Wed Apr 18 14:01:16 2018 UTC (6 years ago) by martin
Branch: netbsd-8
CVS Tags: netbsd-8-0-RELEASE, netbsd-8-0-RC2, netbsd-8-0-RC1
Changes since 1.44.8.1: +2 -4 lines

Pull up following revision(s) (requested by maya in ticket #775):

	tools/Makefile.gnuhost: revision 1.46-1.48
	external/gpl3/gcc/dist/gcc/genattrtab.c: revision 1.2

do the bracket nesting only for clang for now.

Use the __clang__ preprocessor symbol to check for clang, since --version
might barf. From joerg@

Apply upstream commit:
From: ppalka <ppalka@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Wed, 27 Apr 2016 21:18:05 +0000
Subject: [PATCH] Reduce nesting of parentheses in conditionals generated by
 genattrtab

gcc/ChangeLog:
        * genattrtab.c (write_test_expr): New parameter EMIT_PARENS
        which defaults to true.  Emit an outer pair of parentheses only if
        EMIT_PARENS.  When continuing a chain of && or || (or & or |),
        don't emit parentheses for the right-hand operand.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@235536

gcc/arm generates so many parens it hits a bracket depth limited which is
enforced by clang. This reduces the number of parens generated and avoids the
need to increase bracket depth.

Fixes PR toolchain/53178 properly.

Remove hack previously needed to build gcc/arm with clang.
genattrtab.c:1.2 makes this unnecessary.

Tested by thorpej.

#	$NetBSD: Makefile.gnuhost,v 1.44.8.2 2018/04/18 14:01:16 martin Exp $
#
# 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}

.for i in 3 2
.if exists(${.CURDIR}/../../external/gpl${i}/${MODULE}/dist)
GNUHOSTDIST?=	${.CURDIR}/../../external/gpl${i}/${MODULE}/dist
.endif
.endfor

FIND_ARGS+=	\! \( -type d \( \
			-name 'CVS' -o \
			-name 'config' -o \
			-name 'doc' -o \
			-name 'po' -o \
			-name 'nbsd.mt' -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 ${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} \
		CONFIG_SHELL=${HOST_SH: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

BUILD_PLATFORM!= uname -srm | tr ' ()' '-'
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}")
	@(cd build && find . -name config.cache | xargs rm -f)
configure_cleanup=configure_cleanup
.endif

.configure_done: ${_GNU_CFGSRC} ${.CURDIR}/Makefile ${configure_cleanup}
	@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

.include <bsd.hostprog.mk>