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 06:23:14 -05:00
|
|
|
makefiles = \
|
2019-11-07 06:18:37 -05:00
|
|
|
mk/precompiled-headers.mk \
|
2014-02-01 08:28:31 -05:00
|
|
|
local.mk \
|
2014-01-30 06:11:06 -05:00
|
|
|
src/libutil/local.mk \
|
|
|
|
src/libstore/local.mk \
|
2020-03-30 08:03:28 -04:00
|
|
|
src/libfetchers/local.mk \
|
2014-01-30 06:11:06 -05: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 15:28:29 -05:00
|
|
|
src/nix/local.mk \
|
2024-03-28 14:00:04 -04: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 06:11:06 -05:00
|
|
|
scripts/local.mk \
|
2024-04-18 15:59:39 -04:00
|
|
|
maintainers/local.mk \
|
2020-05-10 14:32:21 -04:00
|
|
|
misc/bash/local.mk \
|
2021-06-01 18:45:03 -04:00
|
|
|
misc/fish/local.mk \
|
2021-06-01 12:44:03 -04:00
|
|
|
misc/zsh/local.mk \
|
2014-04-07 05:18:54 -04:00
|
|
|
misc/systemd/local.mk \
|
2014-11-04 04:14:18 -05:00
|
|
|
misc/launchd/local.mk \
|
2021-08-16 22:26:41 -04: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 10:25:13 -05:00
|
|
|
|
2024-08-19 09:17:13 -04: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 09:17:13 -04: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 14:27:50 -05:00
|
|
|
endif
|
2023-09-02 17:35:16 -04:00
|
|
|
endif
|
2023-02-20 14:27:50 -05:00
|
|
|
|
2024-02-09 12:56:42 -05: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 10:55:37 -05:00
|
|
|
OPTIMIZE = 1
|
|
|
|
|
|
|
|
ifeq ($(OPTIMIZE), 1)
|
2021-12-21 13:34:40 -05:00
|
|
|
GLOBAL_CXXFLAGS += -O3 $(CXXLTO)
|
|
|
|
GLOBAL_LDFLAGS += $(CXXLTO)
|
2019-11-06 10:55:37 -05:00
|
|
|
else
|
2020-09-22 04:04:25 -04:00
|
|
|
GLOBAL_CXXFLAGS += -O0 -U_FORTIFY_SOURCE
|
2024-02-29 14:52:31 -05:00
|
|
|
unexport NIX_HARDENING_ENABLE
|
2019-11-06 10:55:37 -05: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
|
|
|
|
endif
|
|
|
|
|
2024-07-25 01:32:03 -04: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 10:25:13 -05:00
|
|
|
include mk/lib.mk
|
2019-11-06 10:54:18 -05: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 09:17:13 -04: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 12:56:42 -05:00
|
|
|
# Documentation fallback stub rules.
|
2023-12-20 03:23:49 -05:00
|
|
|
|
2024-02-09 12:56:42 -05: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-16 22:26:41 -04:00
|
|
|
endif
|