mirror of
ssh://git.janware.com/srv/git/janware/proj/jw-pkg
synced 2026-01-19 21:27:39 +01:00
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:
parent
ac2f4f6cc7
commit
f9d398d219
7 changed files with 140 additions and 139 deletions
100
make/platform.mk
100
make/platform.mk
|
|
@ -1,7 +1,105 @@
|
|||
# ----- host and target variables
|
||||
|
||||
ifndef PLATFORM_MK_INCLUDED
|
||||
PLATFORM_MK_INCLUDED = true
|
||||
|
||||
ifndef TARGET
|
||||
ifneq ($(findstring mingw,$(shell pwd)),)
|
||||
ifneq ($(subst mingw,,$(CWD)),$(CWD))
|
||||
TARGET := mingw
|
||||
endif
|
||||
endif
|
||||
|
||||
MOD_SCRIPT_DIR := $(firstword $(wildcard $(MODDIR)/scripts $(MODDIR)/bin))
|
||||
ifndef GET_OS_SH
|
||||
GET_OS_SH := $(SHELL) $(MOD_SCRIPT_DIR)/get-os.sh
|
||||
endif
|
||||
|
||||
ifeq ($(OS_TUPLE),)
|
||||
OS_TUPLE := $(shell $(GET_OS_SH) tuple)
|
||||
endif
|
||||
|
||||
ifneq ($(TARGET_TUPLE),)
|
||||
TARGET_TUPLE_WORDS := $(subst -, ,$(TARGET_TUPLE))
|
||||
TARGET_ARCH := $(word 1,$(TARGET_TUPLE_WORDS))
|
||||
TARGET_VENDOR := $(word 2,$(TARGET_TUPLE_WORDS))
|
||||
TARGET_OS := $(word 3,$(TARGET_TUPLE_WORDS))
|
||||
TARGET_ABI := $(word 4,$(TARGET_TUPLE_WORDS))
|
||||
TARGET_TRIPLET := $(TARGET_ARCH)-$(TARGET_OS)-$(TARGET_ABI)
|
||||
else ifneq ($(TARGET_TRIPLET),)
|
||||
TARGET_TRIPLET_WORDS := $(subst -, ,$(TARGET_TRIPLET))
|
||||
TARGET_ARCH := $(word 1,$(TARGET_TRIPLET_WORDS))
|
||||
TARGET_VENDOR := unknown
|
||||
TARGET_OS := $(word 2,$(TARGET_TRIPLET_WORDS))
|
||||
TARGET_ABI := $(word 3,$(TARGET_TRIPLET_WORDS))
|
||||
TARGET_TUPLE := $(TARGET_ARCH)-$(TARGET_VENDOR)-$(TARGET_OS)-$(TARGET_ABI)
|
||||
else
|
||||
TARGET_TUPLE := $(OS_TUPLE)
|
||||
TARGET_TUPLE_WORDS := $(subst -, ,$(TARGET_TUPLE))
|
||||
TARGET_ARCH := $(word 1,$(TARGET_TUPLE_WORDS))
|
||||
TARGET_VENDOR := $(word 2,$(TARGET_TUPLE_WORDS))
|
||||
TARGET_OS := $(word 3,$(TARGET_TUPLE_WORDS))
|
||||
TARGET_ABI := $(word 4,$(TARGET_TUPLE_WORDS))
|
||||
TARGET_TRIPLET := $(TARGET_ARCH)-$(TARGET_OS)-$(TARGET_ABI)
|
||||
endif
|
||||
|
||||
ifeq ($(TARGET_TUPLE),)
|
||||
$(error TARGET_TUPLE is empty)
|
||||
endif
|
||||
|
||||
# - support legacy jw-build target variables
|
||||
ifneq ($(findstring $(TARGET_ABI),mingw mingw32 mingw64),)
|
||||
TARGET ?= mingw
|
||||
else
|
||||
TARGET ?= $(TARGET_OS)
|
||||
endif
|
||||
|
||||
ifeq ($(OS_NAME_VERSION),)
|
||||
OS_NAME_VERSION := $(shell $(GET_OS_SH))
|
||||
endif
|
||||
|
||||
ifeq ($(OS_NAME),)
|
||||
OS_NAME := $(shell $(GET_OS_SH) name)
|
||||
endif
|
||||
ARCH ?= $(TARGET_ARCH)
|
||||
|
||||
ARCH_32 = i586
|
||||
|
||||
ifndef ARCH
|
||||
# TODO unreached code, test and fix this
|
||||
ifeq ($(shell uname -m),armv7l)
|
||||
ARCH = armv7hl
|
||||
SYSTEM_LIBDIR_NAME = lib
|
||||
else ifeq ($(shell uname -m),armv6l)
|
||||
ARCH = armv6hl
|
||||
SYSTEM_LIBDIR_NAME = lib
|
||||
else ifeq ($(shell uname -m),aarch64)
|
||||
ARCH = aarch64
|
||||
SYSTEM_LIBDIR_NAME = lib
|
||||
else ifeq ($(shell uname -m),x86_64)
|
||||
ARCH = x86_64
|
||||
SYSTEM_LIBDIR_NAME = lib64
|
||||
else
|
||||
ARCH = $(ARCH_32)
|
||||
SYSTEM_LIBDIR_NAME = lib
|
||||
endif
|
||||
SYSTEM_LIBDIR = /usr/$(SYSTEM_LIBDIR_NAME)
|
||||
endif
|
||||
|
||||
ifneq ($(TARGET_TUPLE),$(OS_TUPLE))
|
||||
ifeq ($(TARGET),mingw)
|
||||
FLAVOUR_PREFIX ?= win32-
|
||||
FLAVOUR_SUFFIX ?= -win32
|
||||
FLAVOUR_PATH_PREFIX ?= win32/
|
||||
FLAVOUR_PATH_SUFFIX ?= /win32
|
||||
ifneq ($(wildcard /usr/bin/i686-w64-mingw32-gcc),)
|
||||
MINGW_SYS_ROOT ?= /usr/i686-w64-mingw32/sys-root/mingw
|
||||
endif
|
||||
else
|
||||
FLAVOUR_PREFIX ?= $(TARGET_TRIPLET)-
|
||||
FLAVOUR_SUFFIX ?= -$(TARGET_TRIPLET)
|
||||
FLAVOUR_PATH_PREFIX ?= $(TARGET_TRIPLET)/
|
||||
FLAVOUR_PATH_SUFFIX ?= /$(TARGET_TRIPLET)
|
||||
endif
|
||||
endif
|
||||
|
||||
endif # ifndef PLATFORM_MK_INCLUDED
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue