aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2020-03-13 00:16:20 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2020-03-13 00:16:20 +0300
commit26e0acd8301b3ace7e649cf53a580ae8b70333f0 (patch)
tree980690c4777e5e4924a85a4e108e7e0f72070441
parentboost/build: download timeouts (diff)
downloadcmake-common-26e0acd8301b3ace7e649cf53a580ae8b70333f0.tar.gz
cmake-common-26e0acd8301b3ace7e649cf53a580ae8b70333f0.zip
Makefile: best practices
-rw-r--r--.ci/Makefile51
1 files changed, 39 insertions, 12 deletions
diff --git a/.ci/Makefile b/.ci/Makefile
index 0c30f64..9553238 100644
--- a/.ci/Makefile
+++ b/.ci/Makefile
@@ -68,6 +68,7 @@ endif
.PHONY: all
all: simple static dynamic
+.PHONY: FORCE
FORCE:
echo/%/build: FORCE
@@ -92,39 +93,45 @@ echo/%/finished: FORCE
# examples/simple: x64/Release build.
+.PHONY: simple/build
simple/build: echo/simple/build
"$(python)" cmake/build/build.py --install "$(install_prefix)/simple" --configuration Release -- cmake/examples/simple $(x64_args)
+.PHONY: simple/run
simple/run: echo/simple/run
"$(install_prefix)/simple/bin/foo"
+.PHONY: simple/verify
simple/verify: echo/simple/verify
$(verify_arch) "$(install_prefix)/simple/bin/foo$(ext)" x64
+.PHONY: simple
simple: simple/build simple/run simple/verify echo/simple/finished
-.PHONY: simple simple/build simple/run simple/verify
-
# examples/static: x86/Debug build.
+.PHONY: static/build
static/build: echo/static/build
"$(python)" cmake/build/build.py --install "$(install_prefix)/static" --configuration Debug -- cmake/examples/static $(x86_args)
+.PHONY: static/run
static/run: echo/static/run
"$(install_prefix)/static/bin/foo"
+.PHONY: static/verify
static/verify: echo/static/verify
$(verify_arch) "$(install_prefix)/static/bin/foo$(ext)" x86
+.PHONY: static
static: static/build static/run static/verify echo/static/finished
-.PHONY: static static/build static/run static/verify
-
# examples/dynamic: x64/RelWithDebInfo build.
+.PHONY: dynamic/build
dynamic/build: echo/dynamic/build
"$(python)" cmake/build/build.py --install "$(install_prefix)/dynamic" --configuration RelWithDebInfo -- cmake/examples/dynamic $(x64_args)
+.PHONY: dynamic/run
# Windows can pick up DLLs in the same directory, otherwise we need to add them
# to PATH.
dynamic/run: echo/dynamic/run
@@ -134,13 +141,13 @@ else
LD_LIBRARY_PATH="$(install_prefix)/dynamic/lib" "$(install_prefix)/dynamic/bin/foo"
endif
+.PHONY: dynamic/verify
dynamic/verify: echo/dynamic/verify
$(verify_arch) "$(install_prefix)/dynamic/bin/foo$(ext)" x64
+.PHONY: dynamic
dynamic: dynamic/build dynamic/run dynamic/verify echo/dynamic/finished
-.PHONY: dynamic dynamic/build dynamic/run dynamic/verify
-
echo/boost/%/build: FORCE
$(newline)
@echo =====================================================================
@@ -177,49 +184,60 @@ echo/boost/%/finished: FORCE
# examples/boost:
# * x86/Debug build.
+.PHONY: boost/58/download
boost/58/download: echo/boost/58/build
"$(python)" boost/build/build.py download 1.58.0
+.PHONY: boost/58/build
boost/58/build:
"$(python)" boost/build/build.py build --configuration Debug --platform x86 --link static -- ./boost_1_58_0 --with-filesystem --with-program_options $(b2_flags)
+.PHONY: boost/58/ls
boost/58/ls: echo/boost/58/ls
$(ls) "./boost_1_58_0/stage"
+.PHONY: boost/58/exe/build
boost/58/exe/build: echo/boost/58/exe/build
"$(python)" cmake/build/build.py --install "$(install_prefix)/boost_1_58_0" --configuration Debug -- cmake/examples/boost $(x86_args) -D "BOOST_ROOT=$(cwd)/boost_1_58_0" -D "BOOST_LIBRARYDIR=$(cwd)/boost_1_58_0/stage/x86/Debug/lib"
+.PHONY: boost/58/exe/run
# Boost should be linked statically, no need to adjust PATH:
boost/58/exe/run: echo/boost/58/exe/run
"$(install_prefix)/boost_1_58_0/bin/foo"
+.PHONY: boost/58/exe/verify
boost/58/exe/verify: echo/boost/58/exe/verify
$(verify_arch) "$(install_prefix)/boost_1_58_0/bin/foo$(ext)" x86
+.PHONY: boost/58/exe
boost/58/exe: boost/58/exe/build boost/58/exe/run boost/58/exe/verify
+.PHONY: boost/58
boost/58: boost/58/download boost/58/build boost/58/ls boost/58/exe echo/boost/58/finished
-.PHONY: boost/58 boost/58/download boost/58/build boost/58/ls boost/58/exe boost/58/exe/build boost/58/exe/run boost/58/exe/verify
-
# Boost 1.72.0:
# * cached download,
# * x86 & x64, Debug & Release, shared libraries only.
# examples/boost:
# * x64/Release build.
+.PHONY: boost/72/download
boost/72/download: echo/boost/72/build
"$(python)" boost/build/build.py download --cache . 1.72.0
+.PHONY: boost/72/build
boost/72/build:
"$(python)" boost/build/build.py build --platform x86 x64 --link shared -- ./boost_1_72_0 --with-filesystem --with-program_options $(b2_flags)
+.PHONY: boost/72/ls
boost/72/ls: echo/boost/72/ls
$(ls) "./boost_1_72_0/stage"
+.PHONY: boost/72/exe/build
boost/72/exe/build: echo/boost/72/exe/build
"$(python)" cmake/build/build.py --install "$(install_prefix)/boost_1_72_0" --configuration Release -- cmake/examples/boost $(x64_args) -D "BOOST_ROOT=$(cwd)/boost_1_72_0" -D "BOOST_LIBRARYDIR=$(cwd)/boost_1_72_0/stage/x64/Release/lib" -D Boost_USE_STATIC_LIBS=OFF
+.PHONY: boost/72/exe/run
# Boost is linked dynamically, we need to adjust PATH:
boost/72/exe/run: echo/boost/72/exe/run
ifeq ($(windows),1)
@@ -228,15 +246,16 @@ else
LD_LIBRARY_PATH="$(cwd)/boost_1_72_0/stage/x64/Release/lib" "$(install_prefix)/boost_1_72_0/bin/foo"
endif
+.PHONY: boost/72/exe/verify
boost/72/exe/verify: echo/boost/72/exe/verify
$(verify_arch) "$(install_prefix)/boost_1_72_0/bin/foo$(ext)" x64
+.PHONY: boost/72/exe
boost/72/exe: boost/72/exe/build boost/72/exe/run boost/72/exe/verify
+.PHONY: boost/72
boost/72: boost/72/download boost/72/build boost/72/ls boost/72/exe echo/boost/72/finished
-.PHONY: boost/72 boost/72/download boost/72/build boost/72/ls boost/72/exe boost/72/exe/build boost/72/exe/run boost/72/exe/verify
-
# Boost 1.65.0:
# * download to $HOME (on Travis), C:\projects (on AppVeyor),
# * x64, MinSizeRel (= Release), static & shared libraries.
@@ -244,34 +263,42 @@ boost/72: boost/72/download boost/72/build boost/72/ls boost/72/exe echo/boost/7
# * x64/MinSizeRel build (set in .travis.yml and .appveyor.yml).
ifdef TRAVIS
+.PHONY: boost/65/build
boost/65/build: echo/boost/65/build
"$(python)" boost/build/ci/travis.py --link static -- --with-filesystem --with-program_options $(b2_flags)
+.PHONY: boost/65/ls
boost/65/ls: echo/boost/65/ls
$(ls) "$$HOME/boost/stage"
+.PHONY: boost/65/exe/build
boost/65/exe/build: echo/boost/65/exe/build
TRAVIS_BUILD_DIR="$$TRAVIS_BUILD_DIR/cmake/examples/boost" "$(python)" cmake/build/ci/travis.py --install "$(install_prefix)/boost_1_65_0" -- -D "BOOST_ROOT=$$HOME/boost" -D "BOOST_LIBRARYDIR=$$HOME/boost/stage/$$platform/$$configuration/lib"
endif
ifdef APPVEYOR
+.PHONY: boost/65/build
boost/65/build: echo/boost/65/build
"$(python)" boost/build/ci/appveyor.py --link static -- --with-filesystem --with-program_options $(b2_flags)
+.PHONY: boost/65/ls
boost/65/ls: echo/boost/65/ls
$(ls) "C:/projects/boost/stage"
+.PHONY: boost/65/exe/build
boost/65/exe/build: echo/boost/65/exe/build
set "APPVEYOR_BUILD_FOLDER=%APPVEYOR_BUILD_FOLDER%\cmake\examples\boost" && "$(python)" cmake/build/ci/appveyor.py --install "$(install_prefix)/boost_1_65_0" -- -D "BOOST_ROOT=C:\projects\boost" -D "BOOST_LIBRARYDIR=C:\projects\boost\stage\%PLATFORM%\%CONFIGURATION%\lib"
endif
+.PHONY: boost/65/exe/run
boost/65/exe/run: echo/boost/65/exe/run
"$(install_prefix)/boost_1_65_0/bin/foo"
+.PHONY: boost/65/exe/verify
boost/65/exe/verify: echo/boost/65/exe/verify
$(verify_arch) "$(install_prefix)/boost_1_65_0/bin/foo$(ext)" x64
+.PHONY: boost/65/exe
boost/65/exe: boost/65/exe/build boost/65/exe/run boost/65/exe/verify
+.PHONY: boost/65
boost/65: boost/65/build boost/65/ls boost/65/exe echo/boost/65/finished
-
-.PHONY: boost/65 boost/65/build boost/65/ls boost/65/exe boost/65/exe/build boost/65/exe/run boost/65/exe/verify