diff options
author | Luboš Luňák <l.lunak@collabora.com> | 2021-07-16 18:39:17 +0200 |
---|---|---|
committer | Luboš Luňák <l.lunak@collabora.com> | 2021-07-26 13:32:16 +0200 |
commit | 2fb06e18ae6fcf4813d98aa3fda0bcd1c9b9a7d0 (patch) | |
tree | 767a89c9c0f19fc68a91c695c42f565845e670aa | |
parent | 57ee7deddd0934dab58199cb1d0b95439e2ba6b3 (diff) |
add gbuild support for ObjC/C++ sources from tarballs
Change-Id: I49632bf9dedf9603449fb5bc9e6a819586258b05
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119355
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
-rw-r--r-- | solenv/bin/concat-deps.c | 10 | ||||
-rw-r--r-- | solenv/gbuild/Executable.mk | 2 | ||||
-rw-r--r-- | solenv/gbuild/Library.mk | 2 | ||||
-rw-r--r-- | solenv/gbuild/LinkTarget.mk | 136 | ||||
-rw-r--r-- | solenv/gbuild/StaticLibrary.mk | 2 | ||||
-rw-r--r-- | solenv/gbuild/TargetLocations.mk | 6 |
6 files changed, 155 insertions, 3 deletions
diff --git a/solenv/bin/concat-deps.c b/solenv/bin/concat-deps.c index 155328bf9360..9cd6b63c4374 100644 --- a/solenv/bin/concat-deps.c +++ b/solenv/bin/concat-deps.c @@ -1076,6 +1076,16 @@ static int process(struct hash* dep_hash, char* fn) created_line = generate_phony_line(src_relative, "o"); rc = generate_phony_file(fn, created_line); } + else if(strncmp(src_relative, "GenObjCxxObject/", 16) == 0) + { + created_line = generate_phony_line(src_relative, "o"); + rc = generate_phony_file(fn, created_line); + } + else if(strncmp(src_relative, "GenObjCObject/", 14) == 0) + { + created_line = generate_phony_line(src_relative, "o"); + rc = generate_phony_file(fn, created_line); + } else if(strncmp(src_relative, "CxxClrObject/", 13) == 0) { created_line = generate_phony_line(src_relative, "o"); diff --git a/solenv/gbuild/Executable.mk b/solenv/gbuild/Executable.mk index 70879bb9eb8c..ef393cb33949 100644 --- a/solenv/gbuild/Executable.mk +++ b/solenv/gbuild/Executable.mk @@ -111,6 +111,8 @@ gb_Executable_add_scanners = $(call gb_Executable__forward_to_Linktarget,$(0),$( gb_Executable_add_exception_objects = $(call gb_Executable__forward_to_Linktarget,$(0),$(1),$(2),$(3)) gb_Executable_add_generated_cobjects = $(call gb_Executable__forward_to_Linktarget,$(0),$(1),$(2),$(3)) gb_Executable_add_generated_exception_objects = $(call gb_Executable__forward_to_Linktarget,$(0),$(1),$(2),$(3)) +gb_Executable_add_generated_objcobjects = $(call gb_Executable__forward_to_Linktarget,$(0),$(1),$(2),$(3)) +gb_Executable_add_generated_objcxxobjects = $(call gb_Executable__forward_to_Linktarget,$(0),$(1),$(2),$(3)) gb_Executable_add_cflags = $(call gb_Executable__forward_to_Linktarget,$(0),$(1),$(2),$(3)) gb_Executable_add_cxxflags = $(call gb_Executable__forward_to_Linktarget,$(0),$(1),$(2),$(3)) gb_Executable_add_objcflags = $(call gb_Executable__forward_to_Linktarget,$(0),$(1),$(2),$(3)) diff --git a/solenv/gbuild/Library.mk b/solenv/gbuild/Library.mk index f8a08f915d35..a4f1fe7b376a 100644 --- a/solenv/gbuild/Library.mk +++ b/solenv/gbuild/Library.mk @@ -199,6 +199,8 @@ gb_Library_add_exception_objects = $(call gb_Library__forward_to_Linktarget,$(0) gb_Library_add_x64_generated_exception_objects = $(call gb_Library__forward_to_Linktarget,$(0),$(1),$(2),$(3)) gb_Library_add_generated_cobjects = $(call gb_Library__forward_to_Linktarget,$(0),$(1),$(2),$(3)) gb_Library_add_generated_exception_objects = $(call gb_Library__forward_to_Linktarget,$(0),$(1),$(2),$(3)) +gb_Library_add_generated_objcobjects = $(call gb_Library__forward_to_Linktarget,$(0),$(1),$(2),$(3)) +gb_Library_add_generated_objcxxobjects = $(call gb_Library__forward_to_Linktarget,$(0),$(1),$(2),$(3)) gb_Library_use_library_objects = $(call gb_Library__forward_to_Linktarget,$(0),$(1),$(2),$(3)) gb_Library_add_grammar = $(call gb_Library__forward_to_Linktarget,$(0),$(1),$(2),$(3)) gb_Library_add_grammars = $(call gb_Library__forward_to_Linktarget,$(0),$(1),$(2),$(3)) diff --git a/solenv/gbuild/LinkTarget.mk b/solenv/gbuild/LinkTarget.mk index d9d6d07a1349..60be7cfb68cc 100644 --- a/solenv/gbuild/LinkTarget.mk +++ b/solenv/gbuild/LinkTarget.mk @@ -166,9 +166,9 @@ endef # Overview of dependencies and tasks of LinkTarget # # target task depends on -# LinkTarget linking AsmObject CObject CxxObject GenCObject GenCxxObject ObjCObject ObjCxxObject CxxClrObject GenCxxClrObject +# LinkTarget linking AsmObject CObject CxxObject GenCObject GenCxxObject ObjCObject ObjCxxObject GenObjCObject GenObjCxxObject CxxClrObject GenCxxClrObject # LinkTarget/headers -# LinkTarget/dep joined dep file AsmObject/dep CObject/dep CxxObject/dep GenCObject/dep GenCxxObject/dep ObjCObject/dep ObjCxxObject/dep CxxClrObject/dep GenCxxClrObject/dep +# LinkTarget/dep joined dep file AsmObject/dep CObject/dep CxxObject/dep GenCObject/dep GenCxxObject/dep ObjCObject/dep ObjCxxObject/dep GenObjCObject/dep GenObjCxxObject/dep CxxClrObject/dep GenCxxClrObject/dep # | LinkTarget/headers # LinkTarget/headers all headers available # including own generated @@ -181,6 +181,10 @@ endef # generated source # ObjCObject objective c compile | LinkTarget/headers # ObjCxxObject objective c++ compile | LinkTarget/headers +# GenObjCObject objective c compile from | LinkTarget/headers +# generated source +# GenObjCxxObject objective c++ compile from | LinkTarget/headers +# generated source # CxxClrObject C++ CLR compile | LinkTarget/headers # GenCxxClrObject C++ CLR compile from | LinkTarget/headers # generated source @@ -191,8 +195,10 @@ endef # CxxObject/dep dependencies that are populated upon compile # GenCObject/dep dependencies # GenCxxObject/dep dependencies -# ObjCObject/dep dependencies +# ObjCObject/dep dependencies # ObjCxxObject/dep dependencies +# GenObjCObject/dep dependencies +# GenObjCxxObject/dep dependencies # CxxClrObject/dep dependencies # GenCxxClrObject/dep dependencies # AsmObject/dep dependencies @@ -510,6 +516,54 @@ $(call gb_ObjCObject_get_dep_target,%) : endif +# GenObjCObject class + +gb_GenObjCObject_get_source = $(WORKDIR)/$(1).m + +$(call gb_GenObjCObject_get_target,%) : $(gb_FORCE_COMPILE_ALL_TARGET) + $(call gb_Output_announce,$*.m,$(true),OCC,3) + $(call gb_Trace_StartRange,$*.m,OCC) + test -f $(call gb_GenObjCObject_get_source,$*) || (echo "Missing generated source file $(call gb_GenObjCObject_get_source,$*)" && false) + $(call gb_CObject__command_pattern,$@,$(T_OBJCFLAGS) $(T_OBJCFLAGS_APPEND),$(call gb_GenObjCObject_get_source,$*),$(call gb_GenObjCObject_get_dep_target,$*),$(COMPILER_PLUGINS),$(T_SYMBOLS)) + $(call gb_Trace_EndRange,$*.m,OCC) + +ifeq ($(gb_FULLDEPS),$(true)) +$(dir $(call gb_GenObjCObject_get_dep_target,%)).dir : + $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@)) + +$(dir $(call gb_GenObjCObject_get_dep_target,%))%/.dir : + $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@)) + +$(call gb_GenObjCObject_get_dep_target,%) : + $(if $(wildcard $@),touch $@) + +endif + + +# GenObjCxxObject class + +gb_GenObjCxxObject_get_source = $(WORKDIR)/$(1).mm + +$(call gb_GenObjCxxObject_get_target,%) : $(gb_FORCE_COMPILE_ALL_TARGET) + $(call gb_Output_announce,$*.mm,$(true),OCX,3) + $(call gb_Trace_StartRange,$*.mm,OCX) + test -f $(call gb_GenObjCxxObject_get_source,$*) || (echo "Missing generated source file $(call gb_GenObjCxxObject_get_source,$*)" && false) + $(call gb_CObject__command_pattern,$@,$(T_OBJCXXFLAGS) $(T_OBJCXXFLAGS_APPEND),$(call gb_GenObjCxxObject_get_source,$*),$(call gb_GenObjCxxObject_get_dep_target,$*),$(COMPILER_PLUGINS),$(T_SYMBOLS)) + $(call gb_Trace_EndRange,$*.mm,OCX) + +ifeq ($(gb_FULLDEPS),$(true)) +$(dir $(call gb_GenObjCxxObject_get_dep_target,%)).dir : + $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@)) + +$(dir $(call gb_GenObjCxxObject_get_dep_target,%))%/.dir : + $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@)) + +$(call gb_GenObjCxxObject_get_dep_target,%) : + $(if $(wildcard $@),touch $@) + +endif + + # CxxClrObject class # @@ -592,6 +646,12 @@ $(WORKDIR)/Clean/LinkTarget/% : $(foreach object,$(GENCXXOBJECTS),$(call gb_GenCxxObject_get_target,$(object))) \ $(foreach object,$(GENCXXOBJECTS),$(call gb_GenCxxObject_get_dep_target,$(object))) \ $(foreach object,$(GENCXXOBJECTS),$(call gb_GenCxxObject_get_dwo_target,$(object))) \ + $(foreach object,$(GENOBJCOBJECTS),$(call gb_GenObjCObject_get_target,$(object))) \ + $(foreach object,$(GENOBJCOBJECTS),$(call gb_GenObjCObject_get_dep_target,$(object))) \ + $(foreach object,$(GENOBJCOBJECTS),$(call gb_GenObjCObject_get_dwo_target,$(object))) \ + $(foreach object,$(GENOBJCXXOBJECTS),$(call gb_GenObjCxxObject_get_target,$(object))) \ + $(foreach object,$(GENOBJCXXOBJECTS),$(call gb_GenObjCxxObject_get_dep_target,$(object))) \ + $(foreach object,$(GENOBJCXXOBJECTS),$(call gb_GenObjCxxObject_get_dwo_target,$(object))) \ $(foreach object,$(GENCXXCLROBJECTS),$(call gb_GenCxxClrObject_get_target,$(object))) \ $(foreach object,$(GENCXXCLROBJECTS),$(call gb_GenCxxClrObject_get_dep_target,$(object))) \ $(foreach object,$(GENCXXCLROBJECTS),$(call gb_GenCxxClrObject_get_dwo_target,$(object))) \ @@ -623,6 +683,8 @@ $(call gb_Helper_abbreviate_dirs,\ $(foreach object,$(ASMOBJECTS),$(call gb_AsmObject_get_dep_target,$(object)))\ $(foreach object,$(GENCOBJECTS),$(call gb_GenCObject_get_dep_target,$(object))) \ $(foreach object,$(GENCXXOBJECTS),$(call gb_GenCxxObject_get_dep_target,$(object))) \ + $(foreach object,$(GENOBJCOBJECTS),$(call gb_GenObjCObject_get_dep_target,$(object))) \ + $(foreach object,$(GENOBJCXXOBJECTS),$(call gb_GenObjCxxObject_get_dep_target,$(object))) \ $(foreach object,$(GENCXXCLROBJECTS),$(call gb_GenCxxClrObject_get_dep_target,$(object))) \ ) && \ $(call gb_Executable_get_command,concat-deps) $${RESPONSEFILE} > $(1)) && \ @@ -642,6 +704,8 @@ TEMPFILE=$(call var2file,$(shell $(gb_MKTEMP)),200,\ $(foreach object,$(ASMOBJECTS),$(call gb_AsmObject_get_target,$(object))) \ $(foreach object,$(GENCOBJECTS),$(call gb_GenCObject_get_target,$(object))) \ $(foreach object,$(GENCXXOBJECTS),$(call gb_GenCxxObject_get_target,$(object))) \ + $(foreach object,$(GENOBJCOBJECTS),$(call gb_GenObjCObject_get_target,$(object))) \ + $(foreach object,$(GENOBJCXXOBJECTS),$(call gb_GenObjCxxObject_get_target,$(object))) \ $(foreach object,$(GENCXXCLROBJECTS),$(call gb_GenCxxClrObject_get_target,$(object))) \ $(PCHOBJS) \ $(foreach extraobjectlist,$(EXTRAOBJECTLISTS),$(shell cat $(extraobjectlist)))) && \ @@ -788,6 +852,10 @@ $(call gb_LinkTarget_get_target,$(1)) : GENCOBJECTS := $(call gb_LinkTarget_get_clean_target,$(1)) \ $(call gb_LinkTarget_get_target,$(1)) : GENCXXOBJECTS := $(call gb_LinkTarget_get_clean_target,$(1)) \ +$(call gb_LinkTarget_get_target,$(1)) : GENOBJCOBJECTS := +$(call gb_LinkTarget_get_clean_target,$(1)) \ +$(call gb_LinkTarget_get_target,$(1)) : GENOBJCXXOBJECTS := +$(call gb_LinkTarget_get_clean_target,$(1)) \ $(call gb_LinkTarget_get_target,$(1)) : GENCXXCLROBJECTS := $(call gb_LinkTarget_get_target,$(1)) : T_CFLAGS := $$(gb_LinkTarget_CFLAGS) $(call gb_LinkTarget_get_target,$(1)) : T_CFLAGS_APPEND := @@ -849,6 +917,8 @@ $(call gb_LinkTarget_get_dep_target,$(1)) : CXXCLROBJECTS := $(call gb_LinkTarget_get_dep_target,$(1)) : ASMOBJECTS := $(call gb_LinkTarget_get_dep_target,$(1)) : GENCOBJECTS := $(call gb_LinkTarget_get_dep_target,$(1)) : GENCXXOBJECTS := +$(call gb_LinkTarget_get_dep_target,$(1)) : GENOBJCOBJECTS := +$(call gb_LinkTarget_get_dep_target,$(1)) : GENOBJCXXOBJECTS := $(call gb_LinkTarget_get_dep_target,$(1)) : GENCXXCLROBJECTS := $(call gb_LinkTarget_get_dep_target,$(1)) : YACCOBJECTS := endif @@ -1331,6 +1401,56 @@ define gb_LinkTarget_add_generated_cxx_object $(call gb_LinkTarget_add_generated_cxx_object_internal,$(1),$(2),$(3),$(4)) endef +# call gb_LinkTarget_add_generated_objc_object,linktarget,sourcefile,cflags,linktargetmakefilename +define gb_LinkTarget_add_generated_objc_object +$(call gb_LinkTarget_get_target,$(1)) : GENOBJCOBJECTS += $(2) +$(call gb_LinkTarget_get_clean_target,$(1)) : GENOBJCOBJECTS += $(2) + +$(call gb_LinkTarget_get_target,$(1)) : $(call gb_GenObjCObject_get_target,$(2)) +$(call gb_GenObjCObject_get_target,$(2)) : $(call gb_GenObjCObject_get_source,$(2)) +# Often gb_GenObjCObject_get_source does not have its own rule and is only a byproduct. +# That's why we need this order-only dependency on gb_Helper_MISCDUMMY +$(call gb_GenObjCObject_get_source,$(2)) : | $(gb_Helper_MISCDUMMY) +$(call gb_GenObjCObject_get_target,$(2)) : | $(call gb_LinkTarget_get_headers_target,$(1)) +$(call gb_GenObjCObject_get_target,$(2)) : WARNINGS_NOT_ERRORS := $(true) +$(call gb_GenObjCObject_get_target,$(2)) : T_OBJCFLAGS += $(call gb_LinkTarget__get_objcflags,$(4)) $(3) +$(call gb_GenObjCObject_get_target,$(2)) : \ + OBJECTOWNER := $(call gb_Object__owner,$(2),$(1)) + +ifeq ($(gb_FULLDEPS),$(true)) +$(call gb_LinkTarget_get_dep_target,$(1)) : GENOBJCOBJECTS += $(2) +$(call gb_LinkTarget_get_dep_target,$(1)) : $(call gb_GenObjCObject_get_dep_target,$(2)) +$(call gb_GenObjCObject_get_dep_target,$(2)) :| $(dir $(call gb_GenObjCObject_get_dep_target,$(2))).dir +$(call gb_GenObjCObject_get_target,$(2)) :| $(dir $(call gb_GenObjCObject_get_dep_target,$(2))).dir +endif + +endef + +# call gb_LinkTarget_add_generated_objcxx_object,linktarget,sourcefile,cflags,linktargetmakefilename +define gb_LinkTarget_add_generated_objcxx_object +$(call gb_LinkTarget_get_target,$(1)) : GENOBJCXXOBJECTS += $(2) +$(call gb_LinkTarget_get_clean_target,$(1)) : GENOBJCXXOBJECTS += $(2) + +$(call gb_LinkTarget_get_target,$(1)) : $(call gb_GenObjCxxObject_get_target,$(2)) +$(call gb_GenObjCxxObject_get_target,$(2)) : $(call gb_GenObjCxxObject_get_source,$(2)) +# Often gb_GenObjCxxObject_get_source does not have its own rule and is only a byproduct. +# That's why we need this order-only dependency on gb_Helper_MISCDUMMY +$(call gb_GenObjCxxObject_get_source,$(2)) : | $(gb_Helper_MISCDUMMY) +$(call gb_GenObjCxxObject_get_target,$(2)) : | $(call gb_LinkTarget_get_headers_target,$(1)) +$(call gb_GenObjCxxObject_get_target,$(2)) : WARNINGS_NOT_ERRORS := $(true) +$(call gb_GenObjCxxObject_get_target,$(2)) : T_OBJCXXFLAGS += $(call gb_LinkTarget__get_objcxxflags,$(4)) $(3) +$(call gb_GenObjCxxObject_get_target,$(2)) : \ + OBJECTOWNER := $(call gb_Object__owner,$(2),$(1)) + +ifeq ($(gb_FULLDEPS),$(true)) +$(call gb_LinkTarget_get_dep_target,$(1)) : GENOBJCXXOBJECTS += $(2) +$(call gb_LinkTarget_get_dep_target,$(1)) : $(call gb_GenObjCxxObject_get_dep_target,$(2)) +$(call gb_GenObjCxxObject_get_dep_target,$(2)) :| $(dir $(call gb_GenObjCxxObject_get_dep_target,$(2))).dir +$(call gb_GenObjCxxObject_get_target,$(2)) :| $(dir $(call gb_GenObjCxxObject_get_dep_target,$(2))).dir +endif + +endef + # call gb_LinkTarget_add_generated_cxxclrobject,linktarget,sourcefile,cxxclrflags,linktargetmakefilename define gb_LinkTarget_add_generated_cxxclrobject $(call gb_LinkTarget_get_target,$(1)) : GENCXXCLROBJECTS += $(2) @@ -1482,6 +1602,16 @@ define gb_LinkTarget_add_generated_exception_objects $(foreach obj,$(2),$(call gb_LinkTarget_add_generated_exception_object,$(1),$(obj),$(3),$(4))) endef +# call gb_LinkTarget_add_generated_objcobjects,linktarget,sourcefiles,cflags,linktargetmakefilename +define gb_LinkTarget_add_generated_objcobjects +$(foreach obj,$(2),$(call gb_LinkTarget_add_generated_objc_object,$(1),$(obj),$(3),$(4))) +endef + +# call gb_LinkTarget_add_generated_objcxxobjects,linktarget,sourcefiles,cflags,linktargetmakefilename +define gb_LinkTarget_add_generated_objcxxobjects +$(foreach obj,$(2),$(call gb_LinkTarget_add_generated_objcxx_object,$(1),$(obj),$(3),$(4))) +endef + # call gb_LinkTarget_add_generated_cxxclrobjects,linktarget,sourcefiles,cxxclrflags,linktargetmakefilename define gb_LinkTarget_add_generated_cxxclrobjects $(foreach obj,$(2),$(call gb_LinkTarget_add_generated_cxxclrobject,$(1),$(obj),$(3),$(4))) diff --git a/solenv/gbuild/StaticLibrary.mk b/solenv/gbuild/StaticLibrary.mk index ca11815b6d49..dd55f468fcca 100644 --- a/solenv/gbuild/StaticLibrary.mk +++ b/solenv/gbuild/StaticLibrary.mk @@ -86,6 +86,8 @@ gb_StaticLibrary_add_x64_generated_exception_objects = $(call gb_StaticLibrary__ gb_StaticLibrary_add_generated_cobjects = $(call gb_StaticLibrary__forward_to_Linktarget,$(0),$(1),$(2),$(3)) gb_StaticLibrary_add_x64_generated_cobjects = $(call gb_StaticLibrary__forward_to_Linktarget,$(0),$(1),$(2),$(3)) gb_StaticLibrary_add_generated_exception_objects = $(call gb_StaticLibrary__forward_to_Linktarget,$(0),$(1),$(2),$(3)) +gb_StaticLibrary_add_generated_objcobjects = $(call gb_StaticLibrary__forward_to_Linktarget,$(0),$(1),$(2),$(3)) +gb_StaticLibrary_add_generated_objcxxobjects = $(call gb_StaticLibrary__forward_to_Linktarget,$(0),$(1),$(2),$(3)) gb_StaticLibrary_add_cflags = $(call gb_StaticLibrary__forward_to_Linktarget,$(0),$(1),$(2),$(3)) gb_StaticLibrary_add_cxxflags = $(call gb_StaticLibrary__forward_to_Linktarget,$(0),$(1),$(2),$(3)) gb_StaticLibrary_add_objcflags = $(call gb_StaticLibrary__forward_to_Linktarget,$(0),$(1),$(2),$(3)) diff --git a/solenv/gbuild/TargetLocations.mk b/solenv/gbuild/TargetLocations.mk index 0df1cd2bb9d5..454c167cb318 100644 --- a/solenv/gbuild/TargetLocations.mk +++ b/solenv/gbuild/TargetLocations.mk @@ -138,6 +138,10 @@ gb_ObjCxxObject_get_target = $(WORKDIR)/ObjCxxObject/$(1).o gb_ObjCxxObject_get_dwo_target = $(WORKDIR)/ObjCxxObject/$(1).dwo gb_ObjCObject_get_target = $(WORKDIR)/ObjCObject/$(1).o gb_ObjCObject_get_dwo_target = $(WORKDIR)/ObjCObject/$(1).dwo +gb_GenObjCxxObject_get_target = $(WORKDIR)/GenObjCxxObject/$(1).o +gb_GenObjCxxObject_get_dwo_target = $(WORKDIR)/GenObjCxxObject/$(1).dwo +gb_GenObjCObject_get_target = $(WORKDIR)/GenObjCObject/$(1).o +gb_GenObjCObject_get_dwo_target = $(WORKDIR)/GenObjCObject/$(1).dwo gb_CxxClrObject_get_target = $(WORKDIR)/CxxClrObject/$(1).o gb_CxxClrObject_get_dwo_target = $(WORKDIR)/CxxClrObject/$(1).dwo gb_GenCxxClrObject_get_target = $(WORKDIR)/GenCxxClrObject/$(1).o @@ -325,6 +329,8 @@ $(eval $(call gb_Helper_make_dep_targets,\ AsmObject \ GenCObject \ GenCxxObject \ + GenObjCObject \ + GenObjCxxObject \ GenCxxClrObject \ SdiTarget \ )) |