diff -r 541af5ee3ed9 -r 31ef8a13d4f4 sbsv2/raptor/lib/flm/resource.mk --- a/sbsv2/raptor/lib/flm/resource.mk Wed Aug 18 17:23:33 2010 +0300 +++ b/sbsv2/raptor/lib/flm/resource.mk Thu Aug 26 13:41:01 2010 +0100 @@ -31,7 +31,7 @@ $3: $(SOURCE) $(call startrule,resourcedependencies,FORCESUCCESS) \ - $(GNUCPP) -DLANGUAGE_$(3) -DLANGUAGE_$(subst sc,SC,$2) $(call makemacrodef,-D,$(MMPDEFS))\ + $(GNUCPP) -DLANGUAGE_$(2) -DLANGUAGE_$(subst sc,SC,$2) $(call makemacrodef,-D,$(MMPDEFS))\ $(CPPOPT) $(SOURCE) -M -MG -MT"$1" | \ $$(DEPENDENCY_CORRECTOR) >$3 \ $(call endrule,resourcedependencies) @@ -43,33 +43,15 @@ endef # resource.deps # ############################################################################### -# $1 is the name of the intermediate RESOURCEFILE -# $2 is the LANGUAGE (eg. sc or 01 or 02 ...) -# Uses $(RESOURCEHEADER),$(SOURCE),$(HEADLANG),$(MMPDEFS) apart from some tools -define resource.build - $(if $(FLMDEBUG),$$(info resource.build: $1 LANG:$2 )) +# Must be a separate macro since we +define resource.decideheader DOHEADER:= ifeq ($(HEADLANG),$2) ifneq ($(RESOURCEHEADER),) RESOURCE:: $(RESOURCEHEADER) DOHEADER:=-h$(RESOURCEHEADER) - # strictly speaking if $1 is made then the header file should be there too - # but suppose someone adds a header statement to their MMP after doing a build? - # so here we recreate the resource header if its missing even if the intermediate resource - # has actually been built. The problem is: what if the rpp file is not there (oops)? - # So this is not perfect but I think that the situation is fairly unlikely. - # We can afford to put in an if statement for the rsg file - it's not a race condition because - # $1 is done and the build engine guarantees that it's there so no resource header - # can be attempted while we're trying to test. - $(RESOURCEHEADER) : $1 - $(call startrule,resourcecompile.headerfill,FORCESUCCESS) \ - if [ ! -f "$(RESOURCEHEADER)" ]; then $(GNUCPP) -DLANGUAGE_$2 \ - -DLANGUAGE_$(subst sc,SC,$(2)) $(call makemacrodef,-D,$(MMPDEFS))\ - $(CPPOPT) $(SOURCE) -o $1.rpp; fi && \ - if [ ! -f "$(RESOURCEHEADER)" ]; then $(RCOMP) -m045,046,047 -u -h$$@ -s$1.rpp; fi \ - $(call endrule,resourcecompile.headerfill) # we will add the resourceheader to RELEASABLES globally endif @@ -79,16 +61,44 @@ # "leader" for this resource $1: $(PRIMARYFILE) endif +endef + +# $1 is the name of the intermediate RESOURCEFILE +# $2 is the LANGUAGE (eg. sc or 01 or 02 ...) +# Uses $(RESOURCEHEADER),$(SOURCE),$(HEADLANG),$(MMPDEFS) apart from some tools +define resource.build + $(if $(FLMDEBUG),$$(info resource.build: $1 LANG:$2 )) + + $(eval $(resource.decideheader)) + + ifneq ($(DOHEADER),) + # Strictly speaking if $1 is made then the header file should be there too + # but suppose someone adds a header statement to their MMP after doing a build? + # so here we recreate the resource header if its missing even if the intermediate resource + # has actually been built. The problem is: what if the rpp file is not there (oops)? + # So this is not perfect but I think that the situation is fairly unlikely. + # We can afford to put in an if statement for the rsg file - it's not a race condition because + # $1 is done and the build engine guarantees that it's there so no resource header + # can be attempted while we're trying to test. + $(RESOURCEHEADER) : $1 + $(call startrule,resourcecompile.headerfill,FORCESUCCESS) \ + if [ ! -f "$(RESOURCEHEADER)" ]; then $(GNUCPP) -DLANGUAGE_$2 \ + -DLANGUAGE_$(subst sc,SC,$(2)) $(call makemacrodef,-D,$(MMPDEFS))\ + $(CPPOPT) $(SOURCE) -o $1.rpp; fi && \ + if [ ! -f "$(RESOURCEHEADER)" ]; then $(RCOMP) -m045,046,047 -u -h$$@ -s$1.rpp; fi \ + $(call endrule,resourcecompile.headerfill) + endif - RESOURCE:: $1 - $1: $(SOURCE) - $(call startrule,resourcecompile,FORCESUCCESS) \ - $(GNUCPP) -DLANGUAGE_$2 -DLANGUAGE_$(subst sc,SC,$(2)) $(call makemacrodef,-D,$(MMPDEFS))\ - $(CPPOPT) $(SOURCE) -o $1.rpp && \ - $(RCOMP) -m045,046,047 -u $$(DOHEADER) -o$$@ -s$1.rpp \ - $(call endrule,resourcecompile) + RESOURCE:: $1 + + $1: $(SOURCE) + $(call startrule,resourcecompile,FORCESUCCESS) \ + $(GNUCPP) -DLANGUAGE_$2 -DLANGUAGE_$(subst sc,SC,$(2)) $(call makemacrodef,-D,$(MMPDEFS))\ + $(CPPOPT) $(SOURCE) -o $1.rpp && \ + $(RCOMP) -m045,046,047 -u $(DOHEADER) -o$$@ -s$1.rpp \ + $(call endrule,resourcecompile) SOURCETARGET_$(call sanitise,$(SOURCE)): $1 CLEANTARGETS:=$$(CLEANTARGETS) $1 $1.rpp