summaryrefslogtreecommitdiff
path: root/solenv/gbuild
diff options
context:
space:
mode:
authorPhilipp Lohmann [pl] <Philipp.Lohmann@Sun.COM>2011-03-23 17:27:40 +0100
committerPhilipp Lohmann [pl] <Philipp.Lohmann@Sun.COM>2011-03-23 17:27:40 +0100
commit5ebffff3faea50c35c35fc1730fae56802c5929d (patch)
tree296516b812d5f50788b644b845510fe11b3b8307 /solenv/gbuild
parent121d025d6acd1fadd287db99be258d1ce4aab938 (diff)
vcl2gnumake: #i116588# add: windows native resource files (thanks hjs !)
Diffstat (limited to 'solenv/gbuild')
-rw-r--r--solenv/gbuild/Library.mk1
-rw-r--r--solenv/gbuild/LinkTarget.mk1
-rwxr-xr-x[-rw-r--r--]solenv/gbuild/TargetLocations.mk2
-rw-r--r--solenv/gbuild/gbuild.mk1
-rwxr-xr-xsolenv/gbuild/platform/windows.mk72
-rw-r--r--solenv/gbuild/platform/winmingw.mk63
6 files changed, 134 insertions, 6 deletions
diff --git a/solenv/gbuild/Library.mk b/solenv/gbuild/Library.mk
index d697b1a777ca..0ce56ce41ea2 100644
--- a/solenv/gbuild/Library.mk
+++ b/solenv/gbuild/Library.mk
@@ -61,6 +61,7 @@ $$(eval $$(call gb_Output_error,Library $(1) must be registered in Repository.mk
endif
$(call gb_Library_get_target,$(1)) : AUXTARGETS :=
$(call gb_Library__Library_impl,$(1),$(call gb_Library__get_linktargetname,$(1)))
+$(call gb_Library_add_default_nativeres,$(1),default)
endef
diff --git a/solenv/gbuild/LinkTarget.mk b/solenv/gbuild/LinkTarget.mk
index 612b85bf3e20..8f681b5e4d5c 100644
--- a/solenv/gbuild/LinkTarget.mk
+++ b/solenv/gbuild/LinkTarget.mk
@@ -362,6 +362,7 @@ $(call gb_LinkTarget_get_target,$(1)) : PCH_NAME :=
$(call gb_LinkTarget_get_target,$(1)) : PCHOBJS :=
$(call gb_LinkTarget_get_headers_target,$(1)) \
$(call gb_LinkTarget_get_target,$(1)) : PDBFILE :=
+$(call gb_LinkTarget_get_target,$(1)) : NATIVERES :=
ifeq ($(gb_FULLDEPS),$(true))
ifneq ($(wildcard $(call gb_LinkTarget_get_dep_target,$(1))),)
diff --git a/solenv/gbuild/TargetLocations.mk b/solenv/gbuild/TargetLocations.mk
index aba209c29136..60e53ec10e15 100644..100755
--- a/solenv/gbuild/TargetLocations.mk
+++ b/solenv/gbuild/TargetLocations.mk
@@ -81,6 +81,7 @@ gb_SdiTarget_get_target = $(WORKDIR)/SdiTarget/$(1)
gb_SrsPartMergeTarget_get_target = $(WORKDIR)/SrsPartMergeTarget/$(1)
gb_SrsPartTarget_get_target = $(WORKDIR)/SrsPartTarget/$(1)
gb_SrsTarget_get_target = $(WORKDIR)/SrsTarget/$(1).srs
+gb_WinResTarget_get_target = $(WORKDIR)/WinResTarget/$(1)$(gb_WinResTarget_POSTFIX)
define gb_Library_get_external_headers_target
$(patsubst $(1):%,$(WORKDIR)/ExternalHeaders/Library/%,$(filter $(1):%,$(gb_Library_FILENAMES)))
@@ -105,6 +106,7 @@ $(eval $(call gb_Helper_make_clean_targets,\
JunitTest \
LinkTarget \
Module \
+ WinResTarget \
NoexPrecompiledHeader \
PackagePart \
PrecompiledHeader \
diff --git a/solenv/gbuild/gbuild.mk b/solenv/gbuild/gbuild.mk
index 3c7010a32158..46f1b72dda52 100644
--- a/solenv/gbuild/gbuild.mk
+++ b/solenv/gbuild/gbuild.mk
@@ -221,6 +221,7 @@ $(eval $(call gb_Deliver_init))
include $(foreach class, \
ComponentTarget \
AllLangResTarget \
+ WinResTarget \
LinkTarget \
Library \
StaticLibrary \
diff --git a/solenv/gbuild/platform/windows.mk b/solenv/gbuild/platform/windows.mk
index e85bdb5a0f80..23f6b60da94f 100755
--- a/solenv/gbuild/platform/windows.mk
+++ b/solenv/gbuild/platform/windows.mk
@@ -37,6 +37,7 @@ gb_CXX := cl
gb_LINK := link
gb_AWK := awk
gb_CLASSPATHSEP := ;
+gb_RC := rc
# use CC/CXX if they are nondefaults
ifneq ($(origin CC),default)
@@ -67,6 +68,13 @@ gb_COMPILERDEFS := \
gb_CPUDEFS := -DINTEL -D_X86_=1
+gb_RCDEFS := \
+ -DWINVER=0x0400 \
+ -DWIN32 \
+
+gb_RCFLAGS := \
+ -V
+
gb_CFLAGS := \
-Gd \
-GR \
@@ -180,7 +188,7 @@ gb_PrecompiledHeader_EXCEPTIONFLAGS := $(gb_LinkTarget_EXCEPTIONFLAGS)
gb_LinkTarget_NOEXCEPTIONFLAGS := \
-DEXCEPTIONS_OFF \
-
+
gb_NoexPrecompiledHeader_NOEXCEPTIONFLAGS := $(gb_LinkTarget_NOEXCEPTIONFLAGS)
gb_LinkTarget_LDFLAGS := \
@@ -274,11 +282,11 @@ $(call gb_Helper_abbreviate_dirs_native,\
$(3) \
-f - \
| $(gb_AWK) -f $(GBUILDDIR)/processdeps.awk \
- -v OBJECTFILE=$(1) \
- -v OUTDIR=$(OUTDIR)/ \
+ -v OBJECTFILE=$(1) \
+ -v OUTDIR=$(OUTDIR)/ \
-v WORKDIR=$(WORKDIR)/ \
-v SRCDIR=$(SRCDIR)/ \
- -v REPODIR=$(REPODIR)/ \
+ -v REPODIR=$(REPODIR)/ \
> $(call gb_CxxObject_get_dep_target,$(2)))
endef
else
@@ -383,7 +391,6 @@ $(call gb_Helper_abbreviate_dirs_native,\
$(call gb_NoexPrecompiledHeader__command_deponcompile,$(1),$(2),$(3),$(4),$(5),$(6))
endef
-
# LinkTarget class
gb_LinkTarget_CFLAGS := $(gb_CFLAGS) $(gb_CFLAGS_WERROR) $(gb_COMPILEROPTFLAGS)
@@ -406,7 +413,7 @@ $(call gb_Helper_abbreviate_dirs_native,\
echo "$(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))) \
- $(PCHOBJS)" > $${RESPONSEFILE} && \
+ $(PCHOBJS) $(NATIVERES)" > $${RESPONSEFILE} && \
$(gb_LINK) \
$(if $(filter Library CppunitTest,$(TARGETTYPE)),$(gb_Library_TARGETTYPEFLAGS)) \
$(if $(filter StaticLibrary,$(TARGETTYPE)),$(gb_StaticLibrary_TARGETTYPEFLAGS)) \
@@ -519,6 +526,20 @@ $(call gb_LinkTarget_get_headers_target,$(2)) : PDBFILE = $(call gb_LinkTarget_g
endef
+define gb_Library_add_default_nativeres
+$(call gb_WinResTarget_WinResTarget_init,$(1)/$(2))
+$(call gb_WinResTarget_add_file,$(1)/$(2),solenv/gbuild/shlinfo)
+$(call gb_Library_add_nativeres,$(1),$(2))
+$(call gb_Library_get_clean_target,$(1)) : $(call gb_WinResTarget_get_clean_target,$(1)/$(2))
+
+endef
+
+define gb_Library_add_nativeres
+$(call gb_LinkTarget_get_target,$(call gb_Library__get_linktargetname,$(1))) : $(call gb_WinResTarget_get_target,$(1)/$(2))
+$(call gb_LinkTarget_get_target,$(call gb_Library__get_linktargetname,$(1))) : NATIVERES += $(call gb_WinResTarget_get_target,$(1)/$(2))
+
+endef
+
define gb_Library_get_dllname
$(patsubst $(1):%,%,$(filter $(1):%,$(gb_Library_DLLFILENAMES)))
endef
@@ -672,6 +693,45 @@ else
gb_SrsPartTarget__command_dep =
endif
+# WinResTarget class
+
+gb_WinResTarget_POSTFIX :=.res
+
+define gb_WinResTarget__command
+$(call gb_Output_announce,$(2),$(true),RES,3)
+$(call gb_Helper_abbreviate_dirs_native,\
+ mkdir -p $(dir $(1)) && \
+ $(gb_RC) \
+ $(DEFS) $(FLAGS) \
+ -I$(dir $(3)) \
+ $(INCLUDE) \
+ -Fo$(1) \
+ $(RCFILE) )
+endef
+
+$(eval $(call gb_Helper_make_dep_targets,\
+ WinResTarget \
+))
+
+ifeq ($(gb_FULLDEPS),$(true))
+define gb_WinResTarget__command_dep
+$(call gb_Helper_abbreviate_dirs_native,\
+ $(OUTDIR)/bin/makedepend$(gb_Executable_EXT) \
+ $(INCLUDE) \
+ $(DEFS) \
+ $(2) \
+ -f - \
+ | $(gb_AWK) -f $(GBUILDDIR)/processdeps.awk \
+ -v OBJECTFILE=$(call gb_WinResTarget_get_target,$(1)) \
+ -v OUTDIR=$(OUTDIR)/ \
+ -v WORKDIR=$(WORKDIR)/ \
+ -v SRCDIR=$(SRCDIR)/ \
+ -v REPODIR=$(REPODIR)/ \
+ > $(call gb_WinResTarget_get_dep_target,$(1)))
+endef
+else
+gb_WinResTarget__command_dep =
+endif
# ComponentTarget
diff --git a/solenv/gbuild/platform/winmingw.mk b/solenv/gbuild/platform/winmingw.mk
index b9eec5eaf417..9c3764fd328b 100644
--- a/solenv/gbuild/platform/winmingw.mk
+++ b/solenv/gbuild/platform/winmingw.mk
@@ -96,6 +96,13 @@ gb_CPUDEFS := \
-DINTEL \
-D_M_IX86 \
+gb_RCDEFS := \
+ -DWINVER=0x0400 \
+ -DWIN32 \
+
+gb_RCFLAGS := \
+ -V
+
gb_CFLAGS := \
-Wall \
-Wendif-labels \
@@ -521,6 +528,20 @@ $(call gb_Deliver_add_deliverable,$(OUTDIR)/bin/$(notdir $(3)),$(3))
endef
+define gb_Library_add_default_nativeres
+$(call gb_WinResTarget_WinResTarget_init,$(1)/$(2))
+$(call gb_WinResTarget_add_file,$(1)/$(2),solenv/gbuild/shlinfo)
+$(call gb_Library_add_nativeres,$(1),$(2))
+$(call gb_Library_get_clean_target,$(1)) : $(call gb_WinResTarget_get_clean_target,$(1)/$(2))
+
+endef
+
+define gb_Library_add_nativeres
+$(call gb_LinkTarget_get_target,$(call gb_Library__get_linktargetname,$(1))) : $(call gb_WinResTarget_get_target,$(1)/$(2))
+$(call gb_LinkTarget_get_target,$(call gb_Library__get_linktargetname,$(1))) : NATIVERES += $(call gb_WinResTarget_get_target,$(1)/$(2))
+
+endef
+
define gb_Library_get_dllname
$(patsubst $(1):%,%,$(filter $(1):%,$(gb_Library_DLLFILENAMES)))
endef
@@ -599,6 +620,48 @@ else
gb_SrsPartTarget__command_dep =
endif
+# WinResTarget class
+
+gb_WinResTarget_POSTFIX :=_res.o
+
+define gb_WinResTarget__command
+$(call gb_Output_announce,$(2),$(true),RES,3)
+$(call gb_Helper_abbreviate_dirs_native,\
+ mkdir -p $(dir $(1)) && \
+ $(gb_RC) \
+ $(DEFS) $(FLAGS) \
+ -I$(dir $(3)) \
+ $(INCLUDE) \
+ -Fo$(patsubst %_res.o,%.res,$(1)) \
+ $(RCFILE) )
+ windres $(patsubst %_res.o,%.res,$(1)) $(1)
+ rm $(patsubst %_res.o,%.res,$(1))
+endef
+
+$(eval $(call gb_Helper_make_dep_targets,\
+ WinResTarget \
+))
+
+ifeq ($(gb_FULLDEPS),$(true))
+define gb_WinResTarget__command_dep
+$(call gb_Helper_abbreviate_dirs_native,\
+ $(OUTDIR)/bin/makedepend$(gb_Executable_EXT) \
+ $(INCLUDE) \
+ $(DEFS) \
+ $(2) \
+ -f - \
+ | $(gb_AWK) -f $(GBUILDDIR)/processdeps.awk \
+ -v OBJECTFILE=$(call gb_WinResTarget_get_target,$(1)) \
+ -v OUTDIR=$(OUTDIR)/ \
+ -v WORKDIR=$(WORKDIR)/ \
+ -v SRCDIR=$(SRCDIR)/ \
+ -v REPODIR=$(REPODIR)/ \
+ > $(call gb_WinResTarget_get_dep_target,$(1)))
+endef
+else
+gb_WinResTarget__command_dep =
+endif
+
# ComponentTarget
gb_XSLTPROCPRECOMMAND := PATH="$${PATH}:$(OUTDIR)/bin"