mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-14 02:06:16 +02:00
Build Windows DLLs with -Wl,--export-all-symbols
This is not the most elegant, but will match the SOs in exporting everything for now. Later we can refine what is public/private to clean up the interface.
This commit is contained in:
parent
af0345df36
commit
90fdbfc601
3 changed files with 65 additions and 37 deletions
37
Makefile
37
Makefile
|
@ -1,8 +1,12 @@
|
||||||
|
# External build directory support
|
||||||
|
|
||||||
include mk/build-dir.mk
|
include mk/build-dir.mk
|
||||||
|
|
||||||
-include $(buildprefix)Makefile.config
|
-include $(buildprefix)Makefile.config
|
||||||
clean-files += $(buildprefix)Makefile.config
|
clean-files += $(buildprefix)Makefile.config
|
||||||
|
|
||||||
|
# List makefiles
|
||||||
|
|
||||||
ifeq ($(ENABLE_BUILD), yes)
|
ifeq ($(ENABLE_BUILD), yes)
|
||||||
makefiles = \
|
makefiles = \
|
||||||
mk/precompiled-headers.mk \
|
mk/precompiled-headers.mk \
|
||||||
|
@ -43,6 +47,8 @@ makefiles += \
|
||||||
tests/functional/plugins/local.mk
|
tests/functional/plugins/local.mk
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# Miscellaneous global Flags
|
||||||
|
|
||||||
OPTIMIZE = 1
|
OPTIMIZE = 1
|
||||||
|
|
||||||
ifeq ($(OPTIMIZE), 1)
|
ifeq ($(OPTIMIZE), 1)
|
||||||
|
@ -52,9 +58,29 @@ else
|
||||||
GLOBAL_CXXFLAGS += -O0 -U_FORTIFY_SOURCE
|
GLOBAL_CXXFLAGS += -O0 -U_FORTIFY_SOURCE
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
GLOBAL_CXXFLAGS += -g -Wall -include $(buildprefix)config.h -std=c++2a -I src
|
||||||
|
|
||||||
|
# Include the main lib, causing rules to be defined
|
||||||
|
|
||||||
include mk/lib.mk
|
include mk/lib.mk
|
||||||
|
|
||||||
# Must be included after `mk/lib.mk` so isn't the default target.
|
# 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.
|
||||||
|
|
||||||
ifneq ($(ENABLE_UNIT_TESTS), yes)
|
ifneq ($(ENABLE_UNIT_TESTS), yes)
|
||||||
.PHONY: check
|
.PHONY: check
|
||||||
check:
|
check:
|
||||||
|
@ -69,8 +95,11 @@ installcheck:
|
||||||
@exit 1
|
@exit 1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Must be included after `mk/lib.mk` so rules refer to variables defined
|
# Documentation or else fallback stub rules.
|
||||||
# by the library. Rules are not "lazy" like variables, unfortunately.
|
#
|
||||||
|
# The documentation makefiles be included after `mk/lib.mk` so rules
|
||||||
|
# refer to variables defined by `mk/lib.mk`. Rules are not "lazy" like
|
||||||
|
# variables, unfortunately.
|
||||||
|
|
||||||
ifeq ($(ENABLE_DOC_GEN), yes)
|
ifeq ($(ENABLE_DOC_GEN), yes)
|
||||||
$(eval $(call include-sub-makefile, doc/manual/local.mk))
|
$(eval $(call include-sub-makefile, doc/manual/local.mk))
|
||||||
|
@ -89,5 +118,3 @@ internal-api-html:
|
||||||
@echo "Internal API docs are disabled. Configure with '--enable-internal-api-docs', or avoid calling 'make internal-api-html'."
|
@echo "Internal API docs are disabled. Configure with '--enable-internal-api-docs', or avoid calling 'make internal-api-html'."
|
||||||
@exit 1
|
@exit 1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
GLOBAL_CXXFLAGS += -g -Wall -include $(buildprefix)config.h -std=c++2a -I src
|
|
||||||
|
|
33
mk/lib.mk
33
mk/lib.mk
|
@ -12,38 +12,7 @@ man-pages :=
|
||||||
install-tests :=
|
install-tests :=
|
||||||
install-tests-groups :=
|
install-tests-groups :=
|
||||||
|
|
||||||
ifdef HOST_OS
|
include mk/platform.mk
|
||||||
HOST_KERNEL = $(firstword $(subst -, ,$(HOST_OS)))
|
|
||||||
ifeq ($(patsubst mingw%,,$(HOST_KERNEL)),)
|
|
||||||
HOST_MINGW = 1
|
|
||||||
HOST_WINDOWS = 1
|
|
||||||
endif
|
|
||||||
ifeq ($(HOST_KERNEL), cygwin)
|
|
||||||
HOST_CYGWIN = 1
|
|
||||||
HOST_WINDOWS = 1
|
|
||||||
HOST_UNIX = 1
|
|
||||||
endif
|
|
||||||
ifeq ($(patsubst darwin%,,$(HOST_KERNEL)),)
|
|
||||||
HOST_DARWIN = 1
|
|
||||||
HOST_UNIX = 1
|
|
||||||
endif
|
|
||||||
ifeq ($(patsubst freebsd%,,$(HOST_KERNEL)),)
|
|
||||||
HOST_FREEBSD = 1
|
|
||||||
HOST_UNIX = 1
|
|
||||||
endif
|
|
||||||
ifeq ($(patsubst netbsd%,,$(HOST_KERNEL)),)
|
|
||||||
HOST_NETBSD = 1
|
|
||||||
HOST_UNIX = 1
|
|
||||||
endif
|
|
||||||
ifeq ($(HOST_KERNEL), linux)
|
|
||||||
HOST_LINUX = 1
|
|
||||||
HOST_UNIX = 1
|
|
||||||
endif
|
|
||||||
ifeq ($(patsubst solaris%,,$(HOST_KERNEL)),)
|
|
||||||
HOST_SOLARIS = 1
|
|
||||||
HOST_UNIX = 1
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
# Hack to define a literal space.
|
# Hack to define a literal space.
|
||||||
space :=
|
space :=
|
||||||
|
|
32
mk/platform.mk
Normal file
32
mk/platform.mk
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
ifdef HOST_OS
|
||||||
|
HOST_KERNEL = $(firstword $(subst -, ,$(HOST_OS)))
|
||||||
|
ifeq ($(patsubst mingw%,,$(HOST_KERNEL)),)
|
||||||
|
HOST_MINGW = 1
|
||||||
|
HOST_WINDOWS = 1
|
||||||
|
endif
|
||||||
|
ifeq ($(HOST_KERNEL), cygwin)
|
||||||
|
HOST_CYGWIN = 1
|
||||||
|
HOST_WINDOWS = 1
|
||||||
|
HOST_UNIX = 1
|
||||||
|
endif
|
||||||
|
ifeq ($(patsubst darwin%,,$(HOST_KERNEL)),)
|
||||||
|
HOST_DARWIN = 1
|
||||||
|
HOST_UNIX = 1
|
||||||
|
endif
|
||||||
|
ifeq ($(patsubst freebsd%,,$(HOST_KERNEL)),)
|
||||||
|
HOST_FREEBSD = 1
|
||||||
|
HOST_UNIX = 1
|
||||||
|
endif
|
||||||
|
ifeq ($(patsubst netbsd%,,$(HOST_KERNEL)),)
|
||||||
|
HOST_NETBSD = 1
|
||||||
|
HOST_UNIX = 1
|
||||||
|
endif
|
||||||
|
ifeq ($(HOST_KERNEL), linux)
|
||||||
|
HOST_LINUX = 1
|
||||||
|
HOST_UNIX = 1
|
||||||
|
endif
|
||||||
|
ifeq ($(patsubst solaris%,,$(HOST_KERNEL)),)
|
||||||
|
HOST_SOLARIS = 1
|
||||||
|
HOST_UNIX = 1
|
||||||
|
endif
|
||||||
|
endif
|
Loading…
Reference in a new issue