Debian Codegraph @

gcc/config/loongarch/t-multilib

raw
1 # Copyright (C) 2023-2025 Free Software Foundation, Inc.
2 #
3 # This file is part of GCC.
4 #
5 # GCC is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 3, or (at your option)
8 # any later version.
9 #
10 # GCC is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with GCC; see the file COPYING3. If not see
17 # <http://www.gnu.org/licenses/>.
18
19 # Helper definitions
20 comma=,
21 null :=
22 space := $(null) #
23 exclude_1st = $(wordlist 2,$(words $1),$1)
24
25 # Common definitions
26 mlib_all := lp64d lp64f lp64s
27 $(foreach i,$(mlib_all),$(eval MULTISUBDIR_$i := base/$i))
28
29 mlib_default := $(firstword $(subst $(comma), ,$(TM_MULTILIB_CONFIG)))
30 mlib_all := $(filter-out $(mlib_default),$(mlib_all))
31
32 MULTILIB_OPTIONS := $(subst $(space),/,$(foreach i,$(mlib_all),mabi=$(i)))
33 MULTILIB_DIRNAMES := $(foreach i,$(mlib_all),$(MULTISUBDIR_$(i)))
34
35 # Customize builds with --with-multilib-list
36 MULTILIB_REQUIRED := $(foreach i,$(call exclude_1st,\
37 $(subst $(comma), ,$(TM_MULTILIB_CONFIG))),\
38 $(firstword $(subst /, ,$(i))))
39
40 ## spec rules for building libraries, triggered by -fmultiflags
41 gen_mlib_spec = $(if $(word 2,$1),\
42 %{$(firstword $1):$(patsubst %,-%,$(call exclude_1st,$1)}))
43
44 lib_build_spec = $(foreach mlib,\
45 $(call exclude_1st,$(subst $(comma), ,$(TM_MULTILIB_CONFIG))),\
46 $(call gen_mlib_spec,$(subst /, ,$(mlib))))
47
48 default_mlib_spec := %{fmultiflags:%{!mabi=*:-mabi=$(mlib_default)}}
49 lib_build_spec := %{fmultiflags:$(lib_build_spec)}
50
51 ifneq ($(TM_MULTILIB_CONFIG),)
52 loongarch-multilib.h:
53 @echo "#define MLIB_SELF_SPECS" \
54 "\"$(default_mlib_spec)\"," \
55 "\"$(lib_build_spec)\"," > $@
56 else
57 loongarch-multilib.h: ; @touch $@
58 endif
59
60 # Multiarch
61 ifneq ($(call if_multiarch,yes),yes)
62 # Define LA_DISABLE_MULTIARCH if multiarch is disabled.
63 tm_defines += LA_DISABLE_MULTIARCH
64 else
65 # Only define MULTIARCH_DIRNAME when multiarch is enabled,
66 # or it would always introduce ${target} into the search path.
67 MULTIARCH_DIRNAME = $(LA_MULTIARCH_TRIPLET)
68 endif