Kaydet (Commit) d1137471 authored tarafından David Tardon's avatar David Tardon

overhaul impl. of gb_LinkTarget_add_grammar to simplify usage

üst 180ffa7c
......@@ -33,7 +33,7 @@ $(eval $(call gb_Executable_set_include,rsc,\
$$(INCLUDE) \
-I$(SRCDIR)/rsc/inc \
-I$(SRCDIR)/rsc/inc/pch \
-I$(WORKDIR)/GenCxxObject/rsc/source/parser \
-I$(WORKDIR)/rsc/source/parser \
))
$(eval $(call gb_Executable_add_api,rsc,\
......@@ -54,11 +54,7 @@ $(eval $(call gb_Executable_add_linked_libs,rsc,\
))
$(eval $(call gb_Executable_add_grammars,rsc,\
rsc/source/parser/rscyacc, \
rsc/source/parser/rscibas \
rsc/source/parser/rscicpx \
rsc/source/parser/rscinit \
rsc/source/parser/rsclex \
rsc/source/parser/rscyacc \
))
$(eval $(call gb_Executable_add_exception_objects,rsc,\
......
......@@ -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 \
......
......@@ -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)
......
......@@ -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 \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment