summaryrefslogtreecommitdiffstats
path: root/gnu
diff options
context:
space:
mode:
authorbdrewery <bdrewery@FreeBSD.org>2016-04-18 18:13:58 +0000
committerbdrewery <bdrewery@FreeBSD.org>2016-04-18 18:13:58 +0000
commit0cc8656eb968e6b5a098f6307911006932447c3c (patch)
tree0df5667ab90d3c8696803c12426cb486102d64b6 /gnu
parent3842fa6c223b41ebdb85fff66386e94652bf4aad (diff)
downloadFreeBSD-src-0cc8656eb968e6b5a098f6307911006932447c3c.zip
FreeBSD-src-0cc8656eb968e6b5a098f6307911006932447c3c.tar.gz
Follow-up r297842: Rework header generation to fix always rebuilding.
This reworks the handling of common headers to just include the needed logic rather than invoke MAKE. This avoids the problem listed in r297842 and avoids other dependency tracking issues. Pointyhat to: bdrewery Reported by: Nikolai Lifanov <lifanov@mail.lifanov.com> Sponsored by: EMC / Isilon Storage Division
Diffstat (limited to 'gnu')
-rw-r--r--gnu/lib/csu/Makefile8
-rw-r--r--gnu/lib/libgcc/Makefile13
-rw-r--r--gnu/lib/libgcov/Makefile10
-rw-r--r--gnu/usr.bin/cc/cc_tools/Makefile116
-rw-r--r--gnu/usr.bin/cc/cc_tools/Makefile.hdrs132
5 files changed, 148 insertions, 131 deletions
diff --git a/gnu/lib/csu/Makefile b/gnu/lib/csu/Makefile
index 0e50152..b7cefe8 100644
--- a/gnu/lib/csu/Makefile
+++ b/gnu/lib/csu/Makefile
@@ -7,10 +7,11 @@ GCCDIR= ${.CURDIR}/../../../contrib/gcc
GCCLIB= ${.CURDIR}/../../../contrib/gcclibs
CCDIR= ${.CURDIR}/../../usr.bin/cc
.include "${CCDIR}/Makefile.tgt"
+.include "${CCDIR}/cc_tools/Makefile.hdrs"
.PATH: ${GCCDIR}/config/${GCC_CPU} ${GCCDIR}
-SRCS= crtstuff.c tconfig.h tm.h options.h
+SRCS= crtstuff.c ${COMMONHDRS}
OBJS= crtbegin.o crtend.o crtbeginT.o
SOBJS= crtbeginS.o crtendS.o
CSTD?= gnu89
@@ -70,8 +71,7 @@ crtendS.o: ${ENDSRC}
${CC} ${CFLAGS} -g0 -DCRT_END ${CRTS_CFLAGS} \
-c -o ${.TARGET} ${.ALLSRC:N*.h}
-CLEANFILES+= tm.h tconfig.h options.h optionlist cs-tconfig.h cs-tm.h
-tm.h tconfig.h options.h: ${CCDIR}/cc_tools/Makefile .PHONY
- (cd ${.CURDIR}; ${MAKE} -f ${.ALLSRC} MFILE=${.ALLSRC} GCCDIR=${GCCDIR} ${.TARGET})
+COMMONHDRS+= tm.h tconfig.h options.h
+CLEANFILES+= ${COMMONHDRS} optionlist cs-tconfig.h cs-tm.h
.include <bsd.lib.mk>
diff --git a/gnu/lib/libgcc/Makefile b/gnu/lib/libgcc/Makefile
index 643d10d..10e1c0f 100644
--- a/gnu/lib/libgcc/Makefile
+++ b/gnu/lib/libgcc/Makefile
@@ -3,6 +3,7 @@
PACKAGE= clibs
GCCDIR= ${.CURDIR}/../../../contrib/gcc
GCCLIB= ${.CURDIR}/../../../contrib/gcclibs
+CCDIR= ${.CURDIR}/../../usr.bin/cc
COMPILERRTDIR= ${.CURDIR}/../../../contrib/compiler-rt
UNWINDINCDIR= ${.CURDIR}/../../../contrib/llvm/projects/libunwind/include
UNWINDSRCDIR= ${.CURDIR}/../../../contrib/llvm/projects/libunwind/src
@@ -17,7 +18,8 @@ SHLIBDIR?= /lib
#
MK_SSP= no
-.include "${.CURDIR}/../../usr.bin/cc/Makefile.tgt"
+.include "${CCDIR}/Makefile.tgt"
+.include "${CCDIR}/cc_tools/Makefile.hdrs"
.if ${TARGET_CPUARCH} == "arm"
CFLAGS+= -DTARGET_ARM_EABI
@@ -29,7 +31,7 @@ CFLAGS+= -DIN_GCC -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED \
-DHAVE_GTHR_DEFAULT \
-I${GCCLIB}/include \
-I${GCCDIR}/config -I${GCCDIR} -I. \
- -I${.CURDIR}/../../usr.bin/cc/cc_tools
+ -I${CCDIR}/cc_tools
LDFLAGS+= -nodefaultlibs
LIBADD+= c
@@ -340,13 +342,6 @@ ${_src:R:S/$/.So/}: ${_src} ${COMMONHDRS}
.endfor
-#-----------------------------------------------------------------------
-#
-# Generated headers
-#
-${COMMONHDRS}: ${.CURDIR}/../../usr.bin/cc/cc_tools/Makefile .PHONY
- (cd ${.CURDIR}; ${MAKE} -f ${.ALLSRC} MFILE=${.ALLSRC} GCCDIR=${GCCDIR} ${.TARGET})
-
CLEANFILES += ${COMMONHDRS}
CLEANFILES += cs-*.h option*
diff --git a/gnu/lib/libgcov/Makefile b/gnu/lib/libgcov/Makefile
index 34932aa..65d0fdb 100644
--- a/gnu/lib/libgcov/Makefile
+++ b/gnu/lib/libgcov/Makefile
@@ -4,17 +4,20 @@ MK_PROFILE= no
MK_SSP= no
.include <src.opts.mk>
-.include "${.CURDIR}/../../usr.bin/cc/Makefile.tgt"
GCCDIR= ${.CURDIR}/../../../contrib/gcc
GCCLIB= ${.CURDIR}/../../../contrib/gcclibs
+CCDIR= ${.CURDIR}/../../usr.bin/cc
+.include "${CCDIR}/Makefile.tgt"
+.include "${CCDIR}/cc_tools/Makefile.hdrs"
+
.PATH: ${GCCDIR}/config/${GCC_CPU} ${GCCDIR}
LIB= gcov
CFLAGS+= -DIN_GCC -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED
CFLAGS+= -D_PTHREADS -DGTHREAD_USE_WEAK
-CFLAGS+= -I${.CURDIR}/../../usr.bin/cc/cc_tools \
+CFLAGS+= -I${CCDIR}/cc_tools \
-I${GCCLIB}/include -I${GCCDIR}/config -I${GCCDIR} -I.
.if ${TARGET_CPUARCH} == "arm"
@@ -45,9 +48,6 @@ CC_S = ${CC} -c ${CFLAGS} ${PICFLAG} -DSHARED
COMMONHDRS= tm.h tconfig.h gcov-iov.h options.h
CLEANFILES+= ${COMMONHDRS} cs-tm.h cs-tconfig.h options.h optionlist
-${COMMONHDRS}: ${.CURDIR}/../../usr.bin/cc/cc_tools/Makefile .PHONY
- (cd ${.CURDIR}; ${MAKE} -f ${.ALLSRC} MFILE=${.ALLSRC} GCCDIR=${GCCDIR} ${.TARGET})
-
${OBJS} beforedepend: ${COMMONHDRS}
${OBJS_T}: libgcov.c
diff --git a/gnu/usr.bin/cc/cc_tools/Makefile b/gnu/usr.bin/cc/cc_tools/Makefile
index f645453..2b2aa25 100644
--- a/gnu/usr.bin/cc/cc_tools/Makefile
+++ b/gnu/usr.bin/cc/cc_tools/Makefile
@@ -5,6 +5,9 @@
CFLAGS+= -I.
.include "../Makefile.inc"
+# Some of the logic needed in here is defined in Makefile.hdrs as it is shared
+# with gnu/lib.
+.include "Makefile.hdrs"
CFLAGS+= -g
CFLAGS+= -DGENERATOR_FILE -DHAVE_CONFIG_H
@@ -21,51 +24,6 @@ LIBIBERTY= libiberty.a
#
# The list of headers to go into tm.h
#
-TARGET_INC+= options.h
-.if ${TARGET_CPUARCH} == "amd64"
-TARGET_INC+= i386/biarch64.h
-.endif
-.if ${TARGET_CPUARCH} != "arm"
-TARGET_INC+= ${GCC_CPU}/${GCC_CPU}.h
-.endif
-.if ${TARGET_CPUARCH} == "i386" || ${TARGET_CPUARCH} == "amd64"
-TARGET_INC+= ${GCC_CPU}/unix.h
-TARGET_INC+= ${GCC_CPU}/att.h
-.endif
-TARGET_INC+= dbxelf.h
-TARGET_INC+= elfos-undef.h
-TARGET_INC+= elfos.h
-TARGET_INC+= freebsd-native.h
-TARGET_INC+= freebsd-spec.h
-TARGET_INC+= freebsd.h
-.if ${TARGET_CPUARCH} != "i386" && ${TARGET_CPUARCH} != "amd64"
-. if exists(${GCCDIR}/config/${GCC_CPU}/sysv4.h)
-TARGET_INC+= ${GCC_CPU}/sysv4.h
-. endif
-.endif
-.if ${TARGET_CPUARCH} == "amd64"
-TARGET_INC+= ${GCC_CPU}/x86-64.h
-.endif
-.if ${TARGET_CPUARCH} == "arm" || ${TARGET_CPUARCH} == "mips"
-TARGET_INC+= ${GCC_CPU}/elf.h
-.endif
-.if ${TARGET_CPUARCH} == "arm"
-TARGET_INC+= ${GCC_CPU}/aout.h
-TARGET_INC+= ${GCC_CPU}/bpabi.h
-.endif
-.if ${TARGET_ARCH} == "powerpc64"
-TARGET_INC+= ${GCC_CPU}/biarch64.h
-TARGET_INC+= ${GCC_CPU}/default64.h
-.endif
-TARGET_INC+= ${GCC_CPU}/freebsd.h
-.if ${TARGET_CPUARCH} == "amd64"
-TARGET_INC+= ${GCC_CPU}/freebsd64.h
-.endif
-.if ${TARGET_CPUARCH} == "arm"
-TARGET_INC+= ${GCC_CPU}/arm.h
-.endif
-TARGET_INC+= defaults.h
-
.for H in ${TARGET_INC}
.for D in ${GCCDIR}/config ${GCCDIR} ${.CURDIR}
.if exists($D/$H)
@@ -155,31 +113,6 @@ TREE_DEF_FILES=
TREE_DEF_FILES+= cp/cp-tree.def
.endif
-#
-# Option files.
-#
-OPT_FILES= c.opt common.opt
-
-.if exists(${GCCDIR}/config/${GCC_CPU}/${GCC_CPU}.opt)
-OPT_FILES+= ${GCCDIR}/config/${GCC_CPU}/${GCC_CPU}.opt
-.endif
-
-.if exists(${.CURDIR}/${GCC_CPU}-freebsd.opt)
-OPT_FILES+= ${.CURDIR}/${GCC_CPU}-freebsd.opt
-.endif
-
-.if ${TARGET_CPUARCH} == "powerpc"
-OPT_FILES+= ${GCCDIR}/config/${GCC_CPU}/sysv4.opt
-.endif
-
-.if ${TARGET_CPUARCH} == "sparc64"
-OPT_FILES+= ${GCCDIR}/config/${GCC_CPU}/long-double-switch.opt
-.endif
-
-.if exists(${.CURDIR}/freebsd.opt)
-OPT_FILES+= ${.CURDIR}/freebsd.opt
-.endif
-
#-----------------------------------------------------------------------
# Build rules for header files and generator tools
@@ -207,41 +140,13 @@ GENSRCS+= bconfig.h
CLEANFILES+= cs-bconfig.h
# tconfig.h
-tconfig.h:
- TARGET_CPU_DEFAULT="${TARGET_CPU_DEFAULT}" \
- HEADERS="auto-host.h ansidecl.h" \
- DEFINES="USED_FOR_TARGET" \
- /bin/sh ${GCCDIR}/mkconfig.sh ${.TARGET}
-
GENSRCS+= tconfig.h
CLEANFILES+= cs-tconfig.h
# Options
-optionlist: ${OPT_FILES}
- LC_ALL=C awk -f ${GCCDIR}/opt-gather.awk ${.ALLSRC} > ${.TARGET}
-
-options.h: optionlist
- LC_ALL=C awk -f ${GCCDIR}/opt-functions.awk \
- -f ${GCCDIR}/opth-gen.awk \
- < ${.ALLSRC} > ${.TARGET}
-
-options.c: optionlist
- LC_ALL=C awk -f ${GCCDIR}/opt-functions.awk \
- -f ${GCCDIR}/optc-gen.awk \
- -v header_name="config.h system.h coretypes.h tm.h" \
- < ${.ALLSRC} > ${.TARGET}
GENONLY+= optionlist options.h options.c
# Target machine config
-tm.h:
- TARGET_CPU_DEFAULT="${TARGET_CPU_DEFAULT}" \
- HEADERS="${TARGET_INC}" \
- DEFINES="" \
- /bin/sh ${GCCDIR}/mkconfig.sh ${.TARGET}
-.if exists(${GCCDIR}/config/${GCC_CPU}/${GCC_CPU}-modes.def)
- echo '#define EXTRA_MODES_FILE "${GCC_CPU}/${GCC_CPU}-modes.def"' >> ${.TARGET}
-.endif
-
GENSRCS+= tm.h
CLEANFILES+= cs-tm.h
@@ -294,9 +199,6 @@ gtyp-gen.h: ${GTFILES}
GENSRCS+= gtyp-gen.h
# Version header for gcov
-gcov-iov.h:
- echo "#define GCOV_VERSION ((gcov_unsigned_t)0x34303270)" >> ${.TARGET}
-
GENSRCS+= gcov-iov.h
# Multilib config file
@@ -346,20 +248,8 @@ gstdint.h:
GENSRCS+= gstdint.h
# Linked headers
-gthr-default.h: ${GCCDIR}/gthr-posix.h .NOMETA
- ln -sf ${.ALLSRC} ${.TARGET}
-
GENSRCS+= gthr-default.h
-.if ${TARGET_CPUARCH} == "arm"
-unwind.h: ${GCCDIR}/config/arm/unwind-arm.h
-.else
-unwind.h: ${GCCDIR}/unwind-generic.h
-.endif
-
-unwind.h: .NOMETA
- ln -sf ${.ALLSRC} ${.TARGET}
-
GENSRCS+= unwind.h
#
diff --git a/gnu/usr.bin/cc/cc_tools/Makefile.hdrs b/gnu/usr.bin/cc/cc_tools/Makefile.hdrs
new file mode 100644
index 0000000..959d7a7
--- /dev/null
+++ b/gnu/usr.bin/cc/cc_tools/Makefile.hdrs
@@ -0,0 +1,132 @@
+# $FreeBSD$
+#
+# This is logic for common headers shared inside of gnu/lib. It used to
+# live in gnu/usr.bin/cc/cc_tools/Makefile.
+
+.if !defined(TARGET_CPUARCH) || !defined(GCC_CPU)
+.error ${.CURDIR}: Must include gnu/usr.bin/cc/Makefile.tgt first.
+.endif
+
+#
+# The list of headers to go into tm.h
+#
+TARGET_INC+= options.h
+.if ${TARGET_CPUARCH} == "amd64"
+TARGET_INC+= i386/biarch64.h
+.endif
+.if ${TARGET_CPUARCH} != "arm"
+TARGET_INC+= ${GCC_CPU}/${GCC_CPU}.h
+.endif
+.if ${TARGET_CPUARCH} == "i386" || ${TARGET_CPUARCH} == "amd64"
+TARGET_INC+= ${GCC_CPU}/unix.h
+TARGET_INC+= ${GCC_CPU}/att.h
+.endif
+TARGET_INC+= dbxelf.h
+TARGET_INC+= elfos-undef.h
+TARGET_INC+= elfos.h
+TARGET_INC+= freebsd-native.h
+TARGET_INC+= freebsd-spec.h
+TARGET_INC+= freebsd.h
+.if ${TARGET_CPUARCH} != "i386" && ${TARGET_CPUARCH} != "amd64"
+. if exists(${GCCDIR}/config/${GCC_CPU}/sysv4.h)
+TARGET_INC+= ${GCC_CPU}/sysv4.h
+. endif
+.endif
+.if ${TARGET_CPUARCH} == "amd64"
+TARGET_INC+= ${GCC_CPU}/x86-64.h
+.endif
+.if ${TARGET_CPUARCH} == "arm" || ${TARGET_CPUARCH} == "mips"
+TARGET_INC+= ${GCC_CPU}/elf.h
+.endif
+.if ${TARGET_CPUARCH} == "arm"
+TARGET_INC+= ${GCC_CPU}/aout.h
+TARGET_INC+= ${GCC_CPU}/bpabi.h
+.endif
+.if ${TARGET_ARCH} == "powerpc64"
+TARGET_INC+= ${GCC_CPU}/biarch64.h
+TARGET_INC+= ${GCC_CPU}/default64.h
+.endif
+TARGET_INC+= ${GCC_CPU}/freebsd.h
+.if ${TARGET_CPUARCH} == "amd64"
+TARGET_INC+= ${GCC_CPU}/freebsd64.h
+.endif
+.if ${TARGET_CPUARCH} == "arm"
+TARGET_INC+= ${GCC_CPU}/arm.h
+.endif
+TARGET_INC+= defaults.h
+
+#
+# Option files.
+#
+OPT_FILES= c.opt common.opt
+
+.if exists(${GCCDIR}/config/${GCC_CPU}/${GCC_CPU}.opt)
+OPT_FILES+= ${GCCDIR}/config/${GCC_CPU}/${GCC_CPU}.opt
+.endif
+
+.if exists(${.CURDIR}/${GCC_CPU}-freebsd.opt)
+OPT_FILES+= ${.CURDIR}/${GCC_CPU}-freebsd.opt
+.endif
+
+.if ${TARGET_CPUARCH} == "powerpc"
+OPT_FILES+= ${GCCDIR}/config/${GCC_CPU}/sysv4.opt
+.endif
+
+.if ${TARGET_CPUARCH} == "sparc64"
+OPT_FILES+= ${GCCDIR}/config/${GCC_CPU}/long-double-switch.opt
+.endif
+
+.if exists(${.CURDIR}/freebsd.opt)
+OPT_FILES+= ${.CURDIR}/freebsd.opt
+.endif
+
+
+# Options
+optionlist: ${OPT_FILES}
+ LC_ALL=C awk -f ${GCCDIR}/opt-gather.awk ${.ALLSRC} > ${.TARGET}
+
+options.h: optionlist
+ LC_ALL=C awk -f ${GCCDIR}/opt-functions.awk \
+ -f ${GCCDIR}/opth-gen.awk \
+ < ${.ALLSRC} > ${.TARGET}
+
+options.c: optionlist
+ LC_ALL=C awk -f ${GCCDIR}/opt-functions.awk \
+ -f ${GCCDIR}/optc-gen.awk \
+ -v header_name="config.h system.h coretypes.h tm.h" \
+ < ${.ALLSRC} > ${.TARGET}
+
+# Target machine config
+tm.h:
+ TARGET_CPU_DEFAULT="${TARGET_CPU_DEFAULT}" \
+ HEADERS="${TARGET_INC}" \
+ DEFINES="" \
+ /bin/sh ${GCCDIR}/mkconfig.sh ${.TARGET}
+.if exists(${GCCDIR}/config/${GCC_CPU}/${GCC_CPU}-modes.def)
+ echo '#define EXTRA_MODES_FILE "${GCC_CPU}/${GCC_CPU}-modes.def"' >> ${.TARGET}
+.endif
+
+# tconfig.h
+tconfig.h:
+ TARGET_CPU_DEFAULT="${TARGET_CPU_DEFAULT}" \
+ HEADERS="auto-host.h ansidecl.h" \
+ DEFINES="USED_FOR_TARGET" \
+ /bin/sh ${GCCDIR}/mkconfig.sh ${.TARGET}
+
+# Version header for gcov
+gcov-iov.h:
+ echo "#define GCOV_VERSION ((gcov_unsigned_t)0x34303270)" >> ${.TARGET}
+
+# Linked headers
+gthr-default.h: ${GCCDIR}/gthr-posix.h .NOMETA
+ ln -sf ${.ALLSRC} ${.TARGET}
+
+.if ${TARGET_CPUARCH} == "arm"
+unwind.h: ${GCCDIR}/config/arm/unwind-arm.h
+.else
+unwind.h: ${GCCDIR}/unwind-generic.h
+.endif
+
+unwind.h: .NOMETA
+ ln -sf ${.ALLSRC} ${.TARGET}
+
OpenPOWER on IntegriCloud