1 |
282 |
jeremybenn |
# multilibs -*- mode:Makefile -*-
|
2 |
|
|
#
|
3 |
|
|
# Copyright (C) 2007 Free Software Foundation, Inc.
|
4 |
|
|
#
|
5 |
|
|
# This file is part of GCC.
|
6 |
|
|
#
|
7 |
|
|
# GCC is free software; you can redistribute it and/or modify
|
8 |
|
|
# it under the terms of the GNU General Public License as published by
|
9 |
|
|
# the Free Software Foundation; either version 3, or (at your option)
|
10 |
|
|
# any later version.
|
11 |
|
|
#
|
12 |
|
|
# GCC is distributed in the hope that it will be useful,
|
13 |
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14 |
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15 |
|
|
# GNU General Public License for more details.
|
16 |
|
|
#
|
17 |
|
|
# You should have received a copy of the GNU General Public License
|
18 |
|
|
# along with GCC; see the file COPYING3. If not see
|
19 |
|
|
# .
|
20 |
|
|
|
21 |
|
|
# An awk command to extract lines from the m68k-devices.def file that
|
22 |
|
|
# match $1 and then print the string defined by $2. Leading and
|
23 |
|
|
# trailing whitespace is removed. $1 & $2 can make use of
|
24 |
|
|
# CPU -- the cpu identifier (has leading 'm'/'mcf')
|
25 |
|
|
# FLAGS -- the cpu capability flags
|
26 |
|
|
# CPU_NAME -- the cpu name (has no leading m/mcf)
|
27 |
|
|
# MLIB -- the multilib cpu name (no leading m/mcf)
|
28 |
|
|
# This is intended to be used as $(call M68K_AWK,predicate,string)
|
29 |
|
|
M68K_AWK = $(strip $(shell $(AWK) 'BEGIN { FS="[ \t]*[,()][ \t]*"; ORS=" " }; \
|
30 |
|
|
/^M68K_DEVICE/ { CPU=$$3; FLAGS=$$8; \
|
31 |
|
|
CPU_NAME=substr($$2,2,length($$2)-2); \
|
32 |
|
|
MLIB=substr($$5,2,length($$5)-2); \
|
33 |
|
|
if ($1) print $2 }' $(srcdir)/config/m68k/m68k-devices.def))
|
34 |
|
|
|
35 |
|
|
# Add a multilib for each distinct architecture. M68K_MLIB_CPU, if defined,
|
36 |
|
|
# adds additional restrictions.
|
37 |
|
|
M68K_MLIB_CPUS := $(call M68K_AWK,\
|
38 |
|
|
(CPU_NAME == MLIB) $(M68K_MLIB_CPU), \
|
39 |
|
|
"m"MLIB)
|
40 |
|
|
|
41 |
|
|
# Make the default cpu the default multilib.
|
42 |
|
|
M68K_MLIB_DEFAULT := $(call M68K_AWK, CPU == "$(target_cpu_default)", MLIB)
|
43 |
|
|
|
44 |
|
|
ifeq ($(filter m$(M68K_MLIB_DEFAULT),$(M68K_MLIB_CPUS)),)
|
45 |
|
|
$(error Error default cpu '$(target_cpu_default)' is not in multilib set '$(M68K_MLIB_CPUS)')
|
46 |
|
|
endif
|
47 |
|
|
|
48 |
|
|
# Sed arguments that convert mcpu=* arguments into canonical forms.
|
49 |
|
|
# We want to use the legacy m68* options instead of the new -mcpu=68*
|
50 |
|
|
# options when compiling multilibs because the former are recognised
|
51 |
|
|
# by older binutils.
|
52 |
|
|
CANONICALIZE_OPTIONS = -e 's|mcpu=68|m68|g' -e 's|mcpu=cpu32|mcpu32|g'
|
53 |
|
|
|
54 |
|
|
MULTILIB_DIRNAMES := $(filter-out m$(M68K_MLIB_DEFAULT),$(M68K_MLIB_CPUS))
|
55 |
|
|
MULTILIB_OPTIONS := $(shell echo $(MULTILIB_DIRNAMES:m%=mcpu=%) \
|
56 |
|
|
| sed -e 's| |/|g' $(CANONICALIZE_OPTIONS))
|
57 |
|
|
|
58 |
|
|
# Add subtarget specific options & dirs.
|
59 |
|
|
MULTILIB_DIRNAMES += $(M68K_MLIB_DIRNAMES)
|
60 |
|
|
MULTILIB_OPTIONS += $(M68K_MLIB_OPTIONS)
|
61 |
|
|
|
62 |
|
|
MULTILIB_MATCHES :=
|
63 |
|
|
|
64 |
|
|
ifneq ($(M68K_ARCH),cf)
|
65 |
|
|
# Map the new-style options to the legacy m68k ones.
|
66 |
|
|
MULTILIB_MATCHES += m68000=mcpu?68000 m68000=march?68000 m68000=mc68000 \
|
67 |
|
|
m68000=m68302 \
|
68 |
|
|
m68020=mcpu?68020 m68020=march?68020 m68020=mc68020 \
|
69 |
|
|
m68030=mcpu?68030 m68030=march?68030 \
|
70 |
|
|
m68040=mcpu?68040 m68040=march?68040 \
|
71 |
|
|
m68060=mcpu?68060 m68060=march?68060 \
|
72 |
|
|
mcpu32=mcpu?cpu32 mcpu32=march?cpu32 mcpu32=m68332
|
73 |
|
|
endif
|
74 |
|
|
|
75 |
|
|
ifneq ($(M68K_ARCH),m68k)
|
76 |
|
|
# Map the legacy ColdFire options to the new ones.
|
77 |
|
|
MULTILIB_MATCHES += mcpu?5206=m5200 mcpu?5206e=m5206e mcpu?5208=m528x \
|
78 |
|
|
mcpu?5307=m5300 mcpu?5307=m5307 \
|
79 |
|
|
mcpu?5407=m5400 mcpu?5407=m5407 \
|
80 |
|
|
mcpu?5475=mcfv4e
|
81 |
|
|
# Map -march=* options to the representative -mcpu=* option.
|
82 |
|
|
MULTILIB_MATCHES += mcpu?5206e=march?isaa mcpu?5208=march?isaaplus \
|
83 |
|
|
mcpu?5407=march?isab
|
84 |
|
|
endif
|
85 |
|
|
|
86 |
|
|
# Match non-representative -mcpu options to their representative option.
|
87 |
|
|
MULTILIB_MATCHES += \
|
88 |
|
|
$(call M68K_AWK, \
|
89 |
|
|
(CPU_NAME != MLIB) $(M68K_MLIB_CPU), \
|
90 |
|
|
(match(MLIB, "^68") || MLIB == "cpu32" \
|
91 |
|
|
? "m"MLIB"=mcpu?"CPU_NAME \
|
92 |
|
|
: "mcpu?"MLIB"=mcpu?"CPU_NAME))
|
93 |
|
|
|
94 |
|
|
MULTILIB_EXCEPTIONS :=
|
95 |
|
|
|
96 |
|
|
ifeq ($(firstword $(M68K_MLIB_OPTIONS)),msoft-float)
|
97 |
|
|
# Exclude soft-float multilibs for targets that default to soft-float anyway.
|
98 |
|
|
MULTILIB_EXCEPTIONS += $(call M68K_AWK,\
|
99 |
|
|
(CPU_NAME == MLIB) $(M68K_MLIB_CPU) \
|
100 |
|
|
&& (((CPU ~ "^mcf") && !match(FLAGS, "FL_CF_FPU")) \
|
101 |
|
|
|| CPU == "cpu32" \
|
102 |
|
|
|| CPU == "m68000"), \
|
103 |
|
|
"mcpu="MLIB"/msoft-float*")
|
104 |
|
|
endif
|
105 |
|
|
|
106 |
|
|
# Remove the default CPU from the explicit exceptions.
|
107 |
|
|
MULTILIB_EXCEPTIONS := \
|
108 |
|
|
$(patsubst mcpu=$(M68K_MLIB_DEFAULT)/%,%,$(MULTILIB_EXCEPTIONS))
|
109 |
|
|
|
110 |
|
|
# Convert all options to canonical form.
|
111 |
|
|
MULTILIB_EXCEPTIONS := $(shell echo $(MULTILIB_EXCEPTIONS) | \
|
112 |
|
|
sed $(CANONICALIZE_OPTIONS))
|
113 |
|
|
|
114 |
|
|
LIBGCC = stmp-multilib
|
115 |
|
|
INSTALL_LIBGCC = install-multilib
|