From f414217c6dad50030cd672a2e070a976cb7f66ab Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Wed, 25 Mar 2009 23:13:59 +0000 Subject: Guard against multiply defining processing rules. svn path=/trunk/tools/buildsystem/; revision=6886 --- makefiles/Makefile.top | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) (limited to 'makefiles/Makefile.top') diff --git a/makefiles/Makefile.top b/makefiles/Makefile.top index 0bc48fe..1acf49e 100644 --- a/makefiles/Makefile.top +++ b/makefiles/Makefile.top @@ -284,42 +284,55 @@ endif ############################################################################### DEPFILES := +BUILDFILES := ifeq ($(CC_CAN_BUILD_AND_DEP),yes) # C compiler can compile and dep simultaneously define dep_c - $$(BUILDDIR)/$2: $$(BUILDDIR)/stamp $1 + ifeq ($$(findstring $$(BUILDDIR)/$2,$$(DEPFILES)),) + $$(BUILDDIR)/$2: $$(BUILDDIR)/stamp $1 - DEPFILES += $$(BUILDDIR)/$2 + DEPFILES += $$(BUILDDIR)/$2 + endif endef define build_c - $$(BUILDDIR)/$2: $$(BUILDDIR)/stamp $1 + ifeq ($$(findstring $$(BUILDDIR)/$2,$$(BUILDFILES)),) + $$(BUILDDIR)/$2: $$(BUILDDIR)/stamp $1 $$(VQ)$$(ECHO) $$(ECHOFLAGS) " COMPILE: $1" $$(Q)$$(CC) -MMD -MP $$($3) -o $$@ -c $1 + BUILDFILES += $$(BUILDDIR)/$2 + endif + endef else # C compiler must calculate dependencies first, then compile (default) define dep_c - $$(BUILDDIR)/$2: $$(BUILDDIR)/stamp $1 + ifeq ($$(findstring $$(BUILDDIR)/$2,$$(DEPFILES)),) + $$(BUILDDIR)/$2: $$(BUILDDIR)/stamp $1 $$(VQ)$$(ECHO) $$(ECHOFLAGS) " DEP: $1" $$(Q)$$(RM) $$(RMFLAGS) $($@) $$(Q)$$(CC) $$($3) -MM $1 > $$@ $$(Q)$$(SED) $$(SEDFLAGS) -i 's,^.*:,$$@ $$(@:.d=.o):,' $$@ - DEPFILES += $$(BUILDDIR)/$2 + DEPFILES += $$(BUILDDIR)/$2 + endif endef define build_c - $$(BUILDDIR)/$2: $$(BUILDDIR)/stamp $1 + 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 endif -- cgit v1.2.3