Makefile: fixup dependencies on phony target third_party_check

- make cc twice do nothing as expected (and all targets which depends on it)
This commit is contained in:
Corentin Le Molgat
2018-09-04 15:50:22 +02:00
parent cd3f8748d1
commit 60aca4edc4
4 changed files with 89 additions and 79 deletions

2
.gitignore vendored
View File

@@ -7,7 +7,7 @@ dependencies/archives/
dependencies/install/
dependencies/sources/
dependencies/check.log
or-tools*.tar.gz
or-tools*.zip

View File

@@ -144,7 +144,7 @@ include $(OR_ROOT)makefiles/Makefile.gen.mk
# OR Tools unique library.
$(OR_TOOLS_LIBS): \
third_party_check \
dependencies/check.log \
$(BASE_LIB_OBJS) \
$(PORT_LIB_OBJS) \
$(UTIL_LIB_OBJS) \

View File

@@ -30,10 +30,12 @@ PATCHELF_TAG = 0.9
# Main target.
.PHONY: third_party # Build OR-Tools Prerequisite
third_party: makefile_third_party build_third_party
third_party: build_third_party
.PHONY: third_party_check # Check if "make third_party" have been run or not
third_party_check:
.PHONY: third_party_check # Check if third parties are all found
third_party_check: dependencies/check.log
dependencies/check.log: Makefile.local
ifeq ($(wildcard $(UNIX_GFLAGS_DIR)/include/gflags/gflags.h),)
$(error Third party GFlags files was not found! did you run 'make third_party' or set UNIX_GFLAGS_DIR ?)
else
@@ -79,6 +81,7 @@ ifeq ($(wildcard $(UNIX_CBC_DIR)/include/cbc/coin/CbcModel.hpp $(UNIX_CBC_DIR)/i
else
$(info CBC: found)
endif
# Optional dependencies
ifndef UNIX_CPLEX_DIR
$(info CPLEX: not found)
endif
@@ -91,9 +94,11 @@ endif
ifndef UNIX_SCIP_DIR
$(info SCIP: not found)
endif
$(TOUCH) $@
.PHONY: build_third_party
build_third_party: \
Makefile.local \
archives_directory \
install_deps_directories \
build_gflags \
@@ -131,6 +136,56 @@ dependencies/install/include: | dependencies/install
dependencies/install/include/coin: | dependencies/install/include
$(MKDIR_P) dependencies$Sinstall$Sinclude$Scoin
######################
## Makefile.local ##
######################
# Make sure that local file lands correctly across platforms
Makefile.local: makefiles/Makefile.third_party.$(SYSTEM).mk
-$(DEL) Makefile.local
@echo Generating Makefile.local
@echo "# Define UNIX_SWIG_BINARY to use a custom version." >> Makefile.local
@echo "# e.g. UNIX_SWIG_BINARY = /opt/swig-x.y.z/bin/swig" >> Makefile.local
@echo JAVA_HOME = $(JAVA_HOME)>> Makefile.local
@echo UNIX_PYTHON_VER = $(DETECTED_PYTHON_VERSION)>> Makefile.local
@echo >> Makefile.local
@echo "## OPTIONAL DEPENDENCIES ##" >> Makefile.local
@echo "# Define UNIX_CPLEX_DIR to use CPLEX" >> Makefile.local
@echo >> Makefile.local
@echo "# Define UNIX_GLPK_DIR to point to a compiled version of GLPK to use it" >> Makefile.local
@echo "# e.g. UNIX_GLPK_DIR = /opt/glpk-x.y.z" >> Makefile.local
@echo >> Makefile.local
@echo "# Define UNIX_GUROBI_DIR and GUROBI_LIB_VERSION to use Gurobi" >> Makefile.local
@echo >> Makefile.local
@echo "# Define UNIX_SCIP_DIR to point to a compiled version of SCIP to use it ">> Makefile.local
@echo "# e.g. UNIX_SCIP_DIR = <path>/scipoptsuite-6.0.0/scip" >> Makefile.local
@echo "# On Mac OS X, compile scip with: " >> Makefile.local
@echo "# make GMP=false READLINE=false TPI=tny ZIMPL=false" >> Makefile.local
@echo "# On Linux, compile scip with: " >> Makefile.local
@echo "# make GMP=false READLINE=false ZIMPL=false TPI=tny USRCFLAGS=-fPIC USRCXXFLAGS=-fPIC USRCPPFLAGS=-fPIC" >> Makefile.local
@echo >> Makefile.local
@echo "## REQUIRED DEPENDENCIES ##" >> Makefile.local
@echo "# By default they will be automatically built -> nothing to define" >> Makefile.local
@echo "# Define UNIX_GFLAGS_DIR to depend on external Gflags dynamic library" >> Makefile.local
@echo "# e.g. UNIX_GFLAGS_DIR = /opt/gflags-x.y.z" >> Makefile.local
@echo >> Makefile.local
@echo "# Define UNIX_GLOG_DIR to depend on external Glog dynamic library" >> Makefile.local
@echo "# e.g. UNIX_GLOG_DIR = /opt/glog-x.y.z" >> Makefile.local
@echo >> Makefile.local
@echo "# Define UNIX_PROTOBUF_DIR to depend on external Protobuf dynamic library" >> Makefile.local
@echo "# e.g. UNIX_PROTOBUF_DIR = /opt/protobuf-x.y.z" >> Makefile.local
@echo "# Define UNIX_PROTOC_BINARY to use a custom version." >> Makefile.local
@echo "# e.g. UNIX_PROTOC_BINARY = /opt/protoc-x.y.z/bin/protoc" >> Makefile.local
@echo "# (default: UNIX_PROTOBUF_DIR/bin/protoc)" >> Makefile.local
@echo >> Makefile.local
@echo "# Define UNIX_CBC_DIR to depend on external CBC dynamic library" >> Makefile.local
@echo "# e.g. UNIX_CBC_DIR = /opt/cbc-x.y.z" >> Makefile.local
@echo "# If you use a splitted version of CBC you can also define:" >> Makefile.local
@echo "# UNIX_CLP_DIR, UNIX_CGL_DIR, UNIX_OSI_DIR, UNIX_COINUTILS_DIR" >> Makefile.local
@echo "# note: by default they all point to UNIX_CBC_DIR" >> Makefile.local
@echo >> Makefile.local
@echo "# note: You don't need to run \"make third_party\" if you only use external dependencies" >> Makefile.local
@echo "# i.e. you define all UNIX_GFLAGS_DIR, UNIX_GLOG_DIR, UNIX_PROTOBUF_DIR and UNIX_CBC_DIR" >> Makefile.local
##############
## GFLAGS ##
##############
@@ -599,6 +654,7 @@ SWIG_BINARY = $(shell $(WHICH) $(UNIX_SWIG_BINARY))
.PHONY: clean_third_party # Clean everything. Remember to also delete archived dependencies, i.e. in the event of download failure, etc.
clean_third_party:
-$(DEL) Makefile.local
-$(DEL) dependencies/check.log
-$(DELREC) dependencies/archives/Cbc*
-$(DELREC) dependencies/archives/Cgl*
-$(DELREC) dependencies/archives/Clp*
@@ -628,56 +684,6 @@ clean_third_party:
-$(DELREC) dependencies/sources/patchelf*
-$(DELREC) dependencies/install
# Create Makefile.local
.PHONY: makefile_third_party
makefile_third_party: Makefile.local
Makefile.local: makefiles/Makefile.third_party.unix.mk
-$(DEL) Makefile.local
@echo Generating Makefile.local
@echo "# Define UNIX_SWIG_BINARY to use a custom version." >> Makefile.local
@echo "# e.g. UNIX_SWIG_BINARY = /opt/swig-x.y.z/bin/swig" >> Makefile.local
@echo JAVA_HOME = $(JAVA_HOME)>> Makefile.local
@echo UNIX_PYTHON_VER = $(DETECTED_PYTHON_VERSION)>> Makefile.local
@echo >> Makefile.local
@echo "## OPTIONAL DEPENDENCIES ##" >> Makefile.local
@echo "# Define UNIX_CPLEX_DIR to use CPLEX" >> Makefile.local
@echo >> Makefile.local
@echo "# Define UNIX_GLPK_DIR to point to a compiled version of GLPK to use it" >> Makefile.local
@echo "# e.g. UNIX_GLPK_DIR = /opt/glpk-x.y.z" >> Makefile.local
@echo >> Makefile.local
@echo "# Define UNIX_GUROBI_DIR and GUROBI_LIB_VERSION to use Gurobi" >> Makefile.local
@echo >> Makefile.local
@echo "# Define UNIX_SCIP_DIR to point to a compiled version of SCIP to use it ">> Makefile.local
@echo "# e.g. UNIX_SCIP_DIR = <path>/scipoptsuite-6.0.0/scip" >> Makefile.local
@echo "# On Mac OS X, compile scip with: " >> Makefile.local
@echo "# make GMP=false READLINE=false TPI=tny ZIMPL=false" >> Makefile.local
@echo "# On Linux, compile scip with: " >> Makefile.local
@echo "# make GMP=false READLINE=false ZIMPL=false TPI=tny USRCFLAGS=-fPIC USRCXXFLAGS=-fPIC USRCPPFLAGS=-fPIC" >> Makefile.local
@echo >> Makefile.local
@echo "## REQUIRED DEPENDENCIES ##" >> Makefile.local
@echo "# By default they will be automatically built -> nothing to define" >> Makefile.local
@echo "# Define UNIX_GFLAGS_DIR to depend on external Gflags dynamic library" >> Makefile.local
@echo "# e.g. UNIX_GFLAGS_DIR = /opt/gflags-x.y.z" >> Makefile.local
@echo >> Makefile.local
@echo "# Define UNIX_GLOG_DIR to depend on external Glog dynamic library" >> Makefile.local
@echo "# e.g. UNIX_GLOG_DIR = /opt/glog-x.y.z" >> Makefile.local
@echo >> Makefile.local
@echo "# Define UNIX_PROTOBUF_DIR to depend on external Protobuf dynamic library" >> Makefile.local
@echo "# e.g. UNIX_PROTOBUF_DIR = /opt/protobuf-x.y.z" >> Makefile.local
@echo "# Define UNIX_PROTOC_BINARY to use a custom version." >> Makefile.local
@echo "# e.g. UNIX_PROTOC_BINARY = /opt/protoc-x.y.z/bin/protoc" >> Makefile.local
@echo "# (default: UNIX_PROTOBUF_DIR/bin/protoc)" >> Makefile.local
@echo >> Makefile.local
@echo "# Define UNIX_CBC_DIR to depend on external CBC dynamic library" >> Makefile.local
@echo "# e.g. UNIX_CBC_DIR = /opt/cbc-x.y.z" >> Makefile.local
@echo "# If you use a splitted version of CBC you can also define:" >> Makefile.local
@echo "# UNIX_CLP_DIR, UNIX_CGL_DIR, UNIX_OSI_DIR, UNIX_COINUTILS_DIR" >> Makefile.local
@echo "# note: by default they all point to UNIX_CBC_DIR" >> Makefile.local
@echo >> Makefile.local
@echo "# note: You don't need to run \"make third_party\" if you only use external dependencies" >> Makefile.local
@echo "# i.e. you define all UNIX_GFLAGS_DIR, UNIX_GLOG_DIR, UNIX_PROTOBUF_DIR and UNIX_CBC_DIR" >> Makefile.local
.PHONY: detect_third_party # Show variables used to find third party
detect_third_party:
@echo Relevant info on third party:

View File

@@ -48,10 +48,12 @@ TSVNCACHE_EXE = TSVNCache.exe
# Main target.
.PHONY: third_party # Build OR-Tools Prerequisite
third_party: makefile_third_party build_third_party
third_party: build_third_party
.PHONY: third_party_check # Check if "make third_party" have been run or not
third_party_check:
.PHONY: third_party_check # Check if third parties are all found
third_party_check: dependencies/check.log
dependencies/check.log: Makefile.local
ifeq ($(wildcard $(WINDOWS_ZLIB_DIR)/include/zlib.h),)
$(error Third party ZLIB files was not found! did you run 'make third_party' or set WINDOWS_ZLIB_DIR ?)
else
@@ -109,9 +111,11 @@ endif
ifndef WINDOWS_SCIP_DIR
@echo SCIP: not found
endif
$(TOUCH) dependencies\check.log
.PHONY: build_third_party
build_third_party: \
Makefile.local \
archives_directory \
install_deps_directories \
install_zlib \
@@ -159,6 +163,26 @@ dependencies/install/include: dependencies/install
dependencies/install/include/coin: dependencies/install/include
$(MKDIR_P) dependencies$Sinstall$Sinclude$Scoin
######################
## Makefile.local ##
######################
# Make sure that local file lands correctly across platforms
Makefile.local: makefiles/Makefile.third_party.$(SYSTEM).mk
-$(DEL) Makefile.local
@echo $(SELECTED_PATH_TO_JDK)>> Makefile.local
@echo $(SELECTED_PATH_TO_PYTHON)>> Makefile.local
@echo # >> Makefile.local
@echo # Define WINDOWS_SCIP_DIR to point to a compiled version of SCIP to use it >> Makefile.local
@echo # e.g.: WINDOWS_SCIP_DIR = "relative_path/to/scip-4.0.0" >> Makefile.local
@echo # See instructions here: >> Makefile.local
@echo # http://or-tools.blogspot.com/2017/03/changing-way-we-link-with-scip.html >> Makefile.local
@echo # Define WINDOWS_GUROBI_DIR and GUROBI_LIB_VERSION to use Gurobi >> Makefile.local
@echo # >> Makefile.local
@echo # Define WINDOWS_ZLIB_DIR, WINDOWS_ZLIB_NAME, WINDOWS_GFLAGS_DIR, >> Makefile.local
@echo # WINDOWS_GLOG_DIR, WINDOWS_PROTOBUF_DIR, WINDOWS_SWIG_BINARY, >> Makefile.local
@echo # WINDOWS_CLP_DIR, WINDOWS_CBC_DIR if you wish to use a custom version >> Makefile.local
@echo # e.g.: WINDOWS_GFLAGS_DIR = "relative_path/to/gflags/dir" >> Makefile.local
############
## ZLIB ##
############
@@ -431,6 +455,7 @@ remove_readonly_svn_attribs: kill_tortoisesvn_cache
.PHONY: clean_third_party # Clean everything. Remember to also delete archived dependencies, i.e. in the event of download failure, etc.
clean_third_party: remove_readonly_svn_attribs
-$(DEL) Makefile.local
-$(DEL) dependencies\check.log
-$(DEL) dependencies\archives\swigwin*.zip
-$(DEL) dependencies\archives\Cbc*
-$(DEL) dependencies\archives\gflags*.zip
@@ -449,27 +474,6 @@ clean_third_party: remove_readonly_svn_attribs
-$(DELREC) dependencies\sources\sparsehash*
-$(DELREC) dependencies\install
# Create Makefile.local
.PHONY: makefile_third_party
makefile_third_party: Makefile.local
# Make sure that local file lands correctly across platforms
Makefile.local: makefiles/Makefile.third_party.$(SYSTEM).mk
-$(DEL) Makefile.local
@echo $(SELECTED_PATH_TO_JDK)>> Makefile.local
@echo $(SELECTED_PATH_TO_PYTHON)>> Makefile.local
@echo # >> Makefile.local
@echo # Define WINDOWS_SCIP_DIR to point to a compiled version of SCIP to use it >> Makefile.local
@echo # e.g.: WINDOWS_SCIP_DIR = "relative_path/to/scip-4.0.0" >> Makefile.local
@echo # See instructions here: >> Makefile.local
@echo # http://or-tools.blogspot.com/2017/03/changing-way-we-link-with-scip.html >> Makefile.local
@echo # Define WINDOWS_GUROBI_DIR and GUROBI_LIB_VERSION to use Gurobi >> Makefile.local
@echo # >> Makefile.local
@echo # Define WINDOWS_ZLIB_DIR, WINDOWS_ZLIB_NAME, WINDOWS_GFLAGS_DIR, >> Makefile.local
@echo # WINDOWS_GLOG_DIR, WINDOWS_PROTOBUF_DIR, WINDOWS_SWIG_BINARY, >> Makefile.local
@echo # WINDOWS_CLP_DIR, WINDOWS_CBC_DIR if you wish to use a custom version >> Makefile.local
@echo # e.g.: WINDOWS_GFLAGS_DIR = "relative_path/to/gflags/dir" >> Makefile.local
.PHONY: detect_third_party # Show variables used to find third party
detect_third_party:
@echo Relevant info on third party: