summaryrefslogtreecommitdiffstats
path: root/rules/pre/toolchain.make
blob: 33627bc95bd47431db76b54bd510f0f71257b32c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# -*-makefile-*-

#
# just quote removal
#
PTXCONF_TOOLCHAIN_CONFIG_SYSROOT		:= $(call remove_quotes, $(PTXCONF_TOOLCHAIN_CONFIG_SYSROOT))
PTXCONF_TOOLCHAIN_CONFIG_MULTILIB		:= $(call remove_quotes, $(PTXCONF_TOOLCHAIN_CONFIG_MULTILIB))

PTXCONF_GLIBC_HEADERS_FAKE_CROSS		:= $(call remove_quotes, $(PTXCONF_GLIBC_HEADERS_FAKE_CROSS))
PTXCONF_GLIBC_CONFIG_EXTRA			:= $(call remove_quotes, $(PTXCONF_GLIBC_CONFIG_EXTRA))
PTXCONF_GLIBC_CONFIG_EXTRA_CROSS		:= $(call remove_quotes, $(PTXCONF_GLIBC_CONFIG_EXTRA_CROSS))

PTXCONF_CROSS_GCC_CONFIG_EXTRA			:= $(call remove_quotes, $(PTXCONF_CROSS_GCC_CONFIG_EXTRA))
PTXCONF_CROSS_GCC_CONFIG_LIBC			:= $(call remove_quotes, $(PTXCONF_CROSS_GCC_CONFIG_LIBC))
PTXCONF_CROSS_GCC_CONFIG_CXA_ATEXIT		:= $(call remove_quotes, $(PTXCONF_CROSS_GCC_CONFIG_CXA_ATEXIT))
PTXCONF_CROSS_GCC_CONFIG_SJLJ_EXCEPTIONS	:= $(call remove_quotes, $(PTXCONF_CROSS_GCC_CONFIG_SJLJ_EXCEPTIONS))
PTXCONF_CROSS_GCC_CONFIG_LIBSSP			:= $(call remove_quotes, $(PTXCONF_CROSS_GCC_CONFIG_LIBSSP))
PTXCONF_CROSS_GCC_CONFIG_SHARED			:= $(call remove_quotes, $(PTXCONF_CROSS_GCC_CONFIG_SHARED))
PTXCONF_PREFIX_CROSS				:= $(call remove_quotes, $(PTXCONF_PREFIX_CROSS))

PTXCONF_ARCH					:= $(call remove_quotes, $(PTXCONF_ARCH))

#
# namespace cleanup
#
PTX_TOUPLE_TARGET				:= $(PTXCONF_GNU_TARGET)

PTX_HOST_CROSS_AUTOCONF_HOST			:= --host=$(GNU_HOST)
PTX_HOST_CROSS_AUTOCONF_BUILD			:= --build=$(GNU_HOST)
PTX_HOST_CROSS_AUTOCONF_TARGET			:= --target=$(PTX_TOUPLE_TARGET)

PTX_HOST_AUTOCONF_PREFIX			:= --prefix=
PTX_HOST_CROSS_AUTOCONF_PREFIX			:= --prefix=$(PTXCONF_PREFIX_CROSS)

PTX_HOST_AUTOCONF := \
	$(PTX_HOST_AUTOCONF_HOST) \
	$(PTX_HOST_AUTOCONF_PREFIX)

PTX_HOST_CROSS_AUTOCONF := \
	$(PTX_HOST_CROSS_AUTOCONF_BUILD) \
	$(PTX_HOST_CROSS_AUTOCONF_HOST) \
	$(PTX_HOST_CROSS_AUTOCONF_TARGET) \
	$(PTX_HOST_CROSS_AUTOCONF_PREFIX)

#
# overwrite to remove rpath
#
PTXDIST_HOST_LDFLAGS				:= -L${PTXDIST_PATH_SYSROOT_HOST_PREFIX}/lib

ifndef PTXCONF_TOOLCHAIN_DEBUG
TOOLCHAIN_CROSS_DEBUG_MAP := \
	$(PTXDIST_SYSROOT_CROSS)= \
	$(call ptx/sh, realpath $(PTXDIST_SYSROOT_CROSS))= \
	$(PTXDIST_WORKSPACE)/platform-=$(call remove_quotes,$(PTXCONF_PROJECT))/platform- \
	$(call ptx/sh, realpath $(PTXDIST_WORKSPACE))/platform-=$(call remove_quotes,$(PTXCONF_PROJECT))/platform-

TOOLCHAIN_CROSS_DEBUG_MAP_FLAGS := \
	$(addprefix -fdebug-prefix-map=,$(TOOLCHAIN_CROSS_DEBUG_MAP))

PTXDIST_HOST_CPPFLAGS := \
	$(PTXDIST_HOST_CPPFLAGS) \
	$(TOOLCHAIN_CROSS_DEBUG_MAP_FLAGS)

TOOLCHAIN_CROSS_DEBUG_FLAGS := \
	-g3 \
	-gno-record-gcc-switches \
	$(TOOLCHAIN_CROSS_DEBUG_MAP_FLAGS)

GLIBC_DEBUG_FLAGS_ENV := \
	$(addsuffix "-O2 $(TOOLCHAIN_CROSS_DEBUG_FLAGS)",CFLAGS= CXXFLAGS=)
endif

#
# gcc-first
#
CROSS_GCC_FIRST_PREFIX	:= $(PTXDIST_PLATFORMDIR)/sysroot-target
CROSS_PATH		:= $(PTXDIST_SYSROOT_CROSS)$(PTXCONF_PREFIX_CROSS)/bin:$(PTXDIST_SYSROOT_CROSS)$(PTXCONF_PREFIX_CROSS)/sbin:$(CROSS_GCC_FIRST_PREFIX)/bin:$(PATH)
HOST_CROSS_PATH		:= $(CROSS_PATH)

#
# debuggable gcc/glibc
#
ifdef PTXCONF_TOOLCHAIN_DEBUG
BUILDDIR_DEBUG		:= $(PTXDIST_SYSROOT_CROSS)$(PTXCONF_PREFIX_CROSS)/src/target
BUILDDIR_CROSS_DEBUG	:= $(PTXDIST_SYSROOT_CROSS)$(PTXCONF_PREFIX_CROSS)/src/cross
else
BUILDDIR_DEBUG		:= $(BUILDDIR)
BUILDDIR_CROSS_DEBUG	:= $(CROSS_BUILDDIR)
endif

#
# images
#

PTX_TOOLCHAIN_HOST_ARCH	:= $(shell uname -m)
ifeq ($(PTX_TOOLCHAIN_HOST_ARCH),x86_64)
PTX_TOOLCHAIN_HOST_ARCH	:= amd64
endif
ifeq ($(patsubst i%86,,$(PTX_TOOLCHAIN_HOST_ARCH)),)
PTX_TOOLCHAIN_HOST_ARCH	:= i386
endif
ifeq ($(PTX_TOOLCHAIN_HOST_ARCH),ppc)
PTX_TOOLCHAIN_HOST_ARCH	:= powerpc
endif

# vim: syntax=make