Skip to content
This repository has been archived by the owner on Jul 26, 2021. It is now read-only.

Commit

Permalink
* отказались, где возможно, от OSPath (#51)
Browse files Browse the repository at this point in the history
  • Loading branch information
sergey-s-betke committed Jun 20, 2018
1 parent 85162fe commit 35a40c5
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 25 deletions.
50 changes: 34 additions & 16 deletions ITG.MakeUtils/common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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

Expand Down Expand Up @@ -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)) \
Expand All @@ -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)) \
Expand All @@ -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)) \
Expand Down Expand Up @@ -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)
Expand All @@ -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)%:
Expand Down Expand Up @@ -279,7 +297,7 @@ endef

ifdef ROOT_PROJECT_DIR
$(ROOT_PROJECT_DIR)%:
$(MAKETOOL) -C $(ROOT_PROJECT_DIR) $*
$(call MAKE_SUBPROJECT_TARGET, $*)

endif

Expand Down
12 changes: 6 additions & 6 deletions ITG.MakeUtils/ghostscript.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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.)


Expand All @@ -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 \
)

Expand All @@ -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 \
)

Expand Down
2 changes: 1 addition & 1 deletion ITG.MakeUtils/tests.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions encodings/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 35a40c5

Please sign in to comment.