2024-01-09 12:41:42 -05:00
|
|
|
# External build directory support
|
|
|
|
|
2023-11-25 00:33:21 -05:00
|
|
|
include mk/build-dir.mk
|
|
|
|
|
|
|
|
-include $(buildprefix)Makefile.config
|
|
|
|
clean-files += $(buildprefix)Makefile.config
|
2023-10-06 11:57:31 -04:00
|
|
|
|
2024-01-09 12:41:42 -05:00
|
|
|
# List makefiles
|
|
|
|
|
2023-09-02 17:35:16 -04:00
|
|
|
include mk/platform.mk
|
|
|
|
|
2023-10-06 11:57:31 -04:00
|
|
|
ifeq ($(ENABLE_BUILD), yes)
|
2014-02-01 12:23:14 +01:00
|
|
|
makefiles = \
|
2019-11-07 12:18:37 +01:00
|
|
|
mk/precompiled-headers.mk \
|
2014-02-01 14:28:31 +01:00
|
|
|
local.mk \
|
2014-01-30 12:11:06 +01:00
|
|
|
src/libutil/local.mk \
|
|
|
|
src/libstore/local.mk \
|
2020-03-30 14:03:28 +02:00
|
|
|
src/libfetchers/local.mk \
|
2014-01-30 12:11:06 +01:00
|
|
|
src/libmain/local.mk \
|
|
|
|
src/libexpr/local.mk \
|
2023-09-28 21:51:28 -04:00
|
|
|
src/libflake/local.mk \
|
2021-01-26 06:22:24 -05:00
|
|
|
src/libcmd/local.mk \
|
2016-02-09 21:28:29 +01:00
|
|
|
src/nix/local.mk \
|
2024-03-28 19:00:04 +01:00
|
|
|
src/libutil-c/local.mk \
|
|
|
|
src/libstore-c/local.mk \
|
2023-09-02 17:35:16 -04:00
|
|
|
src/libexpr-c/local.mk
|
|
|
|
|
|
|
|
ifdef HOST_UNIX
|
|
|
|
makefiles += \
|
2014-01-30 12:11:06 +01:00
|
|
|
scripts/local.mk \
|
2024-04-18 21:59:39 +02:00
|
|
|
maintainers/local.mk \
|
2020-05-10 20:32:21 +02:00
|
|
|
misc/bash/local.mk \
|
2021-06-02 00:45:03 +02:00
|
|
|
misc/fish/local.mk \
|
2021-06-02 00:44:03 +08:00
|
|
|
misc/zsh/local.mk \
|
2014-04-07 11:18:54 +02:00
|
|
|
misc/systemd/local.mk \
|
2014-11-04 10:14:18 +01:00
|
|
|
misc/launchd/local.mk \
|
2021-08-17 04:26:41 +02:00
|
|
|
misc/upstart/local.mk
|
2023-10-06 11:57:31 -04:00
|
|
|
endif
|
2023-09-02 17:35:16 -04:00
|
|
|
endif
|
2013-11-25 15:25:13 +00:00
|
|
|
|
2024-08-19 15:17:13 +02:00
|
|
|
ifeq ($(ENABLE_UNIT_TESTS), yes)
|
|
|
|
makefiles += \
|
2024-10-10 14:56:26 -04:00
|
|
|
src/libutil-tests/local.mk \
|
|
|
|
src/libutil-test-support/local.mk \
|
|
|
|
src/libstore-tests/local.mk \
|
|
|
|
src/libstore-test-support/local.mk \
|
|
|
|
src/libfetchers-tests/local.mk \
|
|
|
|
src/libexpr-tests/local.mk \
|
|
|
|
src/libexpr-test-support/local.mk \
|
|
|
|
src/libflake-tests/local.mk
|
2024-08-19 15:17:13 +02:00
|
|
|
endif
|
|
|
|
|
2023-12-14 00:05:03 -05:00
|
|
|
ifeq ($(ENABLE_FUNCTIONAL_TESTS), yes)
|
2023-09-02 17:35:16 -04:00
|
|
|
ifdef HOST_UNIX
|
2023-10-06 11:57:31 -04:00
|
|
|
makefiles += \
|
2023-10-05 12:12:18 -04:00
|
|
|
tests/functional/local.mk \
|
2024-07-24 22:25:08 -04:00
|
|
|
tests/functional/flakes/local.mk \
|
2023-10-05 12:12:18 -04:00
|
|
|
tests/functional/ca/local.mk \
|
2023-09-04 09:51:23 -04:00
|
|
|
tests/functional/git-hashing/local.mk \
|
2023-10-05 12:12:18 -04:00
|
|
|
tests/functional/dyn-drv/local.mk \
|
2023-10-23 13:13:37 -04:00
|
|
|
tests/functional/local-overlay-store/local.mk \
|
2023-10-05 12:12:18 -04:00
|
|
|
tests/functional/test-libstoreconsumer/local.mk \
|
|
|
|
tests/functional/plugins/local.mk
|
2023-02-20 20:27:50 +01:00
|
|
|
endif
|
2023-09-02 17:35:16 -04:00
|
|
|
endif
|
2023-02-20 20:27:50 +01:00
|
|
|
|
2024-02-09 18:56:42 +01: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
|
|
|
|
|
2024-01-09 12:41:42 -05:00
|
|
|
# Miscellaneous global Flags
|
|
|
|
|
2019-11-06 16:55:37 +01:00
|
|
|
OPTIMIZE = 1
|
|
|
|
|
|
|
|
ifeq ($(OPTIMIZE), 1)
|
2021-12-21 19:34:40 +01:00
|
|
|
GLOBAL_CXXFLAGS += -O3 $(CXXLTO)
|
|
|
|
GLOBAL_LDFLAGS += $(CXXLTO)
|
2019-11-06 16:55:37 +01:00
|
|
|
else
|
2020-09-22 10:04:25 +02:00
|
|
|
GLOBAL_CXXFLAGS += -O0 -U_FORTIFY_SOURCE
|
2024-02-29 14:52:31 -05:00
|
|
|
unexport NIX_HARDENING_ENABLE
|
2019-11-06 16:55:37 +01:00
|
|
|
endif
|
|
|
|
|
2024-01-09 12:41:42 -05:00
|
|
|
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
|
2024-11-04 19:19:42 +11:00
|
|
|
GLOBAL_CXXFLAGS += -D_WIN32_WINNT=0x0602
|
2024-01-09 12:41:42 -05:00
|
|
|
endif
|
|
|
|
|
2024-07-25 07:32:03 +02:00
|
|
|
GLOBAL_CXXFLAGS += -g -Wall -Wdeprecated-copy -Wignored-qualifiers -Wimplicit-fallthrough -Werror=unused-result -Werror=suggest-override -include $(buildprefix)config.h -std=c++2a -I src
|
2024-01-09 12:41:42 -05: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 16:54:18 +01:00
|
|
|
|
2024-01-09 12:41:42 -05: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.
|
|
|
|
|
2024-08-19 15:17:13 +02: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
|
|
|
|
|
2023-12-20 03:23:49 -05:00
|
|
|
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 18:56:42 +01:00
|
|
|
# Documentation fallback stub rules.
|
2023-12-20 03:23:49 -05:00
|
|
|
|
2024-02-09 18:56:42 +01:00
|
|
|
ifneq ($(ENABLE_DOC_GEN), yes)
|
2023-12-14 00:05:03 -05: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 04:26:41 +02:00
|
|
|
endif
|