[Libreoffice-commits] .: solenv/gbuild

Norbert Thiebaud nthiebaud at kemper.freedesktop.org
Sat Apr 23 08:36:34 PDT 2011


 solenv/gbuild/CppunitTest.mk     |    3 +
 solenv/gbuild/Executable.mk      |    3 +
 solenv/gbuild/Library.mk         |    3 +
 solenv/gbuild/LinkTarget.mk      |   95 ++++++++++++++++++++++++++++++++++++---
 solenv/gbuild/TargetLocations.mk |    2 
 solenv/gbuild/platform/macosx.mk |   23 +++++++++
 6 files changed, 123 insertions(+), 6 deletions(-)

New commits:
commit 4e8371c559d9cf677a1bc7e6a34161c5df4e2365
Author: Norbert Thiebaud <nthiebaud at gmail.com>
Date:   Sat Apr 23 10:35:37 2011 -0500

    add support, in gbuild, for objective/C (in addition to objective/C++)

diff --git a/solenv/gbuild/CppunitTest.mk b/solenv/gbuild/CppunitTest.mk
index 5613226..22b4dc2 100644
--- a/solenv/gbuild/CppunitTest.mk
+++ b/solenv/gbuild/CppunitTest.mk
@@ -104,6 +104,8 @@ $(eval $(foreach method,\
 	add_linked_libs \
 	add_linked_static_libs \
 	add_noexception_objects \
+	add_objcobject \
+	add_objcobjects \
 	add_objcxxobject \
 	add_objcxxobjects \
 	add_package_headers \
@@ -115,6 +117,7 @@ $(eval $(foreach method,\
 	set_include \
 	set_ldflags \
 	set_library_path_flags \
+	set_objcflags \
 	set_objcxxflags \
 ,\
 	$(call gb_CppunitTest__forward_to_Linktarget,$(method))\
diff --git a/solenv/gbuild/Executable.mk b/solenv/gbuild/Executable.mk
index 88b98ac..bd3eb7d 100644
--- a/solenv/gbuild/Executable.mk
+++ b/solenv/gbuild/Executable.mk
@@ -67,6 +67,8 @@ $(eval $(foreach method,\
 	add_cobjects \
 	add_cxxobject \
 	add_cxxobjects \
+	add_objcobject \
+	add_objcobjects \
 	add_objcxxobject \
 	add_objcxxobjects \
 	add_exception_objects \
@@ -75,6 +77,7 @@ $(eval $(foreach method,\
 	add_generated_exception_objects \
 	set_cflags \
 	set_cxxflags \
+	set_objcflags \
 	set_objcxxflags \
 	set_defs \
 	set_include \
diff --git a/solenv/gbuild/Library.mk b/solenv/gbuild/Library.mk
index 7d386ff..47640bd 100644
--- a/solenv/gbuild/Library.mk
+++ b/solenv/gbuild/Library.mk
@@ -108,6 +108,8 @@ $(eval $(foreach method,\
 	add_cobjects \
 	add_cxxobject \
 	add_cxxobjects \
+	add_objcobject \
+	add_objcobjects \
 	add_objcxxobject \
 	add_objcxxobjects \
 	add_exception_objects \
@@ -116,6 +118,7 @@ $(eval $(foreach method,\
 	add_generated_exception_objects \
 	set_cflags \
 	set_cxxflags \
+	set_objcflags \
 	set_objcxxflags \
 	set_defs \
 	set_include \
diff --git a/solenv/gbuild/LinkTarget.mk b/solenv/gbuild/LinkTarget.mk
index 45df7b2..dfbbb91 100644
--- a/solenv/gbuild/LinkTarget.mk
+++ b/solenv/gbuild/LinkTarget.mk
@@ -29,9 +29,9 @@
 # Overview of dependencies and tasks of LinkTarget
 #
 # target                      task                         depends on
-# LinkTarget                  linking                      CObject CxxObject GenCxxObject ObjCxxObject
+# LinkTarget                  linking                      CObject CxxObject GenCxxObject ObjCObject ObjCxxObject
 #                                                          LinkTarget/headers
-# LinkTarget/dep              joined dep file              CObject/dep CxxObject/dep GenCxxObject/dep ObjCxxObject/dep
+# LinkTarget/dep              joined dep file              CObject/dep CxxObject/dep GenCxxObject/dep ObjCObject/dep ObjCxxObject/dep
 #                                                          | LinkTarget/headers
 # LinkTarget/headers          all headers available        LinkTarget/external_headers PCH
 #                              including own generated     own generated headers
@@ -42,11 +42,13 @@
 # CxxObject                   c++ compile                  | LinkTarget/headers
 # GenCxxObject                C++ compile from             | LinkTarget/headers
 #                              generated source
+# ObjCObject                  objective c compile          | LinkTarget/headers
 # ObjCxxObject                objective c++ compile        | LinkTarget/headers
 #
-# CObject/dep                 dependencies                 these targets generate empty dep files 
+# CObject/dep                 dependencies                 these targets generate empty dep files
 # CxxObject/dep               dependencies                 that are populated upon compile
 # GenCxxObject/dep            dependencies
+# ObjCObject/dep            dependencies
 # ObjCxxObject/dep            dependencies
 
 # LinkTarget/headers means gb_LinkTarget_get_headers_target etc.
@@ -235,6 +237,46 @@ endif
 
 gb_ObjCxxObject_ObjCxxObject =
 
+# ObjCObject class
+#
+gb_ObjCObject_REPOS := $(gb_REPOS)
+
+gb_ObjCObject_get_source = $(1)/$(2).m
+# defined by platform
+#  gb_ObjCObject__command
+
+# this rule generates an "always rebuild" dep file, to have something to include.
+# the dep file will be overridden on the fly, when the object is compiled
+ifeq ($(gb_FULLDEPS),$(true))
+define gb_ObjCObject__command_dep
+mkdir -p $(dir $(1)) && \
+	echo '$(call gb_ObjCObject_get_target,$(2)) : $$(gb_Helper_PHONY)' > $(1)
+
+endef
+else
+gb_ObjCObject__command_dep =
+endif
+
+define gb_ObjCObject__rules
+$$(call gb_ObjCObject_get_target,%) : $$(call gb_ObjCObject_get_source,$(1),%)
+	$$(call gb_ObjCObject__command,$$@,$$*,$$<,$$(DEFS),$$(OBJCFLAGS),$$(INCLUDE_STL) $$(INCLUDE))
+
+ifeq ($(gb_FULLDEPS),$(true))
+$$(call gb_ObjCObject_get_dep_target,%) : $$(call gb_ObjCObject_get_source,$(1),%)
+	$$(call gb_ObjCObject__command_dep,$$@,$$*,$$<,$$(DEFS),$$(OBJCFLAGS),$$(INCLUDE_STL) $$(INCLUDE))
+endif
+
+endef
+
+$(foreach repo,$(gb_ObjCObject_REPOS),$(eval $(call gb_ObjCObject__rules,$(repo))))
+
+ifeq ($(gb_FULLDEPS),$(true))
+$(call gb_ObjCObject_get_dep_target,%) :
+	$(eval $(call gb_Output_error,Unable to find Objective C++ file $(call gb_ObjCObject_get_source,,$*) in repositories: $(gb_ObjCObject_REPOS)))
+endif
+
+gb_ObjCObject_ObjCObject =
+
 
 
 # LinkTarget class
@@ -257,6 +299,8 @@ $(call gb_LinkTarget_get_clean_target,%) :
 		$(foreach object,$(COBJECTS),$(call gb_CObject_get_dep_target,$(object))) \
 		$(foreach object,$(CXXOBJECTS),$(call gb_CxxObject_get_target,$(object))) \
 		$(foreach object,$(CXXOBJECTS),$(call gb_CxxObject_get_dep_target,$(object))) \
+		$(foreach object,$(OBJCOBJECTS),$(call gb_ObjCObject_get_target,$(object))) \
+		$(foreach object,$(OBJCOBJECTS),$(call gb_ObjCObject_get_dep_target,$(object))) \
 		$(foreach object,$(OBJCXXOBJECTS),$(call gb_ObjCxxObject_get_target,$(object))) \
 		$(foreach object,$(OBJCXXOBJECTS),$(call gb_ObjCxxObject_get_dep_target,$(object))) \
 		$(foreach object,$(GENCXXOBJECTS),$(call gb_GenCxxObject_get_target,$(object))) \
@@ -280,8 +324,9 @@ $(call gb_Helper_abbreviate_dirs,\
 	RESPONSEFILE=$(call var2file,$(shell $(gb_MKTEMP)),200,\
 		$(foreach object,$(3),$(call gb_CObject_get_dep_target,$(object))) \
 		$(foreach object,$(4),$(call gb_CxxObject_get_dep_target,$(object))) \
-		$(foreach object,$(5),$(call gb_ObjCxxObject_get_dep_target,$(object)))\
-		 $(foreach object,$(6),$(call gb_GenCxxObject_get_dep_target,$(object)))\
+		$(foreach object,$(5),$(call gb_ObjCObject_get_dep_target,$(object)))\
+		$(foreach object,$(6),$(call gb_ObjCxxObject_get_dep_target,$(object)))\
+		 $(foreach object,$(7),$(call gb_GenCxxObject_get_dep_target,$(object)))\
 		) && \
 	cat $${RESPONSEFILE} /dev/null | xargs -n 200 cat > $(1)) && \
 	rm -f $${RESPONSEFILE}
@@ -292,6 +337,7 @@ define gb_LinkTarget__command_objectlist
 TEMPFILE=$(call var2file,$(shell $(gb_MKTEMP)),200,\
 	$(foreach object,$(COBJECTS),$(call gb_CObject_get_target,$(object))) \
 	$(foreach object,$(CXXOBJECTS),$(call gb_CxxObject_get_target,$(object))) \
+	$(foreach object,$(OBJCOBJECTS),$(call gb_ObjCObject_get_target,$(object))) \
 	$(foreach object,$(OBJCXXOBJECTS),$(call gb_ObjCxxObject_get_target,$(object))) \
 	$(foreach object,$(GENCXXOBJECTS),$(call gb_GenCxxObject_get_target,$(object)))) && \
 $(if $(EXTRAOBJECTLISTS),cat $(EXTRAOBJECTLISTS) >> $${TEMPFILE} && ) \
@@ -306,7 +352,7 @@ $(call gb_LinkTarget_get_target,%) : $(call gb_LinkTarget_get_headers_target,%)
 ifeq ($(gb_FULLDEPS),$(true))
 $(call gb_LinkTarget_get_target,%) : $(call gb_LinkTarget_get_dep_target,%)
 $(call gb_LinkTarget_get_dep_target,%) : | $(call gb_LinkTarget_get_headers_target,%)
-	$(call gb_LinkTarget__command_dep,$@,$*,$(COBJECTS),$(CXXOBJECTS),$(OBJCXXOBJECTS),$(GENCXXOBJECTS))
+	$(call gb_LinkTarget__command_dep,$@,$*,$(COBJECTS),$(CXXOBJECTS),$(OBJCOBJECTS),$(OBJCXXOBJECTS),$(GENCXXOBJECTS))
 endif
 
 # Ok, this is some dark voodoo: When declaring a linktarget with
@@ -376,6 +422,8 @@ $(call gb_LinkTarget_get_target,$(1)) : COBJECTS :=
 $(call gb_LinkTarget_get_clean_target,$(1)) \
 $(call gb_LinkTarget_get_target,$(1)) : CXXOBJECTS := 
 $(call gb_LinkTarget_get_clean_target,$(1)) \
+$(call gb_LinkTarget_get_target,$(1)) : OBJCOBJECTS :=
+$(call gb_LinkTarget_get_clean_target,$(1)) \
 $(call gb_LinkTarget_get_target,$(1)) : OBJCXXOBJECTS :=
 $(call gb_LinkTarget_get_clean_target,$(1)) \
 $(call gb_LinkTarget_get_target,$(1)) : GENCXXOBJECTS :=
@@ -385,6 +433,7 @@ $(call gb_LinkTarget_get_headers_target,$(1)) \
 $(call gb_LinkTarget_get_target,$(1)) : CXXFLAGS := $$(gb_LinkTarget_CXXFLAGS)
 $(call gb_LinkTarget_get_headers_target,$(1)) \
 $(call gb_LinkTarget_get_target,$(1)) : PCH_CXXFLAGS := $$(gb_LinkTarget_CXXFLAGS) $(gb_COMPILEROPTFLAGS)
+$(call gb_LinkTarget_get_target,$(1)) : OBJCFLAGS := $$(gb_LinkTarget_OBJCFLAGS)
 $(call gb_LinkTarget_get_target,$(1)) : OBJCXXFLAGS := $$(gb_LinkTarget_OBJCXXFLAGS)
 $(call gb_LinkTarget_get_headers_target,$(1)) \
 $(call gb_LinkTarget_get_target,$(1)) : DEFS := $$(gb_LinkTarget_DEFAULTDEFS)
@@ -413,12 +462,14 @@ $(firstword $(MAKEFILE_LIST)) : $(call gb_LinkTarget_get_dep_target,$(1))
 endif
 $(call gb_LinkTarget_get_dep_target,$(1)) : COBJECTS := 
 $(call gb_LinkTarget_get_dep_target,$(1)) : CXXOBJECTS := 
+$(call gb_LinkTarget_get_dep_target,$(1)) : OBJCOBJECTS :=
 $(call gb_LinkTarget_get_dep_target,$(1)) : OBJCXXOBJECTS :=
 $(call gb_LinkTarget_get_dep_target,$(1)) : GENCXXOBJECTS :=
 $(call gb_LinkTarget_get_dep_target,$(1)) : CFLAGS := $$(gb_LinkTarget_CFLAGS)
 $(call gb_LinkTarget_get_dep_target,$(1)) : CXXFLAGS := $$(gb_LinkTarget_CXXFLAGS)
 $(call gb_LinkTarget_get_dep_target,$(1)) : PCH_CXXFLAGS := $$(gb_LinkTarget_CXXFLAGS) $(gb_COMPILEROPTFLAGS)
 $(call gb_LinkTarget_get_dep_target,$(1)) : OBJCXXFLAGS := $$(gb_LinkTarget_OBJCXXFLAGS)
+$(call gb_LinkTarget_get_dep_target,$(1)) : OBJCFLAGS := $$(gb_LinkTarget_OBJCFLAGS)
 $(call gb_LinkTarget_get_dep_target,$(1)) : DEFS := $$(gb_LinkTarget_DEFAULTDEFS)
 $(call gb_LinkTarget_get_dep_target,$(1)) : PCH_DEFS := $$(gb_LinkTarget_DEFAULTDEFS)
 $(call gb_LinkTarget_get_dep_target,$(1)) : INCLUDE := $$(gb_LinkTarget_INCLUDE)
@@ -471,6 +522,14 @@ endif
 
 endef
 
+define gb_LinkTarget_set_objcflags
+$(call gb_LinkTarget_get_target,$(1)) : OBJCFLAGS := $(2)
+ifeq ($(gb_FULLDEPS),$(true))
+$(call gb_LinkTarget_get_dep_target,$(1)) : OBJCFLAGS := $(2)
+endif
+
+endef
+
 define gb_LinkTarget_set_include
 $(call gb_LinkTarget_get_headers_target,$(1)) \
 $(call gb_LinkTarget_get_target,$(1)) : INCLUDE := $(2)
@@ -561,6 +620,26 @@ endif
 
 endef
 
+define gb_LinkTarget_add_objcobject
+$(call gb_LinkTarget_get_target,$(1)) : OBJCOBJECTS += $(2)
+$(call gb_LinkTarget_get_clean_target,$(1)) : OBJCOBJECTS += $(2)
+
+$(call gb_LinkTarget_get_target,$(1)) : $(call gb_ObjCObject_get_target,$(2))
+$(call gb_ObjCObject_get_target,$(2)) : | $(call gb_LinkTarget_get_headers_target,$(1))
+$(call gb_ObjCObject_get_target,$(2)) : OBJCFLAGS += $(3)
+
+ifeq ($(gb_FULLDEPS),$(true))
+$(call gb_LinkTarget_get_dep_target,$(1)) : OBJCOBJECTS += $(2)
+$(call gb_LinkTarget_get_dep_target,$(1)) : $(call gb_ObjCObject_get_dep_target,$(2))
+endif
+
+ifeq ($(gb_CHECKOBJECTOWNER),$(true))
+gb_LinkTarget_OBJECTOWNER += $(call gb_ObjCObject_get_target,$(2)):$(1)
+gb_LinkTarget_OBJECTS +=  $(call gb_ObjCObject_get_target,$(2))
+endif
+
+endef
+
 define gb_LinkTarget_add_objcxxobject
 $(call gb_LinkTarget_get_target,$(1)) : OBJCXXOBJECTS += $(2)
 $(call gb_LinkTarget_get_clean_target,$(1)) : OBJCXXOBJECTS += $(2)
@@ -637,6 +716,10 @@ define gb_LinkTarget_add_cxxobjects
 $(foreach obj,$(2),$(call gb_LinkTarget_add_cxxobject,$(1),$(obj),$(3)))
 endef
 
+define gb_LinkTarget_add_objcobjects
+$(foreach obj,$(2),$(call gb_LinkTarget_add_objcobject,$(1),$(obj),$(3)))
+endef
+
 define gb_LinkTarget_add_objcxxobjects
 $(foreach obj,$(2),$(call gb_LinkTarget_add_objcxxobject,$(1),$(obj),$(3)))
 endef
diff --git a/solenv/gbuild/TargetLocations.mk b/solenv/gbuild/TargetLocations.mk
index dc04ba7..051b536 100644
--- a/solenv/gbuild/TargetLocations.mk
+++ b/solenv/gbuild/TargetLocations.mk
@@ -77,6 +77,7 @@ gb_Module_get_target = $(WORKDIR)/Module/$(1)
 gb_NoexPrecompiledHeader_get_dep_target = $(WORKDIR)/Dep/NoexPrecompiledHeader/$(gb_NoexPrecompiledHeader_DEBUGDIR)/$(1).hxx.pch.d
 gb_NoexPrecompiledHeader_get_target = $(WORKDIR)/NoexPrecompiledHeader/$(gb_NoexPrecompiledHeader_DEBUGDIR)/$(1).hxx.pch
 gb_ObjCxxObject_get_target = $(WORKDIR)/ObjCxxObject/$(1).o
+gb_ObjCObject_get_target = $(WORKDIR)/ObjCObject/$(1).o
 gb_Package_get_preparation_target = $(WORKDIR)/Package/prepared/$(1)
 gb_Package_get_target = $(WORKDIR)/Package/$(1)
 gb_PrecompiledHeader_get_dep_target = $(WORKDIR)/Dep/PrecompiledHeader/$(gb_PrecompiledHeader_DEBUGDIR)/$(1).hxx.pch.d
@@ -134,6 +135,7 @@ $(eval $(call gb_Helper_make_outdir_clean_targets,\
 $(eval $(call gb_Helper_make_dep_targets,\
 	CObject \
 	CxxObject \
+	ObjCObject \
 	ObjCxxObject \
 	LinkTarget \
 	SrsPartTarget \
diff --git a/solenv/gbuild/platform/macosx.mk b/solenv/gbuild/platform/macosx.mk
index 23f41b6..7f6e0c3 100755
--- a/solenv/gbuild/platform/macosx.mk
+++ b/solenv/gbuild/platform/macosx.mk
@@ -111,6 +111,8 @@ gb_CXXFLAGS := \
 # (see toolkit module for a case where it is necessary to do it this way)
 gb_OBJCXXFLAGS := -x objective-c++ -fobjc-exceptions
 
+gb_OBJCFLAGS := -x objective-c
+
 ifneq ($(EXTERNAL_WARNINGS_NOT_ERRORS),TRUE)
 gb_CFLAGS_WERROR := -Werror
 gb_CXXFLAGS_WERROR := -Werror
@@ -206,6 +208,23 @@ $(call gb_Helper_abbreviate_dirs,\
 		$(INCLUDE_STL) $(INCLUDE))
 endef
 
+# ObjCObject class
+
+define gb_ObjCObject__command
+$(call gb_Output_announce,$(2),$(true),OCC,3)
+$(call gb_Helper_abbreviate_dirs,\
+	mkdir -p $(dir $(1)) && \
+	mkdir -p $(dir $(call gb_ObjCObject_get_dep_target,$(2))) && \
+	$(gb_CC) \
+		$(DEFS) $(OBJCFLAGS) \
+		-c $(3) \
+		-o $(1) \
+		-MMD -MT $(call gb_ObjCObject_get_target,$(2)) \
+		-MF $(call gb_ObjCObject_get_dep_target,$(2)) \
+		-I$(dir $(3)) \
+		$(INCLUDE_STL) $(INCLUDE))
+endef
+
 
 # LinkTarget class
 
@@ -228,11 +247,13 @@ endef
 gb_LinkTarget_CFLAGS := $(gb_CFLAGS) $(gb_CFLAGS_WERROR) $(gb_COMPILEROPTFLAGS)
 gb_LinkTarget_CXXFLAGS := $(gb_CXXFLAGS) $(gb_CXXFLAGS_WERROR)
 gb_LinkTarget_OBJCXXFLAGS := $(gb_CXXFLAGS) $(gb_OBJCXXFLAGS) $(gb_COMPILEROPTFLAGS)
+gb_LinkTarget_OBJCFLAGS := $(gb_CFLAGS) $(gb_OBJCFLAGS) $(gb_COMPILEROPTFLAGS)
 
 ifeq ($(gb_SYMBOL),$(true))
 gb_LinkTarget_CFLAGS += -g
 gb_LinkTarget_CXXFLAGS += -g
 gb_LinkTarget_OBJCXXFLAGS += -g
+gb_LinkTarget_OBJCFLAGS += -g
 endif
 
 gb_LinkTarget_INCLUDE := $(filter-out %/stl, $(subst -I. , ,$(SOLARINC)))
@@ -268,6 +289,7 @@ $(call gb_Helper_abbreviate_dirs,\
 		$(call gb_LinkTarget__get_liblinkflags,$(LINKED_LIBS)) \
 		$(foreach object,$(COBJECTS),$(call gb_CObject_get_target,$(object))) \
 		$(foreach object,$(CXXOBJECTS),$(call gb_CxxObject_get_target,$(object))) \
+		$(foreach object,$(OBJCOBJECTS),$(call gb_ObjCObject_get_target,$(object))) \
 		$(foreach object,$(OBJCXXOBJECTS),$(call gb_ObjCxxObject_get_target,$(object))) \
 		$(foreach object,$(GENCXXOBJECTS),$(call gb_GenCxxObject_get_target,$(object))) \
 		$(foreach extraobjectlist,$(EXTRAOBJECTLISTS),`cat $(extraobjectlist)`) \
@@ -287,6 +309,7 @@ $(call gb_Helper_abbreviate_dirs,\
 	$(gb_AR) -rsu $(1) \
 		$(foreach object,$(COBJECTS),$(call gb_CObject_get_target,$(object))) \
 		$(foreach object,$(CXXOBJECTS),$(call gb_CxxObject_get_target,$(object))) \
+		$(foreach object,$(OBJCOBJECTS),$(call gb_ObjCObject_get_target,$(object))) \
 		$(foreach object,$(OBJCXXOBJECTS),$(call gb_ObjCxxObject_get_target,$(object))) \
 		$(foreach object,$(GENCXXOBJECTS),$(call gb_GenCxxObject_get_target,$(object))) \
 		$(foreach extraobjectlist,$(EXTRAOBJECTLISTS),@$(extraobjectlist)) \


More information about the Libreoffice-commits mailing list