diff options
author | Bjoern Michaelsen <b_michaelsen@openoffice.org> | 2010-05-07 17:23:27 +0200 |
---|---|---|
committer | Bjoern Michaelsen <b_michaelsen@openoffice.org> | 2010-05-07 17:23:27 +0200 |
commit | ec331e1c244e72aad5917cfe07ba3ff84f2671b6 (patch) | |
tree | 8a399ae826951662856d6f0e973b7c807ed9c6ff /solenv | |
parent | 73c36a2ac1535ca8984165ce2719a6a22e036e9d (diff) |
CWS gnumake2: dependencies for windows
Diffstat (limited to 'solenv')
-rw-r--r-- | solenv/gbuild/helper.mk | 4 | ||||
-rw-r--r-- | solenv/gbuild/platform/windows.mk | 45 | ||||
-rw-r--r-- | solenv/gbuild/processdeps.awk | 65 |
3 files changed, 108 insertions, 6 deletions
diff --git a/solenv/gbuild/helper.mk b/solenv/gbuild/helper.mk index 49b390190927..8dec073748cd 100644 --- a/solenv/gbuild/helper.mk +++ b/solenv/gbuild/helper.mk @@ -48,8 +48,8 @@ endef define gb_Helper_abbreviate_dirs S=$(SRCDIR) && \ -$(subst $(SRCDIR)/,$$S/,W=$(WORKDIR) && O=$(OUTDIR)) && \ -$(subst $(SRCDIR)/,$$S/,$(subst $(WORKDIR)/,$$W/,$(subst $(OUTDIR)/,$$O/,$(1)))) +$(subst $(SRCDIR)/,$$S/,O=$(OUTDIR)) && \ +$(subst $(SRCDIR)/,$$S/,$(subst $(OUTDIR)/,$$O/,W=$(WORKDIR) && $(subst $(WORKDIR)/,$$W/,$(1)))) endef define gb_Helper_make_clean_target diff --git a/solenv/gbuild/platform/windows.mk b/solenv/gbuild/platform/windows.mk index 045e33ec638f..1a43a1c10a1a 100644 --- a/solenv/gbuild/platform/windows.mk +++ b/solenv/gbuild/platform/windows.mk @@ -33,6 +33,7 @@ gb_MkTemp := mktemp -p gb_CC := cl gb_CXX := cl gb_LINK := link +gb_AWK := awk gb_OSDEFS :=\ -DWINVER=0x0500 \ @@ -176,8 +177,8 @@ gb_Helper_OUTDIR_NATIVE := $(shell cygpath -m $(OUTDIR)) define gb_Helper_abbreviate_dirs_native S=$(gb_Helper_SRCDIR_NATIVE) && \ -$(subst $(gb_Helper_SRCDIR_NATIVE)/,$$S/,W=$(gb_Helper_WORKDIR_NATIVE) && O=$(gb_Helper_OUTDIR_NATIVE)) && \ -$(subst $(SRCDIR)/,$$S/,$(subst $(WORKDIR)/,$$W/,$(subst $(OUTDIR)/,$$O/,$(1)))) +$(subst $(gb_Helper_SRCDIR_NATIVE)/,$$S/,O=$(gb_Helper_OUTDIR_NATIVE)) && \ +$(subst $(gb_Helper_SRCDIR_NATIVE)/,$$S/,$(subst $(SRCDIR)/,$$S/,$(subst $(gb_Helper_OUTDIR_NATIVE)/,$$O/,$(subst $(OUTDIR)/,$$O/,W=$(gb_Helper_WORKDIR_NATIVE) && $(subst $(gb_Helper_WORKDIR_NATIVE)/,$$W/,$(subst $(WORKDIR)/,$$W/,$(1))))))) endef # CObject class @@ -192,6 +193,19 @@ $(call gb_Helper_abbreviate_dirs_native,\ $(6) \ -c $(3) \ -Fo$(1)" && E=$$($$C) || (echo $$C && echo $$E 1>&2 && false)) +$(call gb_Helper_abbreviate_dirs_native,\ + $(OUTDIR)/bin/makedepend$(gb_Executable_EXT) \ + $(4) $(5) \ + -I$(dir $(3)) \ + $(6) \ + $(3) \ + -f - \ + | $(gb_AWK) -f $(GBUILDDIR)/processdeps.awk \ + -v OBJECTFILE=$(1) \ + -v OUTDIR=$(OUTDIR)/ \ + -v WORKDIR=$(WORKDIR)/ \ + -v SRCDIR=$(SRCDIR)/ \ + > $(call gb_CxxObject_get_dep_target,$(2))) endef define gb_CObject__command_dep @@ -212,11 +226,24 @@ $(call gb_Helper_abbreviate_dirs_native,\ $(6) \ -c $(3) \ -Fo$(1)" && E=$$($$C) || (echo $$C && echo $$E 1>&2 && false)) +$(call gb_Helper_abbreviate_dirs_native,\ + $(OUTDIR)/bin/makedepend$(gb_Executable_EXT) \ + $(4) $(5) \ + -I$(dir $(3)) \ + $(6) \ + $(3) \ + -f - \ + | $(gb_AWK) -f $(GBUILDDIR)/processdeps.awk \ + -v OBJECTFILE=$(1) \ + -v OUTDIR=$(OUTDIR)/ \ + -v WORKDIR=$(WORKDIR)/ \ + -v SRCDIR=$(SRCDIR)/ \ + > $(call gb_CxxObject_get_dep_target,$(2))) endef define gb_CxxObject__command_dep mkdir -p $(dir $(1)) && \ - echo '$(call gb_CObject_get_target,$(2)) : $$(gb_Helper_PHONY)' > $(1) + echo '$(call gb_CxxObject_get_target,$(2)) : $$(gb_Helper_PHONY)' > $(1) endef @@ -417,7 +444,17 @@ gb_SrsPartTarget_RSCTARGET := $(OUTDIR)/bin/rsc.exe gb_SrsPartTarget_RSCCOMMAND := SOLARBINDIR=$(OUTDIR)/bin $(gb_SrsPartTarget_RSCTARGET) define gb_SrsPartTarget__command_dep -$(info gb_SrsPartTarget__command_dep not implemented) +$(call gb_Helper_abbreviate_dirs_native,\ + $(OUTDIR)/bin/makedepend$(gb_Executable_EXT) \ + $(3) $(4) \ + $(2) \ + -f - \ + | $(gb_AWK) -f $(GBUILDDIR)/processdeps.awk \ + -v OBJECTFILE=$(call gb_SrsPartTarget_get_target,$(1)) \ + -v OUTDIR=$(OUTDIR)/ \ + -v WORKDIR=$(WORKDIR)/ \ + -v SRCDIR=$(SRCDIR)/ \ + > $(call gb_SrsPartTarget_get_dep_target,$(1))) endef diff --git a/solenv/gbuild/processdeps.awk b/solenv/gbuild/processdeps.awk new file mode 100644 index 000000000000..d08edf2a9e20 --- /dev/null +++ b/solenv/gbuild/processdeps.awk @@ -0,0 +1,65 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +# this awk script mangles makedepend output for a single object file +# usage: +# awk -f .../processdeps.awk \ +# -v OUTDIR=outdir \ +# -v SRCDIR=srcdir \ +# -v wORKDIR=workdir \ +# -v OBJECTFILE=objectfile +# called like this the script will read from stdin +# and write to stdout. It will: +# - replace the objectfile with the one given on the commandline +# - normalize paths to mixed paths (replacing all \ with /) +# - replace the string given as WORKDIR with $(WORKDIR)/ +# - replace the string given as OUTDIR with $(OUTDIR)/ +# - replace the string given as SRCDIR with $(SRCDIR)/ +# - translates absolute mixed windows paths to cygwin paths by +# substituting a path starting with X:... to /cygdrive/X/... + +function mangle_path(path) { + gsub("\\\\", "/", path); + gsub(WORKDIR, "$(WORKDIR)/", path); + gsub(OUTDIR, "$(OUTDIR)/", path); + gsub(SRCDIR, "$(SRCDIR)/", path); + if( path ~ /^[a-zA-Z]:/ ) + path = "/cygdrive/" substr(path,0,1) "/" substr(path,3); + return path; +} + +BEGIN { + print mangle_path(OBJECTFILE) ": \\"; +} + +/^[^#]/ { + print "\t" mangle_path($2) " \\"; +} + +END { + print "\n"; +} |