summaryrefslogtreecommitdiff
path: root/solenv
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@suse.cz>2011-08-11 12:33:07 +0200
committerJan Holesovsky <kendy@suse.cz>2011-08-11 12:54:53 +0200
commit3da919bb4060f22675a23811fa1a63c1511d2484 (patch)
tree0fffbe851fbf93107469251d169950aa5e2aa32e /solenv
parent555fdbc6e9e04f8d4b7786c8b1a1faa5dd64a694 (diff)
Implement AsmObject in gbuild (Windows only for now, stub for unxgcc).
This fixes the build of 'basic' on Windows.
Diffstat (limited to 'solenv')
-rw-r--r--solenv/gbuild/CppunitTest.mk2
-rw-r--r--solenv/gbuild/Library.mk2
-rw-r--r--solenv/gbuild/LinkTarget.mk69
-rw-r--r--solenv/gbuild/StaticLibrary.mk2
-rw-r--r--solenv/gbuild/TargetLocations.mk2
-rw-r--r--solenv/gbuild/platform/unxgcc.mk24
-rw-r--r--solenv/gbuild/platform/windows.mk19
7 files changed, 116 insertions, 4 deletions
diff --git a/solenv/gbuild/CppunitTest.mk b/solenv/gbuild/CppunitTest.mk
index 8f28cd41f5e2..e24060c233a0 100644
--- a/solenv/gbuild/CppunitTest.mk
+++ b/solenv/gbuild/CppunitTest.mk
@@ -168,6 +168,8 @@ $(eval $(foreach method,\
add_objcobjects \
add_objcxxobject \
add_objcxxobjects \
+ add_asmobject \
+ add_asmobjects \
add_package_headers \
add_precompiled_header \
add_sdi_headers \
diff --git a/solenv/gbuild/Library.mk b/solenv/gbuild/Library.mk
index 7a79ad84739d..5232369e9641 100644
--- a/solenv/gbuild/Library.mk
+++ b/solenv/gbuild/Library.mk
@@ -113,6 +113,8 @@ $(eval $(foreach method,\
add_objcobjects \
add_objcxxobject \
add_objcxxobjects \
+ add_asmobject \
+ add_asmobjects \
add_exception_objects \
add_noexception_objects \
add_generated_cxxobjects \
diff --git a/solenv/gbuild/LinkTarget.mk b/solenv/gbuild/LinkTarget.mk
index c8005edb0cbc..d644fdd231ff 100644
--- a/solenv/gbuild/LinkTarget.mk
+++ b/solenv/gbuild/LinkTarget.mk
@@ -47,9 +47,9 @@ endif
# Overview of dependencies and tasks of LinkTarget
#
# target task depends on
-# LinkTarget linking CObject CxxObject GenCxxObject ObjCObject ObjCxxObject
+# LinkTarget linking AsmObject CObject CxxObject GenCxxObject ObjCObject ObjCxxObject
# LinkTarget/headers
-# LinkTarget/dep joined dep file CObject/dep CxxObject/dep GenCxxObject/dep ObjCObject/dep ObjCxxObject/dep
+# LinkTarget/dep joined dep file AsmObject/dep 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
@@ -63,11 +63,14 @@ endif
# ObjCObject objective c compile | LinkTarget/headers
# ObjCxxObject objective c++ compile | LinkTarget/headers
#
+# AsmObject asm compile | LinkTarget
+#
# 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
+# AsmObject/dep dependencies
# LinkTarget/headers means gb_LinkTarget_get_headers_target etc.
# dependencies prefixed with | are build-order only dependencies
@@ -271,6 +274,34 @@ gb_ObjCObject_ObjCObject =
+# AsmObject class
+
+gb_AsmObject_REPOS := $(gb_REPOS)
+
+# defined by platform
+# gb_AsmObject_get_source (.asm on Windows, .s elsewhere)
+# gb_AsmObject__command
+
+define gb_AsmObject__rules
+$$(call gb_AsmObject_get_target,%) : $$(call gb_AsmObject_get_source,$(1),%)
+ $$(call gb_AsmObject__command,$$@,$$*,$$<,$$(call gb_AsmObject_get_dep_target,$$*))
+
+ifeq ($(gb_FULLDEPS),$(true))
+$$(call gb_AsmObject_get_dep_target,%) : $$(call gb_AsmObject_get_target,%)
+ $$(if $$(wildcard $$@),touch $$@,\
+ $$(call gb_Object__command_dep,$$@,$$(call gb_AsmObject_get_target,$$*)))
+endif
+
+endef
+
+$(foreach repo,$(gb_AsmObject_REPOS),$(eval $(call gb_AsmObject__rules,$(repo))))
+
+$(call gb_AsmObject_get_dep_target,%) :
+ $(eval $(call gb_Output_error,Unable to find asm file $(call gb_AsmObject_get_source,,$*) in the repositories: $(gb_AsmObject_REPOS)))
+
+gb_AsmObject_AsmObject =
+
+
# LinkTarget class
gb_LinkTarget_DEFAULTDEFS := $(gb_GLOBALDEFS)
@@ -295,6 +326,8 @@ $(call gb_LinkTarget_get_clean_target,%) :
$(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,$(ASMOBJECTS),$(call gb_AsmObject_get_target,$(object))) \
+ $(foreach object,$(ASMOBJECTS),$(call gb_AsmObject_get_dep_target,$(object))) \
$(foreach object,$(GENCXXOBJECTS),$(call gb_GenCxxObject_get_target,$(object))) \
$(foreach object,$(GENCXXOBJECTS),$(call gb_GenCxxObject_get_dep_target,$(object))) \
$(call gb_LinkTarget_get_target,$*) \
@@ -318,7 +351,8 @@ $(call gb_Helper_abbreviate_dirs,\
$(foreach object,$(4),$(call gb_CxxObject_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)))\
+ $(foreach object,$(7),$(call gb_AsmObject_get_dep_target,$(object)))\
+ $(foreach object,$(8),$(call gb_GenCxxObject_get_dep_target,$(object)))\
) && \
cat $${RESPONSEFILE} /dev/null | xargs -n 200 cat > $(1)) && \
rm -f $${RESPONSEFILE}
@@ -331,6 +365,7 @@ TEMPFILE=$(call var2file,$(shell $(gb_MKTEMP)),200,\
$(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,$(ASMOBJECTS),$(call gb_AsmObject_get_target,$(object))) \
$(foreach object,$(GENCXXOBJECTS),$(call gb_GenCxxObject_get_target,$(object)))) && \
$(if $(EXTRAOBJECTLISTS),cat $(EXTRAOBJECTLISTS) >> $${TEMPFILE} && ) \
mv $${TEMPFILE} $(call gb_LinkTarget_get_objects_list,$(2))
@@ -344,7 +379,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),$(OBJCOBJECTS),$(OBJCXXOBJECTS),$(GENCXXOBJECTS))
+ $(call gb_LinkTarget__command_dep,$@,$*,$(COBJECTS),$(CXXOBJECTS),$(OBJCOBJECTS),$(OBJCXXOBJECTS),$(ASMOBJECTS),$(GENCXXOBJECTS))
endif
# Ok, this is some dark voodoo: When declaring a linktarget with
@@ -422,6 +457,8 @@ $(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)) : ASMOBJECTS :=
+$(call gb_LinkTarget_get_clean_target,$(1)) \
$(call gb_LinkTarget_get_target,$(1)) : GENCXXOBJECTS :=
$(call gb_LinkTarget_get_headers_target,$(1)) \
$(call gb_LinkTarget_get_target,$(1)) : T_CFLAGS := $$(gb_LinkTarget_CFLAGS) $(CFLAGS)
@@ -458,6 +495,7 @@ $(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)) : ASMOBJECTS :=
$(call gb_LinkTarget_get_dep_target,$(1)) : GENCXXOBJECTS :=
$(call gb_LinkTarget_get_dep_target,$(1)) : T_CFLAGS := $$(gb_LinkTarget_CFLAGS) $(CFLAGS)
$(call gb_LinkTarget_get_dep_target,$(1)) : T_CXXFLAGS := $$(gb_LinkTarget_CXXFLAGS)
@@ -731,6 +769,25 @@ endif
endef
+define gb_LinkTarget_add_asmobject
+$(call gb_LinkTarget_get_target,$(1)) : ASMOBJECTS += $(2)
+$(call gb_LinkTarget_get_clean_target,$(1)) : ASMOBJECTS += $(2)
+
+$(call gb_LinkTarget_get_target,$(1)) : $(call gb_AsmObject_get_target,$(2))
+$(call gb_AsmObject_get_target,$(2)) : | $(call gb_LinkTarget_get_headers_target,$(1))
+
+ifeq ($(gb_FULLDEPS),$(true))
+$(call gb_LinkTarget_get_dep_target,$(1)) : ASMOBJECTS += $(2)
+$(call gb_LinkTarget_get_dep_target,$(1)) : $(call gb_AsmObject_get_dep_target,$(2))
+endif
+
+ifeq ($(gb_CHECKOBJECTOWNER),$(true))
+gb_LinkTarget_OBJECTOWNER += $(call gb_AsmObject_get_target,$(2)):$(1)
+gb_LinkTarget_OBJECTS += $(call gb_AsmObject_get_target,$(2))
+endif
+
+endef
+
define gb_LinkTarget_add_generated_cxx_object
$(call gb_LinkTarget_get_target,$(1)) : GENCXXOBJECTS += $(2)
$(call gb_LinkTarget_get_clean_target,$(1)) : GENCXXOBJECTS += $(2)
@@ -795,6 +852,10 @@ define gb_LinkTarget_add_objcxxobjects
$(foreach obj,$(2),$(call gb_LinkTarget_add_objcxxobject,$(1),$(obj),$(3)))
endef
+define gb_LinkTarget_add_asmobjects
+$(foreach obj,$(2),$(call gb_LinkTarget_add_asmobject,$(1),$(obj),$(3)))
+endef
+
define gb_LinkTarget_add_noexception_objects
$(foreach obj,$(2),$(call gb_LinkTarget_add_noexception_object,$(1),$(obj)))
endef
diff --git a/solenv/gbuild/StaticLibrary.mk b/solenv/gbuild/StaticLibrary.mk
index 841f70c699e0..88295cc09f0e 100644
--- a/solenv/gbuild/StaticLibrary.mk
+++ b/solenv/gbuild/StaticLibrary.mk
@@ -87,6 +87,8 @@ $(eval $(foreach method,\
add_cxxobjects \
add_objcxxobject \
add_objcxxobjects \
+ add_asmobject \
+ add_asmobjects \
add_exception_objects \
add_noexception_objects \
add_generated_cxxobjects \
diff --git a/solenv/gbuild/TargetLocations.mk b/solenv/gbuild/TargetLocations.mk
index d92a0e79da3f..eb3b583abfe8 100644
--- a/solenv/gbuild/TargetLocations.mk
+++ b/solenv/gbuild/TargetLocations.mk
@@ -58,6 +58,7 @@ endef
# workdir target patterns
gb_AllLangResTarget_get_target = $(WORKDIR)/AllLangRes/$(1)
+gb_AsmObject_get_target = $(WORKDIR)/AsmObject/$(1).o
gb_CObject_get_target = $(WORKDIR)/CObject/$(1).o
gb_ComponentTarget_get_target = $(WORKDIR)/ComponentTarget/$(1).component
gb_ComponentTarget_get_inbuild_target = $(WORKDIR)/ComponentTarget/$(1).inbuild.component
@@ -161,6 +162,7 @@ $(eval $(call gb_Helper_make_dep_targets,\
CxxObject \
ObjCObject \
ObjCxxObject \
+ AsmObject \
GenCxxObject \
LinkTarget \
SrsPartTarget \
diff --git a/solenv/gbuild/platform/unxgcc.mk b/solenv/gbuild/platform/unxgcc.mk
index e30c52212224..3c330c74a588 100644
--- a/solenv/gbuild/platform/unxgcc.mk
+++ b/solenv/gbuild/platform/unxgcc.mk
@@ -224,6 +224,28 @@ $(call gb_Helper_abbreviate_dirs,\
endef
+# AsmObject class
+
+gb_AsmObject_get_source = $(1)/$(2).s
+
+# $(call gb_AsmObject__command,object,relative-source,source,dep-file)
+define gb_AsmObject__command
+$(call gb_Output_announce,$(2),$(true),ASM,3)
+$(call gb_Helper_abbreviate_dirs,\
+ mkdir -p $(dir $(1)) $(dir $(4)) && \
+ echo "FIXME: Building assembler with gcc not yet implemented." && exit 1
+ #$(gb_CC) \
+ # $(DEFS) \
+ # $(T_CFLAGS) \
+ # -c $(3) \
+ # -o $(1) \
+ # -MMD -MT $(1) \
+ # -MF $(4) \
+ # -I$(dir $(3)) \
+ # $(INCLUDE))
+endef
+
+
# LinkTarget class
define gb_LinkTarget__get_rpath_for_layer
@@ -260,6 +282,7 @@ $(call gb_Helper_abbreviate_dirs,\
$(T_LDFLAGS) \
$(foreach object,$(COBJECTS),$(call gb_CObject_get_target,$(object))) \
$(foreach object,$(CXXOBJECTS),$(call gb_CxxObject_get_target,$(object))) \
+ $(foreach object,$(ASMOBJECTS),$(call gb_AsmObject_get_target,$(object))) \
$(foreach object,$(GENCXXOBJECTS),$(call gb_GenCxxObject_get_target,$(object))) \
$(foreach extraobjectlist,$(EXTRAOBJECTLISTS),`cat $(extraobjectlist)`) \
-Wl$(COMMA)--start-group $(foreach lib,$(LINKED_STATIC_LIBS),$(call gb_StaticLibrary_get_target,$(lib))) -Wl$(COMMA)--end-group \
@@ -274,6 +297,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,$(ASMOBJECTS),$(call gb_AsmObject_get_target,$(object))) \
$(foreach object,$(GENCXXOBJECTS),$(call gb_GenCxxObject_get_target,$(object))) \
$(foreach extraobjectlist,$(EXTRAOBJECTLISTS),@$(extraobjectlist)) \
$(if $(findstring s,$(MAKEFLAGS)),2> /dev/null))
diff --git a/solenv/gbuild/platform/windows.mk b/solenv/gbuild/platform/windows.mk
index 7442b45264e7..83cbf24bc4ef 100644
--- a/solenv/gbuild/platform/windows.mk
+++ b/solenv/gbuild/platform/windows.mk
@@ -76,6 +76,10 @@ gb_RCDEFS := \
gb_RCFLAGS := \
-V
+# FIXME: When porting to Windows64, we should use only:
+# /c /Cp
+gb_AFLAGS := /c /Cp /coff /safeseh
+
gb_CFLAGS := \
-Gd \
-GR \
@@ -347,6 +351,20 @@ $(call gb_Helper_abbreviate_dirs_native,\
-Yc$(notdir $(patsubst %.cxx,%.hxx,$(3))) -Fp$(1) -Fo$(1).obj) $(call gb_create_deps,$(1),$(call gb_NoexPrecompiledHeader,$(2)),$(realpath $(3)))
endef
+# AsmObject class
+
+gb_AsmObject_get_source = $(1)/$(2).asm
+
+define gb_AsmObject__command
+$(call gb_Output_announce,$(2),$(true),ASM,3)
+$(call gb_Helper_abbreviate_dirs_native,\
+ mkdir -p $(dir $(1)) $(dir $(4)) && \
+ $(ML_EXE) $(gb_AFLAGS) -D$(COM) /Fo$(1) $(3)) && \
+ echo "$(1) : $(realpath $(3))" > $(4)
+$(call gb_Object__command_deponcompile,$(1),$(4),$(3),,,)
+endef
+
+
# LinkTarget class
gb_LinkTarget_CFLAGS := $(gb_CFLAGS) $(gb_CFLAGS_WERROR)
@@ -369,6 +387,7 @@ $(call gb_Helper_abbreviate_dirs_native,\
$(call gb_Helper_convert_native,$(foreach object,$(CXXOBJECTS),$(call gb_CxxObject_get_target,$(object))) \
$(foreach object,$(GENCXXOBJECTS),$(call gb_GenCxxObject_get_target,$(object))) \
$(foreach object,$(COBJECTS),$(call gb_CObject_get_target,$(object))) \
+ $(foreach object,$(ASMOBJECTS),$(call gb_AsmObject_get_target,$(object))) \
$(foreach extraobjectlist,$(EXTRAOBJECTLISTS),$(shell cat $(extraobjectlist))) \
$(PCHOBJS) $(NATIVERES))) && \
$(gb_LINK) \