diff --git a/Makefile b/Makefile index 205c9ae46c..0608ebc6ed 100755 --- a/Makefile +++ b/Makefile @@ -1,14 +1,18 @@ # Top level declarations -help: - @echo Please define target: - @echo " - Prerequisite: third_party third_party_check clean_third_party" - @echo " - C++: cc help_cc test_cc clean_cc" - @echo " - Python: python help_python test_python clean_python" - @echo " - Java: java help_java test_java clean_java" - @echo " - .NET (CSharp): csharp help_csharp test_csharp clean_csharp" - @echo " - .NET (FSharp): fsharp help_fsharp test_fsharp clean_fsharp" - @echo " - all: all test clean" - @echo " - detect: detect_port detect_python detect_java detect_csharp detect_fsharp" +.PHONY: help +help: help_all + +.PHONY: all +all: build_all + +.PHONY: test +test: test_all + +.PHONY: clean +clean: clean_all + +.PHONY: detect +detect: detect_all # OR_ROOT is the minimal prefix to define the root of or-tools, if we # are compiling in the or-tools root, it is empty. Otherwise, it is @@ -30,13 +34,6 @@ else endif endif -.PHONY : help cc python java csharp fsharp sat -all: third_party_check cc java python csharp fsharp - @echo Or-tools have been built for $(BUILT_LANGUAGES) - -.PHONY: clean -clean: clean_cc clean_java clean_python clean_csharp clean_compat clean_fsharp - # Read version. include $(OR_ROOT)Version.txt @@ -69,14 +66,32 @@ include $(OR_ROOT)makefiles/Makefile.test.mk # Finally include user makefile if it exists -include $(OR_ROOT)Makefile.user -#check if "make third_party" have been run or not -.PHONY: third_party_check -third_party_check: -ifeq ($(wildcard dependencies/install/include/gflags/gflags.h),) - @echo "One of the third party files was not found! did you run 'make third_party'?" && exit 1 -endif +.PHONY: help_usage +help_usage: + @echo Use one of the following targets: + @echo help, help_all: Print this help. + @echo all: Build OR-Tools for all available languages \(need a call to \"make third_party\" first\). + @echo test, test_all: Test OR-Tools for all available languages. + @echo clean, clean_all: Clean output from previous build for all available languages \(won\'t clean third party\). + @echo detect, detect_all: Show variables used to build OR-Tools for all available languages. + @echo "" -.PHONY: detect -detect: detect_port detect_cc detect_python detect_java detect_csharp detect_fsharp +.PHONY: help_all +help_all: help_usage help_third_party help_cc help_python help_java help_csharp help_fsharp + +.PHONY: build_all +build_all: cc python java csharp fsharp + @echo Or-tools have been built for $(BUILT_LANGUAGES) + +.PHONY: test_all +test_all: test_cc test_python test_java test_csharp test_fsharp + @echo Or-tools have been built and tested for $(BUILT_LANGUAGES) + +.PHONY: clean_all +clean_all: clean_cc clean_python clean_java clean_csharp clean_compat clean_fsharp + @echo Or-tools have been cleaned for $(BUILT_LANGUAGES) + +.PHONY: detect_all +detect_all: detect_port detect_cc detect_python detect_java detect_csharp detect_fsharp print-% : ; @echo $* = $($*) diff --git a/makefiles/Makefile.cpp.mk b/makefiles/Makefile.cpp.mk index 8945b16f4c..c3de71c7af 100755 --- a/makefiles/Makefile.cpp.mk +++ b/makefiles/Makefile.cpp.mk @@ -1,7 +1,7 @@ # ---------- C++ support ---------- -.PHONY: help_cc # Generate list of targets with descriptions. +.PHONY: help_cc # Generate list of C++ targets with descriptions. help_cc: - @echo Use one of the following targets: + @echo Use one of the following C++ targets: ifeq ($(SYSTEM),win) @tools\grep.exe "^.PHONY: .* #" $(CURDIR)/makefiles/Makefile.cpp.mk | tools\sed.exe "s/\.PHONY: \(.*\) # \(.*\)/\1\t\2/" else @@ -12,7 +12,7 @@ endif # Main target .PHONY: cc # Build C++ OR-Tools. -cc: ortoolslibs ccexe +cc: third_party_check ortoolslibs ccexe .PHONY: test_cc # Test C++ OR-Tools using various examples. test_cc: test_cc_examples BUILT_LANGUAGES += C++ diff --git a/makefiles/Makefile.csharp.mk b/makefiles/Makefile.csharp.mk index 2e8ee704e2..fe4e240cfc 100755 --- a/makefiles/Makefile.csharp.mk +++ b/makefiles/Makefile.csharp.mk @@ -1,7 +1,7 @@ # ---------- CSharp support using SWIG ---------- -.PHONY: help_csharp # Generate list of targets with descriptions. +.PHONY: help_csharp # Generate list of C# targets with descriptions. help_csharp: - @echo Use one of the following targets: + @echo Use one of the following C# targets: ifeq ($(SYSTEM),win) @tools\grep.exe "^.PHONY: .* #" $(CURDIR)/makefiles/Makefile.csharp.mk | tools\sed.exe "s/\.PHONY: \(.*\) # \(.*\)/\1\t\2/" else diff --git a/makefiles/Makefile.fsharp.mk b/makefiles/Makefile.fsharp.mk index a7bbb0f2a9..1903dbdeaf 100644 --- a/makefiles/Makefile.fsharp.mk +++ b/makefiles/Makefile.fsharp.mk @@ -1,7 +1,7 @@ # ---------- FSharp support using SWIG ---------- -.PHONY: help_fsharp # Generate list of targets with descriptions. +.PHONY: help_fsharp # Generate list of F# targets with descriptions. help_fsharp: - @echo Use one of the following targets: + @echo Use one of the following F# targets: ifeq ($(SYSTEM),win) @tools\grep.exe "^.PHONY: .* #" $(CURDIR)/makefiles/Makefile.fsharp.mk | tools\sed.exe "s/\.PHONY: \(.*\) # \(.*\)/\1\t\2/" else diff --git a/makefiles/Makefile.java.mk b/makefiles/Makefile.java.mk index aa9bbc588a..c2e9b8b7e8 100755 --- a/makefiles/Makefile.java.mk +++ b/makefiles/Makefile.java.mk @@ -1,7 +1,7 @@ # ---------- Java support using SWIG ---------- -.PHONY: help_java # Generate list of targets with descriptions. +.PHONY: help_java # Generate list of Java targets with descriptions. help_java: - @echo Use one of the following targets: + @echo Use one of the following Java targets: ifeq ($(SYSTEM),win) @tools\grep.exe "^.PHONY: .* #" $(CURDIR)/makefiles/Makefile.java.mk | tools\sed.exe "s/\.PHONY: \(.*\) # \(.*\)/\1\t\2/" else diff --git a/makefiles/Makefile.python.mk b/makefiles/Makefile.python.mk index acd89e1fc8..d32ca83998 100755 --- a/makefiles/Makefile.python.mk +++ b/makefiles/Makefile.python.mk @@ -1,7 +1,7 @@ # ---------- Python support using SWIG ---------- -.PHONY: help_python # Generate list of targets with descriptions. +.PHONY: help_python # Generate list of Python targets with descriptions. help_python: - @echo Use one of the following targets: + @echo Use one of the following Python targets: ifeq ($(SYSTEM),win) @tools\grep.exe "^.PHONY: .* #" $(CURDIR)/makefiles/Makefile.python.mk | tools\sed.exe "s/\.PHONY: \(.*\) # \(.*\)/\1\t\2/" else diff --git a/makefiles/Makefile.test.mk b/makefiles/Makefile.test.mk index cbcaf161ad..8d0d67bf83 100755 --- a/makefiles/Makefile.test.mk +++ b/makefiles/Makefile.test.mk @@ -1,7 +1,5 @@ -.PHONY: test -test: test_cc test_python test_java test_csharp test_fsharp - @echo Or-tools have been built and tested for $(BUILT_LANGUAGES) - +# Targets to run tests +.PHONY: test_cc_examples test_cc_examples: cc $(BIN_DIR)$Sgolomb$E --size=5 $(BIN_DIR)$Scvrptw$E @@ -10,6 +8,7 @@ test_cc_examples: cc $(BIN_DIR)$Sinteger_programming$E $(BIN_DIR)$Stsp$E +.PHONY: test_python_examples test_python_examples: python $(SET_PYTHONPATH) $(PYTHON_EXECUTABLE) $(EX_DIR)$Spython$Shidato_table.py $(SET_PYTHONPATH) $(PYTHON_EXECUTABLE) $(EX_DIR)$Spython$Stsp.py @@ -21,11 +20,13 @@ test_python_examples: python $(SET_PYTHONPATH) $(PYTHON_EXECUTABLE) $(EX_DIR)$Stests$Stest_cp_api.py $(SET_PYTHONPATH) $(PYTHON_EXECUTABLE) $(EX_DIR)$Stests$Stest_lp_api.py +.PHONY: test_java_examples test_java_examples: java run_RabbitsPheasants run_FlowExample \ run_Tsp run_LinearProgramming run_IntegerProgramming \ run_Knapsack run_MultiThreadIntegerProgramming # csharp test +.PHONY: test_csharp_examples test_csharp_examples: \ $(CSHARPEXE) \ $(BIN_DIR)/testlp$(CLR_EXE_SUFFIX).exe \ @@ -49,5 +50,6 @@ test_csharp_examples: \ $(MONO) $(BIN_DIR)$Stestcp$(CLR_EXE_SUFFIX).exe $(MONO) $(BIN_DIR)$Stest_sat_model$(CLR_EXE_SUFFIX).exe +.PHONY: test_fsharp_examples test_fsharp_examples: fsharp $(warning F# tests unimplemented) diff --git a/makefiles/Makefile.third_party.unix.mk b/makefiles/Makefile.third_party.unix.mk index d038b2f6c6..edcb891cb9 100644 --- a/makefiles/Makefile.third_party.unix.mk +++ b/makefiles/Makefile.third_party.unix.mk @@ -1,5 +1,9 @@ -# SVN tags of dependencies to checkout. +.PHONY: help_third_party # Generate list of Prerequisite targets with descriptions. +help_third_party: + @echo Use one of the following Prerequisite targets: + @grep "^.PHONY: .* #" $(CURDIR)/makefiles/Makefile.third_party.unix.mk | sed "s/\.PHONY: \(.*\) # \(.*\)/\1\t\2/" | expand -t20 +# Tags of dependencies to checkout. GFLAGS_TAG = 2.2.1 PROTOBUF_TAG = 3.5.1 GLOG_TAG = 0.3.5 @@ -16,11 +20,16 @@ ifeq ($(PLATFORM), MACOSX) endif # Main target. -.PHONY: makefile_third_party missing_directories +.PHONY: third_party # Build OR-Tools Prerequisite third_party: makefile_third_party install_third_party -# Create missing directories +.PHONY: third_party_check # Check if "make third_party" have been run or not +third_party_check: +ifeq ($(wildcard dependencies/install/include/gflags/gflags.h),) + @echo "One of the third party files was not found! did you run 'make third_party'?" && exit 1 +endif +# Create missing directories MISSING_DIRECTORIES = \ dependencies/install \ dependencies/archives \ @@ -58,6 +67,7 @@ MISSING_DIRECTORIES = \ ortools/gen/ortools/linear_solver \ ortools/gen/ortools/sat +.PHONY: makefile_third_party missing_directories missing_directories: $(MISSING_DIRECTORIES) install_third_party: \ @@ -258,9 +268,7 @@ dependencies/sources/patchelf-$(PATCHELF_TAG)/configure: git clone --quiet -b $(PATCHELF_TAG) https://github.com/NixOS/patchelf.git dependencies/sources/patchelf-$(PATCHELF_TAG) cd dependencies/sources/patchelf-$(PATCHELF_TAG) && ./bootstrap.sh - # Install Java protobuf - dependencies/install/lib/protobuf.jar: dependencies/install/bin/protoc cd dependencies/sources/protobuf-$(PROTOBUF_TAG)/java && \ ../../../install/bin/protoc --java_out=core/src/main/java -I../src \ @@ -271,7 +279,8 @@ dependencies/install/lib/protobuf.jar: dependencies/install/bin/protoc # Install C# protobuf #create .snk file if strong named dll is required (this is the default behaviour) -# Clean everything. + +.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 -$(DELREC) dependencies/archives/Cbc* diff --git a/makefiles/Makefile.third_party.win.mk b/makefiles/Makefile.third_party.win.mk index c8342a4e72..8d4d7db520 100644 --- a/makefiles/Makefile.third_party.win.mk +++ b/makefiles/Makefile.third_party.win.mk @@ -1,3 +1,8 @@ +.PHONY: help_third_party # Generate list of Prerequisite targets with descriptions. +help_third_party: + @echo Use one of the following Prerequisite targets: + @tools\grep.exe "^.PHONY: .* #" $(CURDIR)/makefiles/Makefile.third_party.win.mk | tools\sed.exe "s/\.PHONY: \(.*\) # \(.*\)/\1\t\2/" + # tags of dependencies to checkout. GFLAGS_TAG = 2.2.1 PROTOBUF_TAG = 3.5.1 @@ -11,11 +16,16 @@ SWIG_TAG = 3.0.12 TSVNCACHE_EXE = TSVNCache.exe # Main target. -.PHONY: third_party build_third_party makefile_third_party +.PHONY: third_party # Build OR-Tools Prerequisite third_party: build_third_party makefile_third_party -# Create missing directories +.PHONY: third_party_check # Check if "make third_party" have been run or not +third_party_check: +ifeq ($(wildcard dependencies/install/include/gflags/gflags.h),) + @echo "One of the third party files was not found! did you run 'make third_party'?" && exit 1 +endif +# Create missing directories MISSING_DIRECTORIES = \ bin \ lib \ @@ -53,6 +63,7 @@ MISSING_DIRECTORIES = \ missing_directories: $(MISSING_DIRECTORIES) +.PHONY: build_third_party build_third_party: \ install_directories \ archives_directory \ @@ -353,7 +364,7 @@ kill_tortoisesvn_cache: remove_readonly_svn_attribs: kill_tortoisesvn_cache if exist dependencies\sources\* $(ATTRIB) -r /s dependencies\sources\* -# Clean everything. Remember to also delete archived dependencies, i.e. in the event of download failure, etc. +.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\archives\swigwin*.zip @@ -374,6 +385,7 @@ clean_third_party: remove_readonly_svn_attribs -$(DELREC) dependencies\install # Create Makefile.local +.PHONY: makefile_third_party makefile_third_party: Makefile.local # Make sure that local file lands correctly across platforms