| 1 |
709 |
jeremybenn |
# multilibs -*- mode:Makefile -*-
|
| 2 |
|
|
#
|
| 3 |
|
|
# Copyright (C) 2007, 2011 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 |
|
|
MULTILIB_DIRNAMES := $(filter-out m$(M68K_MLIB_DEFAULT),$(M68K_MLIB_CPUS))
|
| 49 |
|
|
MULTILIB_OPTIONS := $(shell echo $(MULTILIB_DIRNAMES:m%=mcpu=%) \
|
| 50 |
|
|
| sed -e 's| |/|g' )
|
| 51 |
|
|
|
| 52 |
|
|
# Add subtarget specific options & dirs.
|
| 53 |
|
|
MULTILIB_DIRNAMES += $(M68K_MLIB_DIRNAMES)
|
| 54 |
|
|
MULTILIB_OPTIONS += $(M68K_MLIB_OPTIONS)
|
| 55 |
|
|
|
| 56 |
|
|
MULTILIB_MATCHES :=
|
| 57 |
|
|
|
| 58 |
|
|
ifneq ($(M68K_ARCH),cf)
|
| 59 |
|
|
# Map -march=* options to the representative -mcpu=* option.
|
| 60 |
|
|
MULTILIB_MATCHES += mcpu?68000=march?68000 \
|
| 61 |
|
|
mcpu?68020=march?68020 \
|
| 62 |
|
|
mcpu?68030=march?68030 \
|
| 63 |
|
|
mcpu?68040=march?68040 \
|
| 64 |
|
|
mcpu?68060=march?68060 \
|
| 65 |
|
|
mcpu?cpu32=march?cpu32
|
| 66 |
|
|
endif
|
| 67 |
|
|
|
| 68 |
|
|
ifneq ($(M68K_ARCH),m68k)
|
| 69 |
|
|
# Map -march=* options to the representative -mcpu=* option.
|
| 70 |
|
|
MULTILIB_MATCHES += mcpu?5206e=march?isaa mcpu?5208=march?isaaplus \
|
| 71 |
|
|
mcpu?5407=march?isab
|
| 72 |
|
|
endif
|
| 73 |
|
|
|
| 74 |
|
|
# Match non-representative -mcpu options to their representative option.
|
| 75 |
|
|
MULTILIB_MATCHES += \
|
| 76 |
|
|
$(call M68K_AWK, \
|
| 77 |
|
|
(CPU_NAME != MLIB) $(M68K_MLIB_CPU), \
|
| 78 |
|
|
("mcpu?"MLIB"=mcpu?"CPU_NAME))
|
| 79 |
|
|
|
| 80 |
|
|
MULTILIB_EXCEPTIONS :=
|
| 81 |
|
|
|
| 82 |
|
|
ifeq ($(firstword $(M68K_MLIB_OPTIONS)),msoft-float)
|
| 83 |
|
|
# Exclude soft-float multilibs for targets that default to soft-float anyway.
|
| 84 |
|
|
MULTILIB_EXCEPTIONS += $(call M68K_AWK,\
|
| 85 |
|
|
(CPU_NAME == MLIB) $(M68K_MLIB_CPU) \
|
| 86 |
|
|
&& (((CPU ~ "^mcf") && !match(FLAGS, "FL_CF_FPU")) \
|
| 87 |
|
|
|| CPU == "cpu32" \
|
| 88 |
|
|
|| CPU == "m68000"), \
|
| 89 |
|
|
"mcpu="MLIB"/msoft-float*")
|
| 90 |
|
|
endif
|
| 91 |
|
|
|
| 92 |
|
|
# Remove the default CPU from the explicit exceptions.
|
| 93 |
|
|
MULTILIB_EXCEPTIONS := \
|
| 94 |
|
|
$(patsubst mcpu=$(M68K_MLIB_DEFAULT)/%,%,$(MULTILIB_EXCEPTIONS))
|