diff options
author | Jan-Marek Glogowski <glogow@fbihome.de> | 2020-05-05 12:30:01 +0000 |
---|---|---|
committer | Jan-Marek Glogowski <glogow@fbihome.de> | 2020-05-05 12:30:01 +0000 |
commit | f9cb815e1ed96aab831de80c82210176287137f5 (patch) | |
tree | 60c7b3e9743f54ebc456fa2976a10d82e82cf0a4 | |
parent | a702a5e131fa833601f640e668ea8b5e0402a242 (diff) | |
download | nss-hg-f9cb815e1ed96aab831de80c82210176287137f5.tar.gz |
Bug 1629553 Use an eval template for C++ compile rules r=rrelyea
These pattern rules already had a comment to keep both in sync, so
just use an eval template to enforce this.
Differential Revision: https://phabricator.services.mozilla.com/D70985
-rw-r--r-- | coreconf/rules.mk | 41 |
1 files changed, 13 insertions, 28 deletions
diff --git a/coreconf/rules.mk b/coreconf/rules.mk index 4dc5e2b6e..dcbe4f07c 100644 --- a/coreconf/rules.mk +++ b/coreconf/rules.mk @@ -436,44 +436,29 @@ else endif endif -# -# Please keep the next two rules in sync. -# -$(OBJDIR)/$(PROG_PREFIX)%$(OBJ_SUFFIX): %.cc - $(MAKE_OBJDIR) -ifdef STRICT_CPLUSPLUS_SUFFIX - echo "#line 1 \"$<\"" | cat - $< > $(OBJDIR)/t_$*.cc - $(CCC) -o $@ -c $(CXXSTD) $(CFLAGS) $(CXXFLAGS) $(OBJDIR)/t_$*.cc - rm -f $(OBJDIR)/t_$*.cc -else -ifdef USE_NT_C_SYNTAX - $(CCC) -Fo$@ -c $(CXXSTD) $(CFLAGS) $(CXXFLAGS) $(call core_abspath,$<) -else -ifdef NEED_ABSOLUTE_PATH - $(CCC) -o $@ -c $(CXXSTD) $(CFLAGS) $(CXXFLAGS) $(call core_abspath,$<) -else - $(CCC) -o $@ -c $(CXXSTD) $(CFLAGS) $(CXXFLAGS) $< -endif -endif -endif #STRICT_CPLUSPLUS_SUFFIX +define compile_ccc_pattern_RULE -$(OBJDIR)/$(PROG_PREFIX)%$(OBJ_SUFFIX): %.cpp - @$(MAKE_OBJDIR) +$$(OBJDIR)/$$(PROG_PREFIX)%$$(OBJ_SUFFIX): %.$(1) + $$(MAKE_OBJDIR) ifdef STRICT_CPLUSPLUS_SUFFIX - echo "#line 1 \"$<\"" | cat - $< > $(OBJDIR)/t_$*.cc - $(CCC) -o $@ -c $(CXXSTD) $(CFLAGS) $(CXXFLAGS) $(OBJDIR)/t_$*.cc - rm -f $(OBJDIR)/t_$*.cc + echo "#line 1 \"$$<\"" | cat - $$< > $$(OBJDIR)/t_$$*.cc + $$(CCC) -o $$@ -c $$(CXXSTD) $$(CFLAGS) $$(CXXFLAGS) $$(OBJDIR)/t_$$*.cc + rm -f $$(OBJDIR)/t_$$*.cc else ifdef USE_NT_C_SYNTAX - $(CCC) -Fo$@ -c $(CXXSTD) $(CFLAGS) $(CXXFLAGS) $(call core_abspath,$<) + $$(CCC) -Fo$$@ -c $$(CXXSTD) $$(CFLAGS) $$(CXXFLAGS) $$(call core_abspath,$$<) else ifdef NEED_ABSOLUTE_PATH - $(CCC) -o $@ -c $(CXXSTD) $(CFLAGS) $(CXXFLAGS) $(call core_abspath,$<) + $$(CCC) -o $$@ -c $$(CXXSTD) $$(CFLAGS) $$(CXXFLAGS) $$(call core_abspath,$$<) else - $(CCC) -o $@ -c $(CXXSTD) $(CFLAGS) $(CXXFLAGS) $< + $$(CCC) -o $$@ -c $$(CXXSTD) $$(CFLAGS) $$(CXXFLAGS) $$< endif endif endif #STRICT_CPLUSPLUS_SUFFIX +endef # compile_ccc_pattern_RULE + +$(eval $(call compile_ccc_pattern_RULE,cc)) +$(eval $(call compile_ccc_pattern_RULE,cpp)) %.i: %.cpp $(CCC) -C -E $(CFLAGS) $(CXXFLAGS) $< > $@ |