diff options
-rw-r--r-- | makefiles/Makefile.tools | 45 | ||||
-rw-r--r-- | makefiles/Makefile.top | 44 |
2 files changed, 63 insertions, 26 deletions
diff --git a/makefiles/Makefile.tools b/makefiles/Makefile.tools index 4244163..a758970 100644 --- a/makefiles/Makefile.tools +++ b/makefiles/Makefile.tools @@ -125,14 +125,11 @@ ifeq ($(TARGET),beos) # No pkg-config PKGCONFIG ?= - GCCVER := 2 - # Default prefix PREFIX ?= /boot/home/config else ifeq ($(HOST),haiku) # Building on Haiku - GCCVER := 2 # Default prefix PREFIX ?= /boot/common @@ -249,16 +246,7 @@ ifeq ($(COMPONENT_TYPE),riscos-module) endif ############################################################################### -# Other settings -############################################################################### - -# If GCC can cope with simultaneous build & dep, do that as it's faster -ifneq ($(GCCVER),2) - CC_CAN_BUILD_AND_DEP ?= yes -endif - -############################################################################### -# Finally, override defaulted tools +# Override defaulted tools ############################################################################### # CC @@ -289,3 +277,34 @@ ifeq ($(origin AR),default) endif endif +############################################################################### +# Other settings +############################################################################### + +# Determine if the compiler is GCC and if it supports simultaneous build & dep. +ccvsn := $(shell $(CC) --version) +ifeq ($(ccvsn),) + # Version string is blank + ifeq ($(HOST),riscos) + # For some reason we never see the output of SCL apps, so assume Norcroft. + ccvsn := Norcroft + else + # Give up + $(error Failed to determine compiler and version) + endif +endif + +# "<binary name> (GCC) x.y.z (foo bar baz)" +ifeq ($(word 2,$(ccvsn)),(GCC)) + # Looks like GCC, look for version + # If the major version (x, above) is not 2, then assume build & dep. + # This will break if using a version of GCC < 2, but that's unlikely. + GCCVER := $(word 1,$(subst ., ,$(word 3, $(ccvsn)))) + ifneq ($(GCCVER),2) + CC_CAN_BUILD_AND_DEP ?= yes + endif +else + # Not GCC -- assume inability to dep + CC_CANNOT_DEP ?= yes +endif + diff --git a/makefiles/Makefile.top b/makefiles/Makefile.top index 00c62b1..2e54acc 100644 --- a/makefiles/Makefile.top +++ b/makefiles/Makefile.top @@ -387,32 +387,50 @@ ifeq ($(CC_CAN_BUILD_AND_DEP),yes) endef else - # C compiler must calculate dependencies first, then compile (default) + ifeq ($(CC_CANNOT_DEP),yes) + # C compiler cannot calculate dependencies - define dep_c - ifeq ($$(findstring $$(BUILDDIR)/$2,$$(DEPFILES)),) - $$(BUILDDIR)/$2: $$(BUILDDIR)/stamp $1 + define dep_c + endef + + define build_c + ifeq ($$(findstring $$(BUILDDIR)/$2,$$(BUILDFILES)),) + $$(BUILDDIR)/$2: $$(BUILDDIR)/stamp $1 + $$(VQ)$$(ECHO) $$(ECHOFLAGS) " COMPILE: $1" + $$(Q)$$(CC) $$($3) -o $$@ -c $1 + + BUILDFILES += $$(BUILDDIR)/$2 + endif + + endef + else + # C compiler must calculate dependencies first, then compile (default) + + define dep_c + ifeq ($$(findstring $$(BUILDDIR)/$2,$$(DEPFILES)),) + $$(BUILDDIR)/$2: $$(BUILDDIR)/stamp $1 $$(VQ)$$(ECHO) $$(ECHOFLAGS) " DEP: $1" $$(Q)$$(RM) $$(RMFLAGS) $($@) $$(Q)$$(CC) $$($3) -MM $1 > $$@.tmp $$(Q)$$(SED) $$(SEDFLAGS) 's,^.*:,$$@ $$(@:.d=.o):,' < $$@.tmp > $$@ $$(Q)$$(RM) $$@.tmp - DEPFILES += $$(BUILDDIR)/$2 - endif + DEPFILES += $$(BUILDDIR)/$2 + endif - endef + endef - define build_c - ifeq ($$(findstring $$(BUILDDIR)/$2,$$(BUILDFILES)),) - $$(BUILDDIR)/$2: $$(BUILDDIR)/stamp $1 + define build_c + ifeq ($$(findstring $$(BUILDDIR)/$2,$$(BUILDFILES)),) + $$(BUILDDIR)/$2: $$(BUILDDIR)/stamp $1 $$(VQ)$$(ECHO) $$(ECHOFLAGS) " COMPILE: $1" $$(Q)$$(CC) $$($3) -o $$@ -c $1 - BUILDFILES += $$(BUILDDIR)/$2 - endif + BUILDFILES += $$(BUILDDIR)/$2 + endif - endef + endef + endif endif define build_cmhg |