From cd1c230244b6beb1e36f6471a89efc50ce5f6308 Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Sat, 20 Jun 2009 11:11:53 +0000 Subject: Auto-detect whether C compiler is GCC and, if it is, whether it supports simultaneous compilation and dependency generation. Add canned rules for compilers that cannot calculate dependency information. svn path=/trunk/tools/buildsystem/; revision=7890 --- makefiles/Makefile.top | 44 +++++++++++++++++++++++++++++++------------- 1 file changed, 31 insertions(+), 13 deletions(-) (limited to 'makefiles/Makefile.top') 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 -- cgit v1.2.3