1 # Copyright (C) 2011-2017 Free Software Foundation, Inc.
3 # This file is part of GCC.
5 # GCC is free software; you can redistribute it and/or modify it under
6 # the terms of the GNU General Public License as published by the Free
7 # Software Foundation; either version 3, or (at your option) any later
10 # GCC is distributed in the hope that it will be useful, but WITHOUT ANY
11 # WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
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/>.
19 ##################################################################
21 # Transform Core/Device Information from avr-mcus.def to a
22 # Representation that is understood by GCC's multilib Machinery.
24 # The Script works as a Filter from STDIN to STDOUT.
25 # It generates a Makefile Snippet that sets some
26 # MULTILIB_* Variables as needed.
28 ##################################################################
35 dir_tiny =
"tiny-stack"
38 dir_rcall =
"short-calls"
39 opt_rcall =
"mshort-calls"
41 # awk Variable Makefile Variable
42 # ------------------------------------------
43 # m_options <-> MULTILIB_OPTIONS
44 # m_dirnames <-> MULTILIB_DIRNAMES
45 # m_required <-> MULTILIB_REQUIRED
47 m_options =
"\nMULTILIB_OPTIONS = "
48 m_dirnames =
"\nMULTILIB_DIRNAMES ="
49 m_required =
"\nMULTILIB_REQUIRED ="
52 ##################################################################
53 # Add some Comments to the generated Files and copy-paste
54 # Copyright Notice from above.
55 ##################################################################
60 else if (comment ==
1)
62 print "# Auto-generated Makefile Snip"
63 print "# Generated by : ./gcc/config/avr/genmultilib.awk"
64 print "# Generated from : ./gcc/config/avr/avr-mcus.def"
65 print "# Used by : tmake_file from Makefile and genmultilib"
75 # The first empty line stops copy-pasting the GPL comments
76 # from this file to the generated file.
81 ##################################################################
82 # Run over all AVR_MCU Lines. If we encounter a required multilib
83 # variant, add according combination of options to m_required,
84 # but onyl once. Add encountered cores to m_dirnames and
85 # according -mmcu= options to m_options.
86 ##################################################################
96 # avr1 is supported for Assembler only: It gets no multilib
100 option
[core
] =
"mmcu=" core
102 m_options = m_options m_sep option
[core
]
103 m_dirnames = m_dirnames
" " core
109 # avr1 is supported for Assembler only: Its Devices are ignored
115 # split device specific feature list
116 n =
split($
4,dev_attribute
,"|")
118 for (i=
1; i
<= n
; i
++)
120 if (dev_attribute
[i
] ==
"AVR_SHORT_SP")
121 opts = opts
"/" opt_tiny
122 if (dev_attribute
[i
] ==
"AVR_ISA_RCALL")
123 opts = opts
"/" opt_rcall
129 # Some special handling for the default mmcu: Remove a
130 # leading "mmcu=avr2/" in order not to confuse genmultilib.
131 gsub (/^mmcu=avr2\
//, "", opts
)
132 if (opts
!= "mmcu=avr2")
133 m_required = m_required
" \\\n\t" opts
137 ##################################################################
139 ##################################################################
142 ############################################################
144 ############################################################
146 # Intended Target: ./gcc/config/avr/t-multilib
148 print m_options
" " opt_tiny
" " opt_rcall
149 print m_dirnames
" " dir_tiny
" " dir_rcall