2024-01-09 17:41:42 +00:00
|
|
|
# External build directory support
|
|
|
|
|
2023-11-25 05:33:21 +00:00
|
|
|
include mk/build-dir.mk
|
|
|
|
|
|
|
|
-include $(buildprefix)Makefile.config
|
|
|
|
clean-files += $(buildprefix)Makefile.config
|
2023-10-06 15:57:31 +00:00
|
|
|
|
2024-01-09 17:41:42 +00:00
|
|
|
# List makefiles
|
|
|
|
|
2023-10-06 15:57:31 +00:00
|
|
|
ifeq ($(ENABLE_BUILD), yes)
|
2014-02-01 11:23:14 +00:00
|
|
|
makefiles = \
|
2019-11-07 11:18:37 +00:00
|
|
|
mk/precompiled-headers.mk \
|
2014-02-01 13:28:31 +00:00
|
|
|
local.mk \
|
2014-01-30 11:11:06 +00:00
|
|
|
src/libutil/local.mk \
|
|
|
|
src/libstore/local.mk \
|
2020-03-30 12:03:28 +00:00
|
|
|
src/libfetchers/local.mk \
|
2014-01-30 11:11:06 +00:00
|
|
|
src/libmain/local.mk \
|
|
|
|
src/libexpr/local.mk \
|
2021-01-26 11:22:24 +00:00
|
|
|
src/libcmd/local.mk \
|
2016-02-09 20:28:29 +00:00
|
|
|
src/nix/local.mk \
|
2016-08-13 18:36:22 +00:00
|
|
|
src/resolve-system-dependencies/local.mk \
|
2014-01-30 11:11:06 +00:00
|
|
|
scripts/local.mk \
|
2020-05-10 18:32:21 +00:00
|
|
|
misc/bash/local.mk \
|
2021-06-01 22:45:03 +00:00
|
|
|
misc/fish/local.mk \
|
2021-06-01 16:44:03 +00:00
|
|
|
misc/zsh/local.mk \
|
2014-04-07 09:18:54 +00:00
|
|
|
misc/systemd/local.mk \
|
2014-11-04 09:14:18 +00:00
|
|
|
misc/launchd/local.mk \
|
2021-08-17 02:26:41 +00:00
|
|
|
misc/upstart/local.mk
|
2023-10-06 15:57:31 +00:00
|
|
|
endif
|
2013-11-25 15:25:13 +00:00
|
|
|
|
2023-12-14 05:05:03 +00:00
|
|
|
ifeq ($(ENABLE_UNIT_TESTS), yes)
|
2023-02-20 19:27:50 +00:00
|
|
|
makefiles += \
|
2023-08-25 14:20:28 +00:00
|
|
|
tests/unit/libutil/local.mk \
|
|
|
|
tests/unit/libutil-support/local.mk \
|
|
|
|
tests/unit/libstore/local.mk \
|
|
|
|
tests/unit/libstore-support/local.mk \
|
|
|
|
tests/unit/libexpr/local.mk \
|
|
|
|
tests/unit/libexpr-support/local.mk
|
2023-10-06 15:57:31 +00:00
|
|
|
endif
|
|
|
|
|
2023-12-14 05:05:03 +00:00
|
|
|
ifeq ($(ENABLE_FUNCTIONAL_TESTS), yes)
|
2023-10-06 15:57:31 +00:00
|
|
|
makefiles += \
|
2023-10-05 16:12:18 +00:00
|
|
|
tests/functional/local.mk \
|
|
|
|
tests/functional/ca/local.mk \
|
2023-09-04 13:51:23 +00:00
|
|
|
tests/functional/git-hashing/local.mk \
|
2023-10-05 16:12:18 +00:00
|
|
|
tests/functional/dyn-drv/local.mk \
|
2023-10-23 17:13:37 +00:00
|
|
|
tests/functional/local-overlay-store/local.mk \
|
2023-10-05 16:12:18 +00:00
|
|
|
tests/functional/test-libstoreconsumer/local.mk \
|
|
|
|
tests/functional/plugins/local.mk
|
2023-02-20 19:27:50 +00:00
|
|
|
endif
|
|
|
|
|
2024-02-09 17:56:42 +00:00
|
|
|
# Some makefiles require access to built programs and must be included late.
|
|
|
|
makefiles-late =
|
|
|
|
|
|
|
|
ifeq ($(ENABLE_DOC_GEN), yes)
|
|
|
|
makefiles-late += doc/manual/local.mk
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(ENABLE_INTERNAL_API_DOCS), yes)
|
|
|
|
makefiles-late += doc/internal-api/local.mk
|
|
|
|
endif
|
|
|
|
|
2024-01-09 17:41:42 +00:00
|
|
|
# Miscellaneous global Flags
|
|
|
|
|
2019-11-06 15:55:37 +00:00
|
|
|
OPTIMIZE = 1
|
|
|
|
|
|
|
|
ifeq ($(OPTIMIZE), 1)
|
2021-12-21 18:34:40 +00:00
|
|
|
GLOBAL_CXXFLAGS += -O3 $(CXXLTO)
|
|
|
|
GLOBAL_LDFLAGS += $(CXXLTO)
|
2019-11-06 15:55:37 +00:00
|
|
|
else
|
2020-09-22 08:04:25 +00:00
|
|
|
GLOBAL_CXXFLAGS += -O0 -U_FORTIFY_SOURCE
|
2019-11-06 15:55:37 +00:00
|
|
|
endif
|
|
|
|
|
2024-01-09 17:41:42 +00:00
|
|
|
include mk/platform.mk
|
|
|
|
|
|
|
|
ifdef HOST_WINDOWS
|
|
|
|
# Windows DLLs are stricter about symbol visibility than Unix shared
|
|
|
|
# objects --- see https://gcc.gnu.org/wiki/Visibility for details.
|
|
|
|
# This is a temporary sledgehammer to export everything like on Unix,
|
|
|
|
# and not detail with this yet.
|
|
|
|
#
|
|
|
|
# TODO do not do this, and instead do fine-grained export annotations.
|
|
|
|
GLOBAL_LDFLAGS += -Wl,--export-all-symbols
|
|
|
|
endif
|
|
|
|
|
2024-02-24 23:52:16 +00:00
|
|
|
GLOBAL_CXXFLAGS += -g -Wall -Wimplicit-fallthrough -include $(buildprefix)config.h -std=c++2a -I src
|
2024-01-09 17:41:42 +00:00
|
|
|
|
|
|
|
# Include the main lib, causing rules to be defined
|
|
|
|
|
2013-11-25 15:25:13 +00:00
|
|
|
include mk/lib.mk
|
2019-11-06 15:54:18 +00:00
|
|
|
|
2024-01-09 17:41:42 +00:00
|
|
|
# Fallback stub rules for better UX when things are disabled
|
|
|
|
#
|
|
|
|
# These must be defined after `mk/lib.mk`. Otherwise the first rule
|
|
|
|
# incorrectly becomes the default target.
|
|
|
|
|
2023-12-20 08:23:49 +00:00
|
|
|
ifneq ($(ENABLE_UNIT_TESTS), yes)
|
|
|
|
.PHONY: check
|
|
|
|
check:
|
|
|
|
@echo "Unit tests are disabled. Configure without '--disable-unit-tests', or avoid calling 'make check'."
|
|
|
|
@exit 1
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifneq ($(ENABLE_FUNCTIONAL_TESTS), yes)
|
|
|
|
.PHONY: installcheck
|
|
|
|
installcheck:
|
|
|
|
@echo "Functional tests are disabled. Configure without '--disable-functional-tests', or avoid calling 'make installcheck'."
|
|
|
|
@exit 1
|
|
|
|
endif
|
|
|
|
|
2024-02-09 17:56:42 +00:00
|
|
|
# Documentation fallback stub rules.
|
2023-12-20 08:23:49 +00:00
|
|
|
|
2024-02-09 17:56:42 +00:00
|
|
|
ifneq ($(ENABLE_DOC_GEN), yes)
|
2023-12-14 05:05:03 +00:00
|
|
|
.PHONY: manual-html manpages
|
|
|
|
manual-html manpages:
|
|
|
|
@echo "Generated docs are disabled. Configure without '--disable-doc-gen', or avoid calling 'make manpages' and 'make manual-html'."
|
|
|
|
@exit 1
|
2021-08-17 02:26:41 +00:00
|
|
|
endif
|
|
|
|
|
2024-02-09 17:56:42 +00:00
|
|
|
ifneq ($(ENABLE_INTERNAL_API_DOCS), yes)
|
2023-12-14 05:05:03 +00:00
|
|
|
.PHONY: internal-api-html
|
|
|
|
internal-api-html:
|
|
|
|
@echo "Internal API docs are disabled. Configure with '--enable-internal-api-docs', or avoid calling 'make internal-api-html'."
|
|
|
|
@exit 1
|
|
|
|
endif
|