make: Fix MinGW build machinery machinery

This commit makes it possible to successfully run "make all" against ytools'
again, with TARGET_TUPLE set to i686-ms-w64-mingw. Lots of minor and major
tweaks here and there.

The biggest diff is a move of the architecture-related definitions into
platform.mk. The are needed pretty early on, so that seems reasonable.

Making this work again is part of the larger effort to support cross
buildchains in a more concise way, i.e. without so many if ($(TARGET),mingw))
all over the place. TARGET's relevance should dwindle, until it's finally taken
over by the TARGET_XXX variables extracted from TARGET_TUPLE or TARGET_TRIPLET.

Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
Jan Lindemann 2019-03-02 17:21:48 +00:00
commit f9d398d219
7 changed files with 140 additions and 139 deletions

View file

@ -19,6 +19,10 @@ else ifeq ($(ARCH),aarch64)
PROJECT_LDFLAGS +=
endif
ifeq ($(findstring $(TARGET_OS),linux),)
USE_SYSTEMD := false
endif
ifeq ($(DEVELOPMENT),true)
export G_SLICE=always-malloc
export G_DEBUG=gc-friendly,resident-modules
@ -66,6 +70,8 @@ endif
ifeq ($(TARGET),mingw)
ifneq ($(wildcard /usr/bin/i686-w64-mingw32-gcc),)
PROJECT_CFLAGS += -D_WINDOWS
PROJECT_CPPFLAGS += -D_WINDOWS
MINGW_SYS_ROOT ?= /usr/i686-w64-mingw32/sys-root/mingw
CROSS_TOOL_DIR ?=
CROSS_TOOL_BIN_PREFIX ?= $(CROSS_TOOL_DIR)/usr/bin/i686-w64-mingw32-
@ -217,6 +223,8 @@ endif
ifeq ($(TARGET),mingw)
BUILD_CFLAGS += -DWIN32
BUILD_CPPFLAGS += -DWIN32
# see https://stackoverflow.com/questions/4492799
BUILD_LDFLAGS += -fstack-protector
endif
ifeq ($(LIBTYPE),shared)