diff options
author | David Tardon <dtardon@redhat.com> | 2011-08-22 08:42:36 +0200 |
---|---|---|
committer | David Tardon <dtardon@redhat.com> | 2011-08-22 08:49:42 +0200 |
commit | d1137471298ba3fe1ac581ac1ddc4aa2c614296b (patch) | |
tree | a5686fb3145f8d86b8402f0572e786d92918674b /solenv | |
parent | 180ffa7c8505ac03a2637a995f1b7f12c8ef2202 (diff) |
overhaul impl. of gb_LinkTarget_add_grammar to simplify usage
Diffstat (limited to 'solenv')
-rw-r--r-- | solenv/gbuild/Library.mk | 2 | ||||
-rw-r--r-- | solenv/gbuild/LinkTarget.mk | 56 | ||||
-rw-r--r-- | solenv/gbuild/TargetLocations.mk | 6 |
3 files changed, 39 insertions, 25 deletions
diff --git a/solenv/gbuild/Library.mk b/solenv/gbuild/Library.mk index 022e82a7705e..798af8b5854b 100644 --- a/solenv/gbuild/Library.mk +++ b/solenv/gbuild/Library.mk @@ -120,6 +120,8 @@ $(eval $(foreach method,\ add_generated_cobjects \ add_generated_cxxobjects \ add_generated_exception_objects \ + add_grammar \ + add_grammars \ add_cflags \ set_cflags \ add_cxxflags \ diff --git a/solenv/gbuild/LinkTarget.mk b/solenv/gbuild/LinkTarget.mk index 7e626e370402..990f4bedede6 100644 --- a/solenv/gbuild/LinkTarget.mk +++ b/solenv/gbuild/LinkTarget.mk @@ -224,7 +224,22 @@ endif gb_GenCxxObject_GenCxxObject = # YaccObject class -gb_YaccObject_get_grammar = $(1)/$(2).y +gb_YaccObject_get_source = $(1)/$(2).y + +.PHONY : $(call gb_YaccObject_get_clean_target,%) +$(call gb_YaccObject_get_clean_target,%) : + $(call gb_Output_announce,$(2),$(false),YAC,3) + $(call gb_Helper_abbreviate_dirs,\ + rm -f $(call gb_YaccObject_get_header_target,$*) $(call gb_YaccObject__get_generated_source,$*)) + +gb_YaccObject__get_generated_source = $(WORKDIR)/$(1).cxx + +define gb_YaccObject_YaccObject +$(call gb_YaccObject_get_target,$(1)) : $(call gb_YaccObject__get_generated_source,$(1)) $(call gb_YaccObject_get_header_target,$(1)) +$(call gb_YaccObject_get_header_target,$(1)) :| $(call gb_YaccObject__get_generated_source,$(1)) +$(call gb_YaccObject__get_generated_source,$(1)) : $(call gb_YaccObject_get_source,$(gb_REPOS),$(1)) + $$(call gb_YaccObject__command,$(call gb_YaccObject_get_source,$(gb_REPOS),$(1)),$(1),$(call gb_YaccObject__get_generated_source,$(1)),$(call gb_YaccObject_get_header_target,$(1))) +endef gb_YACC := bison @@ -871,28 +886,31 @@ endif endef define gb_LinkTarget_yacc_add_cpp_dep -$(call gb_CxxObject_get_target,$(2)) : $(call gb_YaccObject_get_target_source,$(1)) +$(call gb_CxxObject_get_target,$(2)) : $(call gb_YaccObject_get_target,$(1)) endef -### -# Add a bison grammars to the build. -# gb_LinkTarget_add_grammar(<component>,<grammar file>,<YYFLAGS>,<additional CXXFLAGS>,<list of objects that depend on the generated header> -# +# Add a bison grammar to the build. +# gb_LinkTarget_add_grammar(<component>,<grammar file>) define gb_LinkTarget_add_grammar - +$(call gb_YaccObject_YaccObject,$(2)) +$(call gb_LinkTarget_get_target,$(1)) : $(call gb_YaccObject_get_target,$(2)) +$(call gb_LinkTarget_get_clean_target,$(1)) : $(call gb_YaccObject_get_clean_target,$(2)) $(call gb_LinkTarget_get_target,$(1)) : GENCXXOBJECTS += $(2) $(call gb_LinkTarget_get_clean_target,$(1)) : GENCXXOBJECTS += $(2) -$(foreach obj,$(3), -$(call gb_LinkTarget_yacc_add_cpp_dep,$(2),$(obj))) +ifeq ($(gb_FULLDEPS),$(true)) +$(call gb_LinkTarget_get_dep_target,$(1)) : GENCXXOBJECTS += $(2) +$(call gb_LinkTarget_get_dep_target,$(1)) : $(call gb_YaccObject_get_dep_target,$(2)) +endif + +$(call gb_LinkTarget__add_internal_headers,$(1),$(gb_YaccObject_get_header_target,$(2))) -$(call gb_GenCxxObject_get_target,$(2)) : $(call gb_YaccObject_get_target_source,$(2)) - $$(call gb_CxxObject__command,$$@,$(2),$$<,$$(call gb_GenCxxObject_get_dep_target,$(2))) +endef -$(call gb_LinkTarget_get_target,$(1)) : $(call gb_GenCxxObject_get_target,$(2)) -$(call gb_GenCxxObject_get_target,$(2)) : $(call gb_YaccObject_get_target_source,$(2)) $(call gb_YaccObject_get_target_include,$(2)) -$(call gb_YaccObject_get_target_source,$(2)) $(call gb_YaccObject_get_target_include,$(2)) : $(call gb_YaccObject_get_grammar,$(gb_REPOS),$(2)) - $$(call gb_YaccObject__command,$(call gb_YaccObject_get_grammar,$(gb_REPOS),$(2)),$(2),$(call gb_YaccObject_get_target_source,$(2)),$(call gb_YaccObject_get_target_include,$(2))) +# Add bison grammars to the build. +# gb_LinkTarget_add_grammars(<component>,<grammar file> [<grammar file>*]) +define gb_LinkTarget_add_grammars +$(foreach grammar,$(2),$(call gb_LinkTarget_add_grammar,$(1),$(grammar))) endef define gb_LinkTarget_add_noexception_object @@ -967,14 +985,6 @@ define gb_LinkTarget_add_generated_exception_objects $(foreach obj,$(2),$(call gb_LinkTarget_add_generated_exception_object,$(1),$(obj))) endef -### -# Add a bison grammars to the build. -# gb_LinkTarget_add_grammar(<component>,<list of grammar files>,<list of objects that depend on the generated header> -# -define gb_LinkTarget_add_grammars -$(foreach obj,$(2),$(call gb_LinkTarget_add_grammar,$(1),$(obj),$(3))) -endef - define gb_LinkTarget_set_targettype $(call gb_LinkTarget_get_target,$(1)) \ $(call gb_LinkTarget_get_dep_target,$(1)) : TARGETTYPE := $(2) diff --git a/solenv/gbuild/TargetLocations.mk b/solenv/gbuild/TargetLocations.mk index 196405e4825e..a740cb9ccb5f 100644 --- a/solenv/gbuild/TargetLocations.mk +++ b/solenv/gbuild/TargetLocations.mk @@ -76,8 +76,6 @@ gb_CustomTarget_get_target = $(WORKDIR)/CustomTarget/$(1).done gb_CustomTarget_get_workdir = $(WORKDIR)/CustomTarget/$(1) gb_CxxObject_get_target = $(WORKDIR)/CxxObject/$(1).o gb_GenCxxObject_get_target = $(WORKDIR)/GenCxxObject/$(1).o -gb_YaccObject_get_target_source = $(WORKDIR)/GenCxxObject/$(1).cxx -gb_YaccObject_get_target_include = $(WORKDIR)/GenCxxObject/$(1).hxx gb_Executable_get_external_headers_target = $(WORKDIR)/ExternalHeaders/Executable/$(1) gb_Executable_get_headers_target = $(WORKDIR)/Headers/Executable/$(1) gb_Jar_get_target = $(WORKDIR)/Jar/$(1).jar @@ -119,6 +117,9 @@ gb_UnoApiTarget_get_header_target = $(WORKDIR)/UnoApiHeaders/$(1) gb_WinResTarget_get_target = $(WORKDIR)/WinResTarget/$(1)$(gb_WinResTarget_POSTFIX) # workdir targets: $(1) is prefix/path gb_Configuration_get_target = $(WORKDIR)/Configuration/$(1).done +gb_YaccObject_get_header_target = $(WORKDIR)/$(1).hxx +gb_YaccObject_get_dep_target = $(call gb_GenCxxObject_get_dep_target,$(1)) +gb_YaccObject_get_target = $(call gb_GenCxxObject_get_target,$(1)) gb_XcsTarget_get_target = $(WORKDIR)/XcsTarget/$(1) gb_XcuDataTarget_get_target = $(WORKDIR)/XcuDataTarget/$(1) gb_XcuLangpackTarget_get_target = $(WORKDIR)/XcuLangpackTarget/$(1) @@ -165,6 +166,7 @@ $(eval $(call gb_Helper_make_clean_targets,\ CustomTarget \ UnoApiTarget \ WinResTarget \ + YaccObject \ Zip \ XcsTarget \ XcuDataTarget \ |