From 35a40c5a38c388afc857b550f5aab5460b0c1ba5 Mon Sep 17 00:00:00 2001 From: "Sergey S. Betke" Date: Wed, 20 Jun 2018 17:55:23 +0300 Subject: [PATCH] =?UTF-8?q?*=20=D0=BE=D1=82=D0=BA=D0=B0=D0=B7=D0=B0=D0=BB?= =?UTF-8?q?=D0=B8=D1=81=D1=8C,=20=D0=B3=D0=B4=D0=B5=20=D0=B2=D0=BE=D0=B7?= =?UTF-8?q?=D0=BC=D0=BE=D0=B6=D0=BD=D0=BE,=20=D0=BE=D1=82=20`OSPath`=20(Me?= =?UTF-8?q?trolog/marks#51)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ITG.MakeUtils/common.mk | 50 ++++++++++++++++++++++++------------ ITG.MakeUtils/ghostscript.mk | 12 ++++----- ITG.MakeUtils/tests.mk | 2 +- encodings/Makefile | 4 +-- 4 files changed, 43 insertions(+), 25 deletions(-) diff --git a/ITG.MakeUtils/common.mk b/ITG.MakeUtils/common.mk index ca0ec116..ff796f19 100644 --- a/ITG.MakeUtils/common.mk +++ b/ITG.MakeUtils/common.mk @@ -38,6 +38,10 @@ DOLLAR_SIGN :=$$ # $(call dirname,dir) dirname = $(patsubst %/,%,$1) +# TODO: корректно обернуть abspath и realpath +abspath = $(warning Do not use absolute paths!)$1 +realpath = $(warning Do not use absolute paths!)$1 + # TODO: уйти cygpath полностью # TODO: удалить winPath # $(call winPath,sourcePathOrFileName) @@ -63,11 +67,16 @@ OSPath = $1 endif +# TODO: уйти от OSPath +OSPath = $(warning Do not use OSPath!)$1 + # TODO: удалить OSabsPath OSabsPath = $(call OSPath,$(abspath $1)) # TODO: удалить OSPath -MAKETOOL := $(call OSPath,$(MAKE)) +# под cygwin $(MAKE) == '/usr/bin/make'. Поэтому приходится явно переназначать. Лучше перенести в Windows +#MAKETOOL := $(call OSPath,$(MAKE)) +MAKETOOL := make VERBOSE ?= true @@ -113,11 +122,11 @@ TAR ?= tar # $(call writeinformation, msg, details) writeinformationaux ?= -#writeinformationauxII ?= \ -# $(info $(1)) \ -# $(info $(2)) writeinformationauxII ?= \ - Write-Information '$(1)'; + $(info $(1)) \ + $(info $(2)) +#writeinformationauxII ?= \ +# Write-Information '$(1)'; writeinformation = \ $(call writeinformationaux,$(1),$(2)) \ @@ -126,11 +135,11 @@ writeinformation = \ # $(call writewarning, msg, details) writewarningaux ?= -#writewarningauxII ?= \ -# $(warning $(1)) \ -# $(info $(2)) writewarningauxII ?= \ - Write-Warning '$(1)'; + $(warning $(1)) \ + $(info $(2)) +#writewarningauxII ?= \ +# Write-Warning '$(1)'; writewarning = \ $(call writewarningaux,$(1),$(2)) \ @@ -139,11 +148,11 @@ writewarning = \ # $(call writeerror, msg, details) writeerroraux ?= -#writeerrorauxII ?= \ -# $(error $(1)) \ -# $(info $(2)) writeerrorauxII ?= \ - Write-Error '$(1)'; + $(error $(1)) \ + $(info $(2)) +#writeerrorauxII ?= \ +# Write-Error '$(1)'; writeerror = \ $(call writeerroraux,$(1),$(2)) \ @@ -214,7 +223,8 @@ pushArtifactTargets = $(call exportGlobalVariablesAux,$(1),TargetWriter) pushArtifactTarget = $(pushArtifactTargets) # $(call calcRootProjectDir, Project) -calcRootProjectDir = $(subst $(SPACE),/,$(patsubst %,..,$(subst /,$(SPACE),$(call getSubProjectDir,$1))))/ +calcRootProjectAux = $(subst $(SPACE),/,$(patsubst %,..,$(subst /,$(SPACE),$(call getSubProjectDir,$1)))) +calcRootProjectDir = $(if $(call calcRootProjectAux,$1),$(call calcRootProjectAux,$1)/,./) # $(call getSubProjectDir, Project) getSubProjectDir = $($(1)_DIR) @@ -226,12 +236,20 @@ endef # $(call MAKE_SUBPROJECT, Project) MAKE_SUBPROJECT = \ - $(MAKETOOL) -C $(call getSubProjectDir,$1) \ + $(MAKETOOL) \ + -C $(call getSubProjectDir,$1) \ SUBPROJECT=$1 \ SUBPROJECT_DIR=$(call getSubProjectDir,$1) \ ROOT_PROJECT_DIR=$(call calcRootProjectDir,$1) \ SUBPROJECT_EXPORTS_FILE=$(call calcRootProjectDir,$1)$(SUBPROJECTS_EXPORTS_DIR)$1.mk +# $(call MAKE_SUBPROJECT_TARGET, Target) +MAKE_SUBPROJECT_TARGET = \ + $(MAKETOOL) \ + -C $(ROOT_PROJECT_DIR) \ + ROOT_PROJECT_DIR=$(call calcRootProjectDir,$1) \ + $1 + # $(call declareProjectTargets, Project) define declareProjectTargets $(call getSubProjectDir,$1)%: @@ -279,7 +297,7 @@ endef ifdef ROOT_PROJECT_DIR $(ROOT_PROJECT_DIR)%: - $(MAKETOOL) -C $(ROOT_PROJECT_DIR) $* + $(call MAKE_SUBPROJECT_TARGET, $*) endif diff --git a/ITG.MakeUtils/ghostscript.mk b/ITG.MakeUtils/ghostscript.mk index 708d1455..528a609b 100644 --- a/ITG.MakeUtils/ghostscript.mk +++ b/ITG.MakeUtils/ghostscript.mk @@ -27,13 +27,13 @@ GSINCDIR ?= GSFONTDIR ?= GSCMDLINE = $(GS) \ - $(foreach incdir,$(GSINCDIR), -I'$(call OSabsPath,$(incdir))') \ - $(if $(GSFONTDIR),-sFONTPATH='$(foreach fontdir,$(GSFONTDIR),$(call OSabsPath,$(fontdir))$(PATHSEP))') + $(foreach incdir,$(GSINCDIR), -I'$(incdir)') \ + $(if $(GSFONTDIR),-sFONTPATH='$(foreach fontdir,$(GSFONTDIR),$(fontdir)$(PATHSEP))') $(OUTPUTDIR)%.pdf: $(SOURCESDIR)%.ps $(call writeinformation,Build file "$@" from "$<"...) $(MAKETARGETDIR) - $(GSCMDLINE) -sOutputFile='$(call OSPath,$@)' '$(call OSPath,$<)' + $(GSCMDLINE) -sOutputFile='$@' '$<' $(call writeinformation,File "$@" is ready.) @@ -46,7 +46,7 @@ TESTSPDFFILES = $(patsubst $(TESTSDIR)%.ps,$(AUXDIR)%.pdf,$(TESTSPSFILES)) define definePostScriptTest $(call defineTest,$(basename $(notdir $1)),ps_build,\ - $(GSCMDLINE) -q -sOutputFile='$$(call OSPath,$1)' '$$(call OSPath,$2)';,\ + $(GSCMDLINE) -q -sOutputFile='$1' '$2';,\ $2 $3 \ ) @@ -59,8 +59,8 @@ definePostScriptTests = $(foreach test,$(TESTSPSFILES),$(call definePostScriptTe define definePostScriptBuildTest $(call defineTest,$(basename $(notdir $1)),ps_build,\ - $(GSCMDLINE) -q -sOutputFile='$$(call OSPath,$1)' '$$(call OSPath,$2)';\ - $$(call pushDeploymentArtifactFile,$$(notdir $1),$$(call OSPath,$1));,\ + $(GSCMDLINE) -q -sOutputFile='$1' '$2';\ + $$(call pushDeploymentArtifactFile,$$(notdir $1),$1);,\ $2 $3 \ ) diff --git a/ITG.MakeUtils/tests.mk b/ITG.MakeUtils/tests.mk index c3cbc843..44f24cb9 100644 --- a/ITG.MakeUtils/tests.mk +++ b/ITG.MakeUtils/tests.mk @@ -16,7 +16,7 @@ testPlatformSetStatus = $$$${Function:Set-UnitTestStatusInformation} # $(call testPlatformWrapper,testId,testScript) testPlatformWrapper = \ - Test-UnitTest -TestId '$1' -FileName '$$(call OSPath,$$<)' -ScriptBlock { $2 } -StatusWriter $(testPlatformSetStatus) -TestCreator $(testPlatformAddTest); + Test-UnitTest -TestId '$1' -FileName '$$<' -ScriptBlock { $2 } -StatusWriter $(testPlatformSetStatus) -TestCreator $(testPlatformAddTest); # $(call defineTest,id,targetId,script,dependencies) define defineTest diff --git a/encodings/Makefile b/encodings/Makefile index e88132e5..d7ae4d00 100644 --- a/encodings/Makefile +++ b/encodings/Makefile @@ -23,14 +23,14 @@ MAPPINGSDIR = maps/ $(MAPPINGSDIR)MAPPINGS/%.TXT: $(call writeinformation,Downloading file "$(@F)"...) $(MAKETARGETDIR) - $(CURL) "http://www.unicode.org/Public/MAPPINGS/$*.TXT" -o $(call OSPath,$@) + $(CURL) "http://www.unicode.org/Public/MAPPINGS/$*.TXT" -o '$@' $(TOUCH) $@ $(call writeinformation,File "$(@F)" is downloaded.) $(OUTPUTDIR)%.ps: $(call writeinformation,Creating PostScript encoding file "$(@F)" from "$<"...) $(MAKETARGETDIR) - ./New-PostscriptEncodingTable.ps1 -EncodingSourceFilePath $(call OSPath,$<) -FilePath $(call OSPath,$@) $(VERBOSEFLAGS) + ./New-PostscriptEncodingTable.ps1 -EncodingSourceFilePath '$<' -FilePath '$@' $(VERBOSEFLAGS) $(call writeinformation,File "$(@F)" is ready.) # $(call mapPSEncodingFileToSource, uri, encoding)