From 64ed7155dec9fea48b542f16c80a6f0dd25dca37 Mon Sep 17 00:00:00 2001 From: John Marino Date: Sat, 27 Oct 2012 17:42:36 +0200 Subject: [PATCH] gcc4X: rework some makefiles These are various tweaks to improve compatibility between legacy make and bmake. The biggest change was moving gnu/usr.bin dependencies outside to Makefile.inc1 as part of _startup_lib* rather than fudge it with .PHONY targets. This kludge was causing some issues, as well as the double .USE trick. --- Makefile.inc1 | 9 +++++++-- gnu/lib/Makefile | 13 ++++++++----- gnu/lib/gcc44/Makefile | 10 +++++++--- gnu/lib/gcc44/libgcc/Makefile | 14 ++++---------- gnu/lib/gcc47/Makefile | 3 +++ gnu/lib/gcc47/libgcc/Makefile | 18 +++++------------- gnu/lib/gcc47/libgcc_eh/Makefile | 5 ----- gnu/lib/gcc47/libstdc++/Makefile | 13 +++++-------- gnu/usr.bin/cc44/cc_tools/tools/Makefile | 6 ++++-- gnu/usr.bin/cc47/cc_tools/tools/Makefile | 6 ++++-- 10 files changed, 47 insertions(+), 50 deletions(-) diff --git a/Makefile.inc1 b/Makefile.inc1 index d2fb231bc1..d95052bac6 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -897,11 +897,16 @@ libraries: # shared libraries for ELF. The target for _startup_libsXX is # specifically built using gccXX. # -_startup_libs47= gnu/lib/gcc47/csu \ +_startup_libs47= gnu/usr.bin/cc47/cc_prep \ + gnu/usr.bin/cc47/cc_tools \ + gnu/lib/gcc47/csu \ gnu/lib/gcc47/libgcc \ gnu/lib/gcc47/libgcc_eh \ gnu/lib/gcc47/libgcc_pic -_startup_libs44= gnu/lib/gcc44/csu gnu/lib/gcc44/libgcc +_startup_libs44= gnu/usr.bin/cc44/cc_prep \ + gnu/usr.bin/cc44/cc_tools \ + gnu/lib/gcc44/csu \ + gnu/lib/gcc44/libgcc _startup_libs= lib/csu lib/libc lib/libc_rtld _prebuild_libs= lib/libbz2 lib/liblzma lib/libz diff --git a/gnu/lib/Makefile b/gnu/lib/Makefile index 7bb32683f4..85844e9a80 100644 --- a/gnu/lib/Makefile +++ b/gnu/lib/Makefile @@ -1,12 +1,15 @@ -SUBDIR= gcc44 libcryptsetup libdevmapper libdialog libluks liblvm +# SUBDIR_ORDERED defaults to SUBDIR order which is just fine + +SUBDIR= gcc44 .if !defined(NO_GCC47) SUBDIR+= gcc47 - -# FIXME: libobjc in gcc44 and gcc47 can collide installing header files -# -SUBDIR_ORDERED= gcc44 gcc47 .endif +SUBDIR+= libcryptsetup +SUBDIR+= libdevmapper +SUBDIR+= libdialog +SUBDIR+= libluks +SUBDIR+= liblvm .include diff --git a/gnu/lib/gcc44/Makefile b/gnu/lib/gcc44/Makefile index b36cb03c5f..369d4209b1 100644 --- a/gnu/lib/gcc44/Makefile +++ b/gnu/lib/gcc44/Makefile @@ -1,9 +1,13 @@ -.include "Makefile.inc" +# Processed in order because SUBDIR_ORDERED is not defined +# csu and libgcc are normally built earlier by the _startup_libs44 target -SUBDIR= csu libgcc libgcov +SUBDIR= csu +SUBDIR+= libgcc +SUBDIR+= libgcov .if !defined(NO_CXX) -SUBDIR+= libsupc++ libstdc++ +SUBDIR+= libsupc++ +SUBDIR+= libstdc++ .endif .if !defined(NO_OBJC) diff --git a/gnu/lib/gcc44/libgcc/Makefile b/gnu/lib/gcc44/libgcc/Makefile index 4091918e9c..dd4f83aaac 100644 --- a/gnu/lib/gcc44/libgcc/Makefile +++ b/gnu/lib/gcc44/libgcc/Makefile @@ -59,22 +59,16 @@ ${F}.o: ${F}.c ${CC} ${CFLAGS} -fnon-call-exceptions -c ${.IMPSRC} .endfor -beforedepend: cc_prep cc_tools -.ORDER: cc_prep cc_tools ${SRCS} - -# This is kinda messy, but it's easier then rearranging the top level -# build. gcc's libgcc generates source files which depend on generated +# GCC's libgcc generates source files which depend on generated # header files, which means we have to generate our tools set before # we can build libgcc. The toolset is normally built afterwards. # # XXX for the world stage we could theoretically use the cc_tools generated # in the btools stage, but it's easier to regenerate them. # -cc_prep: .PHONY - cd ${STOPDIR}/cc_prep; ${MAKE} depend - -cc_tools: .PHONY - cd ${STOPDIR}/cc_tools; ${MAKE} depend +# Assumed to be built prior to this makefile: +# gnu/usr.bin/cc44/cc_prep +# gnu/usr.bin/cc44/cc_tools .if ${GCC_CPU} == "i386" EXTRA_HEADERS = $(srcdir)/config/i386/cpuid.h $(srcdir)/config/i386/mmintrin.h \ diff --git a/gnu/lib/gcc47/Makefile b/gnu/lib/gcc47/Makefile index d684f1db9a..3177e02ec8 100644 --- a/gnu/lib/gcc47/Makefile +++ b/gnu/lib/gcc47/Makefile @@ -1,3 +1,6 @@ +# Processed in order because SUBDIR_ORDERED is not defined +# csu and libgcc* are normally built earlier by the _startup_libs47 target + SUBDIR+= csu SUBDIR+= libgcc SUBDIR+= libgcc_eh diff --git a/gnu/lib/gcc47/libgcc/Makefile b/gnu/lib/gcc47/libgcc/Makefile index 88e799b1e5..8cd979baff 100644 --- a/gnu/lib/gcc47/libgcc/Makefile +++ b/gnu/lib/gcc47/libgcc/Makefile @@ -28,25 +28,17 @@ CLEANFILES+= ${FUNCS:S/$/.c/} #generated sources SRCS+= gthr-default.h sfp-machine.h -beforedepend: cc_prep cc_tools csu -.ORDER: cc_prep cc_tools csu ${SRCS} - -# This is kinda messy, but it's easier then rearranging the top level -# build. gcc's libgcc generates source files which depend on generated +# GCC's libgcc generates source files which depend on generated # header files, which means we have to generate our tools set before # we can build libgcc. The toolset is normally built afterwards. # # XXX for the world stage we could theoretically use the cc_tools generated # in the btools stage, but it's easier to regenerate them. # -cc_prep: .PHONY - cd ${CCDIR}/cc_prep; ${MAKE} depend - -cc_tools: .PHONY - cd ${CCDIR}/cc_tools; ${MAKE} depend - -csu: .PHONY - cd ${.CURDIR}/../csu; ${MAKE} depend +# Assumed to be built prior to this makefile: +# gnu/usr.bin/cc47/cc_prep +# gnu/usr.bin/cc47/cc_tools +# gnu/lib/gcc47/csu .if ${GCC_CPU} == "i386" EXTRA_HEADERS = \ diff --git a/gnu/lib/gcc47/libgcc_eh/Makefile b/gnu/lib/gcc47/libgcc_eh/Makefile index ee0572d6e5..6e7a6089f9 100644 --- a/gnu/lib/gcc47/libgcc_eh/Makefile +++ b/gnu/lib/gcc47/libgcc_eh/Makefile @@ -38,9 +38,4 @@ gthr-default.h: gthr-posix.h CLEANFILES+= unwind.h md-unwind-support.h gthr-default.h -beforedepend: cc_prep - -cc_prep: .PHONY - cd ${CCDIR}/cc_prep; ${MAKE} depend - .include diff --git a/gnu/lib/gcc47/libstdc++/Makefile b/gnu/lib/gcc47/libstdc++/Makefile index 866d7b7556..88b167b8a8 100644 --- a/gnu/lib/gcc47/libstdc++/Makefile +++ b/gnu/lib/gcc47/libstdc++/Makefile @@ -24,14 +24,7 @@ CFLAGS+= -I${.OBJDIR} CFLAGS+= -I${GCCDIR}/gcc CFLAGS+= -I${GCCDIR}/libgcc CFLAGS+= -I${GCCDIR}/libiberty -CFLAGS+= -I${GCCDIR}/include CFLAGS+= -I${GCCDIR}/libcpp/include -CFLAGS+= -I${SRCDIR}/include -CFLAGS+= -I${SRCDIR}/include/std -CFLAGS+= -I${SRCDIR}/include/c_std -CFLAGS+= -I${SRCDIR}/include/c_global -CFLAGS+= -I${SRCDIR}/include/backward -CFLAGS+= -I${SRCDIR}/libsupc++ CXXFLAGS+= -fno-implicit-templates CXXFLAGS+= -fdiagnostics-show-location=once CXXFLAGS+= -ffunction-sections -fdata-sections @@ -186,6 +179,7 @@ gnu11_FLAGS_FILES= chrono.cc \ #generated sources SRCS+= unwind.h \ + unwind-cxx.h \ ${CONF_HEADERS:T} HD= ${INCLUDEDIR}/c++/${GCCPOINTVER} @@ -250,6 +244,9 @@ c++locale.cc: ${SRCDIR}/config/locale/dragonfly/c_locale.cc unwind.h: unwind-generic.h cp ${.ALLSRC} ${.TARGET} +unwind-cxx.h: ${SRCDIR}/libsupc++/unwind-cxx.h + cp ${.ALLSRC} ${.TARGET} + copybits: mkdir -p bits @@ -276,7 +273,7 @@ vec-cxx.cc: ${SRCDIR}/libsupc++/vec.cc CLEANDIRS+= bits CLEANFILES+= atomicity.cc basic_file.cc c++locale.cc \ - ctype_configure_char.cc unwind.h \ + ctype_configure_char.cc unwind.h unwind-cxx.h \ cp-demangle.c debug-cxx.cc tree-cxx.cc vec-cxx.cc \ c++config.h gthr.h gthr-default.h diff --git a/gnu/usr.bin/cc44/cc_tools/tools/Makefile b/gnu/usr.bin/cc44/cc_tools/tools/Makefile index e66d81ac98..21b5e31955 100644 --- a/gnu/usr.bin/cc44/cc_tools/tools/Makefile +++ b/gnu/usr.bin/cc44/cc_tools/tools/Makefile @@ -51,10 +51,12 @@ MD_DEPS= ${md_file} _MIC: .USE ${MIC} ${.TARGET}.tmp ${.TARGET} -_PL: .USE _MIC +_PL: .USE ${.OBJDIR}/${.ALLSRC:M*.nx} > ${.TARGET}.tmp -_MD: .USE _MIC + ${MIC} ${.TARGET}.tmp ${.TARGET} +_MD: .USE ${.OBJDIR}/${.ALLSRC:M*.nx} ${md_file} > ${.TARGET}.tmp + ${MIC} ${.TARGET}.tmp ${.TARGET} simple_generated_h = insn-attr.h insn-codes.h insn-config.h insn-flags.h diff --git a/gnu/usr.bin/cc47/cc_tools/tools/Makefile b/gnu/usr.bin/cc47/cc_tools/tools/Makefile index fdb4c285ba..1efaa89ce4 100644 --- a/gnu/usr.bin/cc47/cc_tools/tools/Makefile +++ b/gnu/usr.bin/cc47/cc_tools/tools/Makefile @@ -69,10 +69,12 @@ MD_DEPS= ${md_file} _MIC: .USE ${MIC} ${.TARGET}.tmp ${.TARGET} -_PL: .USE _MIC +_PL: .USE ${.OBJDIR}/${.ALLSRC:M*.nx} > ${.TARGET}.tmp -_MD: .USE _MIC + ${MIC} ${.TARGET}.tmp ${.TARGET} +_MD: .USE ${.OBJDIR}/${.ALLSRC:M*.nx} ${md_file} > ${.TARGET}.tmp + ${MIC} ${.TARGET}.tmp ${.TARGET} simple_generated_h = insn-attr.h insn-codes.h insn-config.h insn-flags.h \ insn-attr-common.h -- 2.41.0