2025-01-10 11:35:44 +01:00
|
|
|
# Copyright 2010-2025 Google LLC
|
2022-10-05 18:33:10 +02:00
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
|
# you may not use this file except in compliance with the License.
|
|
|
|
|
# You may obtain a copy of the License at
|
|
|
|
|
#
|
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
#
|
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
|
# limitations under the License.
|
|
|
|
|
|
2011-08-11 18:43:41 +00:00
|
|
|
# Top level declarations
|
2018-03-02 13:41:00 +01:00
|
|
|
.PHONY: help
|
|
|
|
|
help: help_all
|
|
|
|
|
|
2022-05-25 11:54:45 +02:00
|
|
|
.PHONY: detect
|
|
|
|
|
detect: detect_all
|
|
|
|
|
|
2018-03-02 13:41:00 +01:00
|
|
|
.PHONY: all
|
|
|
|
|
all: build_all
|
|
|
|
|
|
2019-01-16 14:27:15 +01:00
|
|
|
.PHONY: check
|
|
|
|
|
check: check_all
|
|
|
|
|
|
2018-03-02 13:41:00 +01:00
|
|
|
.PHONY: test
|
|
|
|
|
test: test_all
|
|
|
|
|
|
2022-05-25 11:54:45 +02:00
|
|
|
.PHONY: archive
|
|
|
|
|
archive: archive_all
|
|
|
|
|
|
2018-03-02 13:41:00 +01:00
|
|
|
.PHONY: clean
|
|
|
|
|
clean: clean_all
|
|
|
|
|
|
2012-03-28 00:09:22 +00:00
|
|
|
# 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
|
2012-03-28 15:10:00 +00:00
|
|
|
# $(OR_TOOLS_TOP)/ or $(OR_TOOLS_TOP)\\ depending on the platform. It
|
|
|
|
|
# contains the trailing separator if not empty.
|
2012-03-28 00:09:22 +00:00
|
|
|
#
|
2012-03-28 00:26:48 +00:00
|
|
|
# OR_ROOT_FULL is always the complete path to or-tools. It is useful
|
|
|
|
|
# to store path informations inside libraries for instance.
|
2012-03-28 04:57:54 +00:00
|
|
|
ifeq ($(OR_TOOLS_TOP),)
|
2012-03-28 00:26:48 +00:00
|
|
|
OR_ROOT =
|
2012-03-27 21:50:20 +00:00
|
|
|
else
|
2017-01-12 17:51:41 +01:00
|
|
|
ifeq ($(OS), Windows_NT)
|
2012-03-28 04:57:54 +00:00
|
|
|
OR_ROOT = $(OR_TOOLS_TOP)\\
|
2012-03-28 00:09:22 +00:00
|
|
|
else
|
2017-01-12 17:51:41 +01:00
|
|
|
OR_ROOT = $(OR_TOOLS_TOP)/
|
2012-03-28 00:09:22 +00:00
|
|
|
endif
|
2012-03-27 21:50:20 +00:00
|
|
|
endif
|
2012-01-13 10:28:29 +00:00
|
|
|
|
2018-06-29 18:00:32 +02:00
|
|
|
# Delete all implicit rules to speed up makefile
|
|
|
|
|
.SUFFIXES:
|
|
|
|
|
# Remove some rules from gmake that .SUFFIXES does not remove.
|
|
|
|
|
SUFFIXES =
|
|
|
|
|
|
|
|
|
|
# Keep all intermediate files
|
|
|
|
|
# ToDo: try to remove it later
|
|
|
|
|
.SECONDARY:
|
|
|
|
|
|
2017-06-07 10:26:41 +02:00
|
|
|
# Read version.
|
2022-06-02 15:37:05 +02:00
|
|
|
ifeq ($(OR_TOOLS_MAJOR)$(OR_TOOLS_MINOR),)
|
|
|
|
|
include $(OR_ROOT)Version.txt
|
|
|
|
|
endif
|
2017-06-07 10:26:41 +02:00
|
|
|
|
2022-03-07 14:05:12 +01:00
|
|
|
# We try to detect the platform, and load system specific macros.
|
2017-07-31 09:45:30 -07:00
|
|
|
include $(OR_ROOT)makefiles/Makefile.port.mk
|
2012-03-28 04:57:54 +00:00
|
|
|
OR_ROOT_FULL=$(OR_TOOLS_TOP)
|
2011-12-04 20:05:48 +00:00
|
|
|
|
2018-10-29 14:17:53 +01:00
|
|
|
# Check SOURCE argument
|
|
|
|
|
SOURCE_SUFFIX = $(suffix $(SOURCE))
|
|
|
|
|
# will contain “/any/path/foo.cc” on unix and “\\any\\path\\foo.cc” on windows
|
|
|
|
|
SOURCE_PATH = $(subst /,$S,$(SOURCE))
|
|
|
|
|
SOURCE_NAME= $(basename $(notdir $(SOURCE)))
|
|
|
|
|
ifeq ($(SOURCE),) # Those rules will be used if SOURCE is empty
|
|
|
|
|
.PHONY: build run
|
|
|
|
|
build run:
|
|
|
|
|
$(error no source file provided, the "$@" target must be used like so: \
|
|
|
|
|
make $@ SOURCE=relative/path/to/filename.extension)
|
|
|
|
|
else
|
|
|
|
|
ifeq (,$(wildcard $(SOURCE)))
|
|
|
|
|
$(error File "$(SOURCE)" does not exist !)
|
|
|
|
|
endif
|
|
|
|
|
endif
|
|
|
|
|
|
2011-07-14 23:27:43 +00:00
|
|
|
# Include .mk files.
|
2022-02-22 10:46:37 +01:00
|
|
|
BUILT_LANGUAGES = C++
|
|
|
|
|
ifeq ($(BUILD_PYTHON),ON)
|
|
|
|
|
BUILT_LANGUAGES +=, Python$(PYTHON_VERSION)
|
|
|
|
|
endif
|
|
|
|
|
ifeq ($(BUILD_JAVA),ON)
|
|
|
|
|
BUILT_LANGUAGES +=, Java
|
|
|
|
|
endif
|
|
|
|
|
ifeq ($(BUILD_DOTNET),ON)
|
|
|
|
|
BUILT_LANGUAGES +=, .Net (6.0)
|
|
|
|
|
endif
|
|
|
|
|
|
2012-03-28 00:09:22 +00:00
|
|
|
include $(OR_ROOT)makefiles/Makefile.cpp.mk
|
2018-04-24 02:40:11 -07:00
|
|
|
include $(OR_ROOT)makefiles/Makefile.dotnet.mk
|
2022-03-28 18:29:33 +02:00
|
|
|
include $(OR_ROOT)makefiles/Makefile.java.mk
|
|
|
|
|
include $(OR_ROOT)makefiles/Makefile.python.mk
|
2016-07-01 13:21:14 +02:00
|
|
|
include $(OR_ROOT)makefiles/Makefile.archive.mk
|
2011-03-31 08:39:26 +00:00
|
|
|
|
2018-03-02 13:41:00 +01:00
|
|
|
.PHONY: help_usage
|
|
|
|
|
help_usage:
|
|
|
|
|
@echo Use one of the following targets:
|
|
|
|
|
@echo help, help_all: Print this help.
|
2022-03-07 17:03:19 +01:00
|
|
|
@echo all: Build OR-Tools for all available languages.
|
2019-01-16 14:27:15 +01:00
|
|
|
@echo check, check_all: Check OR-Tools for all available languages.
|
2018-03-02 13:41:00 +01:00
|
|
|
@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.
|
2022-03-07 14:05:12 +01:00
|
|
|
ifeq ($(PLATFORM),WIN64)
|
2018-03-06 15:03:19 +01:00
|
|
|
@echo off & echo(
|
2018-03-06 13:58:23 +01:00
|
|
|
else
|
|
|
|
|
@echo
|
|
|
|
|
endif
|
2016-11-23 15:38:19 +01:00
|
|
|
|
2018-03-02 13:41:00 +01:00
|
|
|
.PHONY: help_all
|
2025-07-04 15:17:22 +02:00
|
|
|
help_all: help_usage help_cpp help_dotnet help_java help_python help_archive
|
2022-05-25 11:54:45 +02:00
|
|
|
|
|
|
|
|
.PHONY: check_all
|
|
|
|
|
check_all: check_cpp check_dotnet check_java check_python
|
|
|
|
|
@echo Or-tools has been built and checked for "$(BUILT_LANGUAGES)"
|
2018-03-02 13:41:00 +01:00
|
|
|
|
2022-03-09 17:33:48 +01:00
|
|
|
# Commands to build/clean all languages.
|
|
|
|
|
.PHONY: compile
|
|
|
|
|
compile:
|
|
|
|
|
cmake --build dependencies --target install --config $(BUILD_TYPE) -j $(JOBS) -v
|
|
|
|
|
|
2018-03-02 13:41:00 +01:00
|
|
|
.PHONY: build_all
|
2022-03-30 09:25:33 +02:00
|
|
|
build_all:
|
2022-03-28 18:29:33 +02:00
|
|
|
$(MAKE) third_party BUILD_DOTNET=ON BUILD_JAVA=ON BUILD_PYTHON=ON
|
2022-03-30 09:25:33 +02:00
|
|
|
cmake --build $(BUILD_DIR) --target install --config $(BUILD_TYPE) -j $(JOBS) -v
|
2022-02-22 11:03:26 +01:00
|
|
|
@echo Or-tools has been built for "$(BUILT_LANGUAGES)"
|
2018-03-02 13:41:00 +01:00
|
|
|
|
|
|
|
|
.PHONY: test_all
|
2022-03-28 18:29:33 +02:00
|
|
|
test_all: test_cpp test_dotnet test_java test_python
|
2022-02-22 11:03:26 +01:00
|
|
|
@echo Or-tools have been built and tested for "$(BUILT_LANGUAGES)"
|
2018-03-02 13:41:00 +01:00
|
|
|
|
2022-03-28 18:29:33 +02:00
|
|
|
.PHONY: archive_all
|
|
|
|
|
archive_all: archive_cpp archive_dotnet archive_java archive_python archive_data
|
2022-05-25 11:54:45 +02:00
|
|
|
@echo Or-tools has been built and archived for "$(BUILT_LANGUAGES)"
|
2022-03-28 18:29:33 +02:00
|
|
|
|
|
|
|
|
.PHONY: test_archive_all
|
|
|
|
|
test_archive_all: test_archive_cpp test_archive_dotnet test_archive_java test_archive_python
|
2022-05-25 11:54:45 +02:00
|
|
|
@echo Or-tools archives have been checked for "$(BUILT_LANGUAGES)"
|
2022-03-28 18:29:33 +02:00
|
|
|
|
2018-03-02 13:41:00 +01:00
|
|
|
.PHONY: clean_all
|
2022-03-28 18:29:33 +02:00
|
|
|
clean_all: clean_cpp clean_dotnet clean_java clean_python clean_archive
|
2022-02-22 11:03:26 +01:00
|
|
|
@echo Or-Tools has been cleaned for "$(BUILT_LANGUAGES)"
|
2018-03-02 13:41:00 +01:00
|
|
|
|
|
|
|
|
.PHONY: detect_all
|
2022-03-28 18:29:33 +02:00
|
|
|
detect_all: detect_port detect_cpp detect_dotnet detect_java detect_python detect_archive
|
2018-10-29 14:17:53 +01:00
|
|
|
@echo SOURCE = $(SOURCE)
|
|
|
|
|
@echo SOURCE_PATH = $(SOURCE_PATH)
|
|
|
|
|
@echo SOURCE_NAME = $(SOURCE_NAME)
|
|
|
|
|
@echo SOURCE_SUFFIX = $(SOURCE_SUFFIX)
|
2022-03-07 14:05:12 +01:00
|
|
|
ifeq ($(PLATFORM),WIN64)
|
2018-10-29 14:17:53 +01:00
|
|
|
@echo off & echo(
|
|
|
|
|
else
|
|
|
|
|
@echo
|
|
|
|
|
endif
|
2018-02-23 14:55:24 +01:00
|
|
|
|
2019-06-29 13:20:46 +02:00
|
|
|
print-% : ; @echo $* = \'$($*)\'
|
2018-10-29 14:17:53 +01:00
|
|
|
|
|
|
|
|
.PHONY: FORCE
|
|
|
|
|
FORCE:
|