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