mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-29 09:06:15 +02:00
Merge pull request #9736 from obsidiansystems/mingw-makefiles
Some small Makefile improvements to prepare for Windows support
This commit is contained in:
commit
84502674f8
13 changed files with 43 additions and 23 deletions
14
mk/lib.mk
14
mk/lib.mk
|
@ -14,20 +14,34 @@ install-tests-groups :=
|
||||||
|
|
||||||
ifdef HOST_OS
|
ifdef HOST_OS
|
||||||
HOST_KERNEL = $(firstword $(subst -, ,$(HOST_OS)))
|
HOST_KERNEL = $(firstword $(subst -, ,$(HOST_OS)))
|
||||||
|
ifeq ($(patsubst mingw%,,$(HOST_KERNEL)),)
|
||||||
|
HOST_MINGW = 1
|
||||||
|
HOST_WINDOWS = 1
|
||||||
|
endif
|
||||||
ifeq ($(HOST_KERNEL), cygwin)
|
ifeq ($(HOST_KERNEL), cygwin)
|
||||||
HOST_CYGWIN = 1
|
HOST_CYGWIN = 1
|
||||||
|
HOST_WINDOWS = 1
|
||||||
|
HOST_UNIX = 1
|
||||||
endif
|
endif
|
||||||
ifeq ($(patsubst darwin%,,$(HOST_KERNEL)),)
|
ifeq ($(patsubst darwin%,,$(HOST_KERNEL)),)
|
||||||
HOST_DARWIN = 1
|
HOST_DARWIN = 1
|
||||||
|
HOST_UNIX = 1
|
||||||
endif
|
endif
|
||||||
ifeq ($(patsubst freebsd%,,$(HOST_KERNEL)),)
|
ifeq ($(patsubst freebsd%,,$(HOST_KERNEL)),)
|
||||||
HOST_FREEBSD = 1
|
HOST_FREEBSD = 1
|
||||||
|
HOST_UNIX = 1
|
||||||
|
endif
|
||||||
|
ifeq ($(patsubst netbsd%,,$(HOST_KERNEL)),)
|
||||||
|
HOST_NETBSD = 1
|
||||||
|
HOST_UNIX = 1
|
||||||
endif
|
endif
|
||||||
ifeq ($(HOST_KERNEL), linux)
|
ifeq ($(HOST_KERNEL), linux)
|
||||||
HOST_LINUX = 1
|
HOST_LINUX = 1
|
||||||
|
HOST_UNIX = 1
|
||||||
endif
|
endif
|
||||||
ifeq ($(patsubst solaris%,,$(HOST_KERNEL)),)
|
ifeq ($(patsubst solaris%,,$(HOST_KERNEL)),)
|
||||||
HOST_SOLARIS = 1
|
HOST_SOLARIS = 1
|
||||||
|
HOST_UNIX = 1
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,12 @@ else
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifdef HOST_UNIX
|
||||||
|
THREAD_LDFLAGS = -pthread
|
||||||
|
else
|
||||||
|
THREAD_LDFLAGS =
|
||||||
|
endif
|
||||||
|
|
||||||
# Build a library with symbolic name $(1). The library is defined by
|
# Build a library with symbolic name $(1). The library is defined by
|
||||||
# various variables prefixed by ‘$(1)_’:
|
# various variables prefixed by ‘$(1)_’:
|
||||||
#
|
#
|
||||||
|
|
|
@ -8,7 +8,7 @@ libcmd_SOURCES := $(wildcard $(d)/*.cc)
|
||||||
|
|
||||||
libcmd_CXXFLAGS += -I src/libutil -I src/libstore -I src/libexpr -I src/libmain -I src/libfetchers
|
libcmd_CXXFLAGS += -I src/libutil -I src/libstore -I src/libexpr -I src/libmain -I src/libfetchers
|
||||||
|
|
||||||
libcmd_LDFLAGS = $(EDITLINE_LIBS) $(LOWDOWN_LIBS) -pthread
|
libcmd_LDFLAGS = $(EDITLINE_LIBS) $(LOWDOWN_LIBS) $(THREAD_LDFLAGS)
|
||||||
|
|
||||||
libcmd_LIBS = libstore libutil libexpr libmain libfetchers
|
libcmd_LIBS = libstore libutil libexpr libmain libfetchers
|
||||||
|
|
||||||
|
|
|
@ -16,9 +16,9 @@ libexpr_CXXFLAGS += -I src/libutil -I src/libstore -I src/libfetchers -I src/lib
|
||||||
|
|
||||||
libexpr_LIBS = libutil libstore libfetchers
|
libexpr_LIBS = libutil libstore libfetchers
|
||||||
|
|
||||||
libexpr_LDFLAGS += -lboost_context -pthread
|
libexpr_LDFLAGS += -lboost_context $(THREAD_LDFLAGS)
|
||||||
ifdef HOST_LINUX
|
ifdef HOST_LINUX
|
||||||
libexpr_LDFLAGS += -ldl
|
libexpr_LDFLAGS += -ldl
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# The dependency on libgc must be propagated (i.e. meaning that
|
# The dependency on libgc must be propagated (i.e. meaning that
|
||||||
|
|
|
@ -8,6 +8,6 @@ libfetchers_SOURCES := $(wildcard $(d)/*.cc)
|
||||||
|
|
||||||
libfetchers_CXXFLAGS += -I src/libutil -I src/libstore
|
libfetchers_CXXFLAGS += -I src/libutil -I src/libstore
|
||||||
|
|
||||||
libfetchers_LDFLAGS += -pthread $(LIBGIT2_LIBS) -larchive
|
libfetchers_LDFLAGS += $(THREAD_LDFLAGS) $(LIBGIT2_LIBS) -larchive
|
||||||
|
|
||||||
libfetchers_LIBS = libutil libstore
|
libfetchers_LIBS = libutil libstore
|
||||||
|
|
|
@ -8,7 +8,7 @@ libstore_SOURCES := $(wildcard $(d)/*.cc $(d)/builtins/*.cc $(d)/build/*.cc)
|
||||||
|
|
||||||
libstore_LIBS = libutil
|
libstore_LIBS = libutil
|
||||||
|
|
||||||
libstore_LDFLAGS += $(SQLITE3_LIBS) $(LIBCURL_LIBS) -pthread
|
libstore_LDFLAGS += $(SQLITE3_LIBS) $(LIBCURL_LIBS) $(THREAD_LDFLAGS)
|
||||||
ifdef HOST_LINUX
|
ifdef HOST_LINUX
|
||||||
libstore_LDFLAGS += -ldl
|
libstore_LDFLAGS += -ldl
|
||||||
endif
|
endif
|
||||||
|
@ -16,15 +16,15 @@ endif
|
||||||
$(foreach file,$(libstore_FILES),$(eval $(call install-data-in,$(d)/$(file),$(datadir)/nix/sandbox)))
|
$(foreach file,$(libstore_FILES),$(eval $(call install-data-in,$(d)/$(file),$(datadir)/nix/sandbox)))
|
||||||
|
|
||||||
ifeq ($(ENABLE_S3), 1)
|
ifeq ($(ENABLE_S3), 1)
|
||||||
libstore_LDFLAGS += -laws-cpp-sdk-transfer -laws-cpp-sdk-s3 -laws-cpp-sdk-core -laws-crt-cpp
|
libstore_LDFLAGS += -laws-cpp-sdk-transfer -laws-cpp-sdk-s3 -laws-cpp-sdk-core -laws-crt-cpp
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifdef HOST_SOLARIS
|
ifdef HOST_SOLARIS
|
||||||
libstore_LDFLAGS += -lsocket
|
libstore_LDFLAGS += -lsocket
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(HAVE_SECCOMP), 1)
|
ifeq ($(HAVE_SECCOMP), 1)
|
||||||
libstore_LDFLAGS += $(LIBSECCOMP_LIBS)
|
libstore_LDFLAGS += $(LIBSECCOMP_LIBS)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
libstore_CXXFLAGS += \
|
libstore_CXXFLAGS += \
|
||||||
|
@ -48,9 +48,9 @@ $(d)/embedded-sandbox-shell.gen.hh: $(sandbox_shell)
|
||||||
$(trace-gen) hexdump -v -e '1/1 "0x%x," "\n"' < $< > $@.tmp
|
$(trace-gen) hexdump -v -e '1/1 "0x%x," "\n"' < $< > $@.tmp
|
||||||
@mv $@.tmp $@
|
@mv $@.tmp $@
|
||||||
else
|
else
|
||||||
ifneq ($(sandbox_shell),)
|
ifneq ($(sandbox_shell),)
|
||||||
libstore_CXXFLAGS += -DSANDBOX_SHELL="\"$(sandbox_shell)\""
|
libstore_CXXFLAGS += -DSANDBOX_SHELL="\"$(sandbox_shell)\""
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
$(d)/local-store.cc: $(d)/schema.sql.gen.hh $(d)/ca-specific-schema.sql.gen.hh
|
$(d)/local-store.cc: $(d)/schema.sql.gen.hh $(d)/ca-specific-schema.sql.gen.hh
|
||||||
|
|
|
@ -8,7 +8,7 @@ libutil_SOURCES := $(wildcard $(d)/*.cc $(d)/signature/*.cc)
|
||||||
|
|
||||||
libutil_CXXFLAGS += -I src/libutil
|
libutil_CXXFLAGS += -I src/libutil
|
||||||
|
|
||||||
libutil_LDFLAGS += -pthread $(LIBCURL_LIBS) $(SODIUM_LIBS) $(OPENSSL_LIBS) $(LIBBROTLI_LIBS) $(LIBARCHIVE_LIBS) $(BOOST_LDFLAGS) -lboost_context
|
libutil_LDFLAGS += $(THREAD_LDFLAGS) $(LIBCURL_LIBS) $(SODIUM_LIBS) $(OPENSSL_LIBS) $(LIBBROTLI_LIBS) $(LIBARCHIVE_LIBS) $(BOOST_LDFLAGS) -lboost_context
|
||||||
|
|
||||||
$(foreach i, $(wildcard $(d)/args/*.hh), \
|
$(foreach i, $(wildcard $(d)/args/*.hh), \
|
||||||
$(eval $(call install-file-in, $(i), $(includedir)/nix/args, 0644)))
|
$(eval $(call install-file-in, $(i), $(includedir)/nix/args, 0644)))
|
||||||
|
@ -17,5 +17,5 @@ $(foreach i, $(wildcard $(d)/signature/*.hh), \
|
||||||
|
|
||||||
|
|
||||||
ifeq ($(HAVE_LIBCPUID), 1)
|
ifeq ($(HAVE_LIBCPUID), 1)
|
||||||
libutil_LDFLAGS += -lcpuid
|
libutil_LDFLAGS += -lcpuid
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -18,7 +18,7 @@ nix_CXXFLAGS += -I src/libutil -I src/libstore -I src/libfetchers -I src/libexpr
|
||||||
|
|
||||||
nix_LIBS = libexpr libmain libfetchers libstore libutil libcmd
|
nix_LIBS = libexpr libmain libfetchers libstore libutil libcmd
|
||||||
|
|
||||||
nix_LDFLAGS = -pthread $(SODIUM_LIBS) $(EDITLINE_LIBS) $(BOOST_LDFLAGS) $(LOWDOWN_LIBS)
|
nix_LDFLAGS = $(THREAD_LDFLAGS) $(SODIUM_LIBS) $(EDITLINE_LIBS) $(BOOST_LDFLAGS) $(LOWDOWN_LIBS)
|
||||||
|
|
||||||
$(foreach name, \
|
$(foreach name, \
|
||||||
nix-build nix-channel nix-collect-garbage nix-copy-closure nix-daemon nix-env nix-hash nix-instantiate nix-prefetch-url nix-shell nix-store, \
|
nix-build nix-channel nix-collect-garbage nix-copy-closure nix-daemon nix-env nix-hash nix-instantiate nix-prefetch-url nix-shell nix-store, \
|
||||||
|
|
|
@ -129,15 +129,15 @@ nix_tests = \
|
||||||
impure-env.sh
|
impure-env.sh
|
||||||
|
|
||||||
ifeq ($(HAVE_LIBCPUID), 1)
|
ifeq ($(HAVE_LIBCPUID), 1)
|
||||||
nix_tests += compute-levels.sh
|
nix_tests += compute-levels.sh
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(ENABLE_BUILD), yes)
|
ifeq ($(ENABLE_BUILD), yes)
|
||||||
nix_tests += test-libstoreconsumer.sh
|
nix_tests += test-libstoreconsumer.sh
|
||||||
|
|
||||||
ifeq ($(BUILD_SHARED_LIBS), 1)
|
ifeq ($(BUILD_SHARED_LIBS), 1)
|
||||||
nix_tests += plugins.sh
|
nix_tests += plugins.sh
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
$(d)/test-libstoreconsumer.sh.test $(d)/test-libstoreconsumer.sh.test-debug: \
|
$(d)/test-libstoreconsumer.sh.test $(d)/test-libstoreconsumer.sh.test-debug: \
|
||||||
|
|
|
@ -12,4 +12,4 @@ test-libstoreconsumer_CXXFLAGS += -I src/libutil -I src/libstore
|
||||||
|
|
||||||
test-libstoreconsumer_LIBS = libstore libutil
|
test-libstoreconsumer_LIBS = libstore libutil
|
||||||
|
|
||||||
test-libstoreconsumer_LDFLAGS = -pthread $(SODIUM_LIBS) $(EDITLINE_LIBS) $(BOOST_LDFLAGS) $(LOWDOWN_LIBS)
|
test-libstoreconsumer_LDFLAGS = $(THREAD_LDFLAGS) $(SODIUM_LIBS) $(EDITLINE_LIBS) $(BOOST_LDFLAGS) $(LOWDOWN_LIBS)
|
||||||
|
|
|
@ -20,4 +20,4 @@ libexpr-test-support_LIBS = \
|
||||||
libstore-test-support libutil-test-support \
|
libstore-test-support libutil-test-support \
|
||||||
libexpr libstore libutil
|
libexpr libstore libutil
|
||||||
|
|
||||||
libexpr-test-support_LDFLAGS := -pthread -lrapidcheck
|
libexpr-test-support_LDFLAGS := $(THREAD_LDFLAGS) -lrapidcheck
|
||||||
|
|
|
@ -18,4 +18,4 @@ libstore-test-support_LIBS = \
|
||||||
libutil-test-support \
|
libutil-test-support \
|
||||||
libstore libutil
|
libstore libutil
|
||||||
|
|
||||||
libstore-test-support_LDFLAGS := -pthread -lrapidcheck
|
libstore-test-support_LDFLAGS := $(THREAD_LDFLAGS) -lrapidcheck
|
||||||
|
|
|
@ -16,4 +16,4 @@ libutil-test-support_CXXFLAGS += $(libutil-tests_EXTRA_INCLUDES)
|
||||||
|
|
||||||
libutil-test-support_LIBS = libutil
|
libutil-test-support_LIBS = libutil
|
||||||
|
|
||||||
libutil-test-support_LDFLAGS := -pthread -lrapidcheck
|
libutil-test-support_LDFLAGS := $(THREAD_LDFLAGS) -lrapidcheck
|
||||||
|
|
Loading…
Reference in a new issue