OpenCores
URL https://opencores.org/ocsvn/scarts/scarts/trunk

Subversion Repositories scarts

[/] [scarts/] [trunk/] [toolchain/] [scarts-gcc/] [gcc-4.1.1/] [gcc/] [mklibgcc.in] - Blame information for rev 20

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 12 jlechner
#!/bin/sh
2
# Construct makefile for libgcc.
3
#   Copyright (C) 2000, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
4
#
5
# This file is part of GCC.
6
 
7
# Arguments, taken from the environment, since there are a lot
8
# of them, and positional args becomes quite ugly.
9
#
10
# objext
11
# LIB1ASMFUNCS
12
# LIB2FUNCS_ST
13
# LIBGCOV
14
# LIB2ADD
15
# LIB2ADD_ST
16
# LIB2ADDEH
17
# LIB2ADDEHSTATIC
18
# LIB2ADDEHSHARED
19
# LIB2ADDEHDEP
20
# LIBUNWIND
21
# LIBUNWINDDEP
22
# SHLIBUNWIND_LINK
23
# SHLIBUNWIND_INSTALL
24
# FPBIT
25
# FPBIT_FUNCS
26
# LIB2_DIVMOD_FUNCS
27
# DPBIT
28
# DPBIT_FUNCS
29
# TPBIT
30
# TPBIT_FUNCS
31
# LIBGCC
32
# MULTILIBS
33
# EXTRA_MULTILIB_PARTS
34
# SHLIB_EXT
35
# SHLIB_LINK
36
# SHLIB_MKMAP
37
# SHLIB_MKMAP_OPTS
38
# SHLIB_MAPFILES
39
# SHLIB_NM_FLAGS
40
# SHLIB_INSTALL
41
# MULTILIB_OSDIRNAMES
42
# ASM_HIDDEN_OP
43
# GCC_FOR_TARGET
44
 
45
# Make needs VPATH to be literal.
46
echo 'srcdir = @srcdir@'
47
echo 'VPATH = @srcdir@'
48
echo 'EQ = ='
49
echo 'objects = $(filter %'$objext',$^)'
50
echo
51
echo '# Dependencies are accumulated as we go.'
52
echo 'all: stmp-dirs'
53
echo 'dirs = libgcc'
54
echo
55
 
56
# Library members defined in libgcc2.c.
57
lib2funcs='_muldi3 _negdi2 _lshrdi3 _ashldi3 _ashrdi3
58
        _cmpdi2 _ucmpdi2 _floatdidf _floatdisf _fixunsdfsi _fixunssfsi
59
        _fixunsdfdi _fixdfdi _fixunssfdi _fixsfdi _fixxfdi _fixunsxfdi
60
        _floatdixf _fixunsxfsi _fixtfdi _fixunstfdi _floatditf _clear_cache
61
        _enable_execute_stack _trampoline __main _absvsi2 _absvdi2 _addvsi3
62
        _addvdi3 _subvsi3 _subvdi3 _mulvsi3 _mulvdi3 _negvsi2 _negvdi2 _ctors
63
        _ffssi2 _ffsdi2 _clz _clzsi2 _clzdi2 _ctzsi2 _ctzdi2 _popcount_tab
64
        _popcountsi2 _popcountdi2 _paritysi2 _paritydi2 _powisf2 _powidf2
65
        _powixf2 _powitf2 _mulsc3 _muldc3 _mulxc3 _multc3 _divsc3 _divdc3
66
        _divxc3 _divtc3'
67
 
68
# Disable SHLIB_LINK if shared libgcc not enabled.
69
if [ "@enable_shared@" = "no" ]; then
70
  SHLIB_LINK=""
71
fi
72
 
73
# Build lines.
74
 
75
gcc_compile='$(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES)'
76
gcc_s_compile="$gcc_compile -DSHARED"
77
make_compile='$(MAKE) GCC_FOR_TARGET="$(GCC_FOR_TARGET)" \
78
          AR_FOR_TARGET="$(AR_FOR_TARGET)" \
79
          AR_CREATE_FOR_TARGET="$(AR_CREATE_FOR_TARGET)" \
80
          AR_EXTRACT_FOR_TARGET="$(AR_EXTRACT_FOR_TARGET)" \
81
          AR_FLAGS_FOR_TARGET="$(AR_FLAGS_FOR_TARGET)" \
82
          CC="$(CC)" CFLAGS="$(CFLAGS)" \
83
          BUILD_PREFIX="$(BUILD_PREFIX)" \
84
          BUILD_PREFIX_1="$(BUILD_PREFIX_1)" \
85
          LANGUAGES="$(LANGUAGES)"'
86
 
87
# Generic dependencies for libgcc
88
libgcc_dep='$(CONFIG_H) coretypes.h $(TM_H) $(MACHMODE_H) longlong.h config.status stmp-int-hdrs tsystem.h'
89
 
90
# Dependencies for libgcc2.c
91
libgcc2_c_dep='stmp-dirs $(srcdir)/libgcc2.c $(srcdir)/libgcc2.h gbl-ctors.h'" $libgcc_dep"
92
 
93
# Dependencies for libgcov.c
94
libgcov_c_dep='stmp-dirs $(srcdir)/libgcov.c $(srcdir)/gcov-io.h $(srcdir)/gcov-io.c gcov-iov.h'" $libgcc_dep"
95
 
96
# Dependencies for fp-bit.c
97
fpbit_c_dep='stmp-dirs config.status tsystem.h'
98
 
99
# Flag whether we need eh_dummy.c
100
need_eh_dummy=
101
 
102
if [ "$SHLIB_LINK" ]; then
103
  # Test -fvisibility=hidden.  We need both a -fvisibility=hidden on
104
  # the command line, and a #define to prevent libgcc2.h etc from
105
  # overriding that with #pragmas.  The dance with @ is to prevent
106
  # echo from seeing anything it might take for an option.
107
  # echo turns the \$\$\$\$ into $$$$ and when make sees it it
108
  # becomes $$ and the shell substitutes the pid. Makes for a
109
  # slightly safer temp file.
110
  echo "vis_hide := \$(strip \$(subst @,-,\\"
111
  echo "    \$(shell if echo 'void foo(void); void foo(void) {}' | \\"
112
  echo "          $gcc_compile -fvisibility=hidden -Werror \\"
113
  echo "          -c -xc - -o vis_temp_file\$\$\$\$.o 2> /dev/null; \\"
114
  echo "          then echo @fvisibility=hidden @DHIDE_EXPORTS; \\"
115
  echo "          rm vis_temp_file\$\$\$\$.o 2> /dev/null; \\"
116
  echo "          fi)))"
117
  echo
118
 
119
  # If we have -fvisibility=hidden, then we need to generate hide
120
  # lists for object files implemented in assembly.  The default
121
  # pseudo-op for this is ".hidden", but can be overridden with
122
  # ASM_HIDDEN_OP.
123
  [ "$ASM_HIDDEN_OP" ] || ASM_HIDDEN_OP=".hidden"
124
 
125
  echo "ifneq (,\$(vis_hide))"
126
  echo "define gen-hide-list"
127
  echo "\$(NM_FOR_TARGET) ${SHLIB_NM_FLAGS} \$< | \\"
128
  # non-GNU nm emits three fields even for undefined and typeless symbols,
129
  # so explicitly omit them
130
  echo "  \$(AWK) 'NF == 3 && \$\$2 !~ /^[UN]\$\$/ { print \"\\t${ASM_HIDDEN_OP}\", \$\$3 }' > \$@T"
131
  echo "mv -f \$@T \$@"
132
  echo "endef"
133
  echo "else"
134
  echo "gen-hide-list = echo > \$@"
135
  echo "endif"
136
  echo
137
else
138
  # It is too hard to guarantee that vis_hide and gen-hide-list will never
139
  # be referenced if SHLIB_LINK is not set, so set them to the values they'd
140
  # have if SHLIB_LINK were set and we didn't have visibility support.
141
  echo "vis_hide ="
142
  echo "gen-hide-list = echo > \$@"
143
fi
144
 
145
# Remove any objects from lib2funcs and LIB2_DIVMOD_FUNCS that are
146
# defined as optimized assembly code in LIB1ASMFUNCS.
147
for name in $LIB1ASMFUNCS; do
148
  lib2funcs=`echo $lib2funcs | sed -e 's/^'$name' //' \
149
                                   -e 's/ '$name' / /' \
150
                                   -e 's/ '$name'$//'`
151
  LIB2_DIVMOD_FUNCS=`echo $LIB2_DIVMOD_FUNCS | sed -e 's/^'$name' //' \
152
                                                   -e 's/ '$name' / /' \
153
                                                   -e 's/ '$name'$//'`
154
done
155
 
156
#
157
# Rules to generate object files.
158
#
159
 
160
for ml in $MULTILIBS; do
161
 
162
  # Work out relevant parameters that depend only on the multilib.
163
  dir=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
164
  flags=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`;
165
  shlib_slibdir_qual=
166
  libgcc_a=$dir/libgcc.a
167
  libgcov_a=$dir/libgcov.a
168
  libgcc_eh_a=
169
  libgcc_s_so=
170
  libunwind_a=
171
  libunwind_so=
172
 
173
  if [ "$LIBUNWIND" ]; then
174
    libunwind_a=$dir/libunwind.a
175
  fi
176
  if [ "$SHLIB_LINK" ]; then
177
    libgcc_eh_a=$dir/libgcc_eh.a
178
    libgcc_s_so=$dir/libgcc_s${SHLIB_EXT}
179
    if [ "$LIBUNWIND" ]; then
180
      libunwind_so=$dir/libunwind${SHLIB_EXT}
181
    fi
182
    os_multilib_dir=`$GCC_FOR_TARGET $flags --print-multi-os-directory`
183
    if [ "$os_multilib_dir" != . ]; then
184
      shlib_slibdir_qual="/$os_multilib_dir"
185
    fi
186
  fi
187
 
188
  libgcc_s_so_extra=
189
  libunwind_so_extra=
190
 
191
  echo
192
  echo \#
193
  echo \# ml: $ml
194
  echo \# dir: $dir
195
  echo \# flags: $flags
196
  echo \# libgcc_a: $libgcc_a
197
  echo \# libgcov_a: $libgcov_a
198
  echo \# libgcc_eh_a: $libgcc_eh_a
199
  echo \# libunwind_a: $libunwind_a
200
  echo \#
201
  echo \# shlib_slibdir_qual: $shlib_slibdir_qual
202
  echo \# libgcc_s_so: $libgcc_s_so
203
  echo \# libunwind_so: $libunwind_so
204
  echo \#
205
  echo
206
 
207
  # Update list of directories.
208
  if [ $dir != . ]; then
209
    echo "dirs += ${dir} libgcc/${dir}"
210
    echo
211
  fi
212
 
213
  #
214
  # Build libgcc1 components.
215
  #
216
  for name in $LIB1ASMFUNCS; do
217
    if [ "$libgcc_s_so" ]; then
218
      out="libgcc/${dir}/${name}${objext}"
219
      outS="libgcc/${dir}/${name}_s${objext}"
220
      outV="libgcc/${dir}/${name}.vis"
221
 
222
      echo ${outS}: stmp-dirs '$(srcdir)/config/$(LIB1ASMSRC)'
223
      echo "    $gcc_s_compile" $flags -DL$name -xassembler-with-cpp \
224
          -c '$(srcdir)/config/$(LIB1ASMSRC)' -o $outS
225
 
226
      echo ${out}: stmp-dirs '$(srcdir)/config/$(LIB1ASMSRC)' ${outV}
227
      echo "    $gcc_compile" $flags -DL$name -xassembler-with-cpp \
228
          -c '$(srcdir)/config/$(LIB1ASMSRC)' -include $outV -o $out
229
 
230
      echo "${outV}: ${outS}; \$(gen-hide-list)"
231
 
232
      echo $libgcc_a: $out
233
      echo $libgcc_s_so: $outS
234
      if [ "$SHLIB_MKMAP" ]; then
235
        echo libgcc/${dir}/libgcc.map: $outS
236
      fi
237
    else
238
      out="libgcc/${dir}/${name}${objext}"
239
      echo ${out}: stmp-dirs '$(srcdir)/config/$(LIB1ASMSRC)'
240
      echo "    $gcc_compile" $flags -DL$name -xassembler-with-cpp \
241
          -c '$(srcdir)/config/$(LIB1ASMSRC)' -o $out
242
      echo $libgcc_a: $out
243
    fi
244
  done
245
 
246
  #
247
  # Build libgcc2 components.
248
  #
249
 
250
  for name in $lib2funcs; do
251
    if [ "$libgcc_s_so" ]; then
252
      out="libgcc/${dir}/${name}${objext}"
253
      outS="libgcc/${dir}/${name}_s${objext}"
254
 
255
      echo $outS: $libgcc2_c_dep
256
      echo "    $gcc_s_compile" $flags -DL$name -c '$(srcdir)/libgcc2.c' \
257
        -o $outS
258
 
259
      echo $out: $libgcc2_c_dep
260
      echo "    $gcc_compile" $flags -DL$name '$(vis_hide)' \
261
        -c '$(srcdir)/libgcc2.c' -o $out
262
 
263
      echo $libgcc_a: $out
264
      echo $libgcc_s_so: $outS
265
      if [ "$SHLIB_MKMAP" ]; then
266
        echo libgcc/${dir}/libgcc.map: $outS
267
      fi
268
    else
269
      out="libgcc/${dir}/${name}${objext}"
270
      echo ${out}: stmp-dirs '$(srcdir)/config/$(LIB1ASMSRC)'
271
      echo "    $gcc_compile" $flags -DL$name -c '$(srcdir)/libgcc2.c' -o $out
272
      echo $libgcc_a: $out
273
    fi
274
  done
275
 
276
  for name in $LIB2FUNCS_ST; do
277
    out="libgcc/${dir}/${name}${objext}"
278
 
279
    echo $out: $libgcc2_c_dep
280
    echo "      $gcc_compile" $flags -DL$name '$(vis_hide)' \
281
      -c '$(srcdir)/libgcc2.c' -o $out
282
    echo ${dir}/libgcc.a: $out
283
  done
284
 
285
  for name in $LIB2_DIVMOD_FUNCS; do
286
    if [ "$libgcc_s_so" ]; then
287
      out="libgcc/${dir}/${name}${objext}"
288
      outS="libgcc/${dir}/${name}_s${objext}"
289
 
290
      echo $outS: $libgcc2_c_dep
291
      echo "    $gcc_s_compile" $flags -DL$name \
292
        -fexceptions -fnon-call-exceptions -c '$(srcdir)/libgcc2.c' -o $outS
293
 
294
      echo $out: $libgcc2_c_dep
295
      echo "    $gcc_compile" $flags -DL$name '$(vis_hide)' \
296
        -fexceptions -fnon-call-exceptions -c '$(srcdir)/libgcc2.c' -o $out
297
 
298
      echo $libgcc_a: $out
299
      echo $libgcc_s_so: $outS
300
      if [ "$SHLIB_MKMAP" ]; then
301
        echo libgcc/${dir}/libgcc.map: $outS
302
      fi
303
    else
304
      out="libgcc/${dir}/${name}${objext}"
305
      echo ${out}: stmp-dirs '$(srcdir)/config/$(LIB1ASMSRC)'
306
      echo "    $gcc_compile" $flags -DL$name \
307
        -fexceptions -fnon-call-exceptions -c '$(srcdir)/libgcc2.c' -o $out
308
      echo $libgcc_a: $out
309
    fi
310
  done
311
 
312
  #
313
  # Build software floating point functions.
314
  #
315
 
316
  if [ "$FPBIT" ]; then
317
    for name in $FPBIT_FUNCS; do
318
      [ "$name" = _sf_to_tf -a -z "$TPBIT" ] && continue
319
      if [ "$libgcc_s_so" ]; then
320
        out="libgcc/${dir}/${name}${objext}"
321
        outS="libgcc/${dir}/${name}_s${objext}"
322
 
323
        echo $outS: $FPBIT $fpbit_c_dep
324
        echo "  $gcc_s_compile" -DFINE_GRAINED_LIBRARIES $flags -DL$name \
325
          -c $FPBIT -o $outS
326
 
327
        echo $out: $FPBIT $fpbit_c_dep
328
        echo "  $gcc_compile" -DFINE_GRAINED_LIBRARIES $flags -DL$name \
329
          '$(vis_hide)' -c $FPBIT -o $out
330
 
331
        echo $libgcc_a: $out
332
        echo $libgcc_s_so: $outS
333
        if [ "$SHLIB_MKMAP" ]; then
334
          echo libgcc/${dir}/libgcc.map: $outS
335
        fi
336
      else
337
        out="libgcc/${dir}/${name}${objext}"
338
        echo $out: $FPBIT $fpbit_c_dep
339
        echo "  $gcc_compile" -DFINE_GRAINED_LIBRARIES $flags -DL$name \
340
          -c $FPBIT -o $out
341
 
342
        echo $libgcc_a: $out
343
      fi
344
    done
345
  fi
346
 
347
  if [ "$DPBIT" ]; then
348
    for name in $DPBIT_FUNCS; do
349
      [ "$name" = _df_to_tf -a -z "$TPBIT" ] && continue
350
      if [ "$libgcc_s_so" ]; then
351
        out="libgcc/${dir}/${name}${objext}"
352
        outS="libgcc/${dir}/${name}_s${objext}"
353
 
354
        echo $outS: $DPBIT $fpbit_c_dep
355
        echo "  $gcc_s_compile" -DFINE_GRAINED_LIBRARIES $flags -DL$name \
356
          -c $DPBIT -o $outS
357
 
358
        echo $out: $DPBIT $fpbit_c_dep
359
        echo "  $gcc_compile" -DFINE_GRAINED_LIBRARIES $flags -DL$name \
360
          '$(vis_hide)' -c $DPBIT -o $out
361
 
362
        echo $libgcc_a: $out
363
        echo $libgcc_s_so: $outS
364
        if [ "$SHLIB_MKMAP" ]; then
365
          echo libgcc/${dir}/libgcc.map: $outS
366
        fi
367
      else
368
        out="libgcc/${dir}/${name}${objext}"
369
        echo $out: $DPBIT $fpbit_c_dep
370
        echo "  $gcc_compile" -DFINE_GRAINED_LIBRARIES $flags -DL$name \
371
          -c $DPBIT -o $out
372
 
373
        echo $libgcc_a: $out
374
      fi
375
    done
376
  fi
377
 
378
  if [ "$TPBIT" ]; then
379
    for name in $TPBIT_FUNCS; do
380
      if [ "$libgcc_s_so" ]; then
381
        out="libgcc/${dir}/${name}${objext}"
382
        outS="libgcc/${dir}/${name}_s${objext}"
383
 
384
        echo $outS: $TPBIT $fpbit_c_dep
385
        echo "  $gcc_s_compile" -DFINE_GRAINED_LIBRARIES $flags -DL$name \
386
          -c $TPBIT -o $outS
387
 
388
        echo $out: $TPBIT $fpbit_c_dep
389
        echo "  $gcc_compile" -DFINE_GRAINED_LIBRARIES $flags -DL$name \
390
          '$(vis_hide)' -c $TPBIT -o $out
391
 
392
        echo $libgcc_a: $out
393
        echo $libgcc_s_so: $outS
394
        if [ "$SHLIB_MKMAP" ]; then
395
          echo libgcc/${dir}/libgcc.map: $outS
396
        fi
397
      else
398
        out="libgcc/${dir}/${name}${objext}"
399
        echo $out: $TPBIT $fpbit_c_dep
400
        echo "  $gcc_compile" -DFINE_GRAINED_LIBRARIES $flags -DL$name \
401
          -c $TPBIT -o $out
402
 
403
        echo $libgcc_a: $out
404
      fi
405
    done
406
  fi
407
 
408
  for file in $LIB2ADD; do
409
    name=`echo $file | sed -e 's/[.][cS]$//' -e 's/[.]asm$//'`
410
    oname=`echo $name | sed -e 's,.*/,,'`
411
 
412
    if [ "$libgcc_s_so" ]; then
413
      out="libgcc/${dir}/${oname}${objext}"
414
      outS="libgcc/${dir}/${oname}_s${objext}"
415
 
416
      case $file in
417
        *.c)
418
          echo $outS: stmp-dirs $file $libgcc_dep
419
          echo "        $gcc_s_compile" $flags -c $file -o $outS
420
 
421
          echo $out: stmp-dirs $file $libgcc_dep
422
          echo "        $gcc_compile" $flags '$(vis_hide)' -c $file -o $out
423
        ;;
424
 
425
        *.asm | *.S)
426
          outV="libgcc/${dir}/${oname}.vis"
427
 
428
          echo $outS: stmp-dirs $file $libgcc_dep
429
          echo "        $gcc_s_compile" $flags -xassembler-with-cpp \
430
                 -c $file -o $outS
431
 
432
          echo $out: stmp-dirs $file $libgcc_dep $outV
433
          echo "        $gcc_compile" $flags -xassembler-with-cpp \
434
                 -include $outV -c $file -o $out
435
          echo "${outV}: ${outS}; \$(gen-hide-list)"
436
        ;;
437
 
438
        *)
439
          echo "Unhandled extension: $file" >&2
440
          exit 1
441
        ;;
442
      esac
443
 
444
      echo $libgcc_a: $out
445
      echo $libgcc_s_so: $outS
446
      if [ "$SHLIB_MKMAP" ]; then
447
        echo libgcc/${dir}/libgcc.map: $outS
448
      fi
449
    else
450
      out="libgcc/${dir}/${oname}${objext}"
451
      case $file in
452
        *.c)
453
          echo $out: stmp-dirs $file $libgcc_dep
454
          echo "        $gcc_compile" $flags -c $file -o $out
455
        ;;
456
 
457
        *.asm | *.S)
458
          echo $out: stmp-dirs $file $libgcc_dep
459
          echo "        $gcc_compile" $flags -xassembler-with-cpp \
460
                 -c $file -o $out
461
        ;;
462
 
463
        *)
464
          echo "Unhandled extension: $file" >&2
465
          exit 1
466
        ;;
467
      esac
468
 
469
      echo $libgcc_a: $out
470
    fi
471
  done
472
 
473
 
474
  for file in $LIB2ADD_ST; do
475
    name=`echo $file | sed -e 's/[.][cSo]$//' -e 's/[.]asm$//'`
476
    oname=`echo $name | sed -e 's,.*/,,'`
477
    out="libgcc/${dir}/${oname}${objext}"
478
 
479
    case $file in
480
      *.c)
481
        echo $out: stmp-dirs $file $libgcc_dep
482
        echo "  $gcc_compile" $flags '$(vis_hide)' -c $file -o $out
483
      ;;
484
 
485
      *.asm | *.S)
486
        # We may have to compile it twice in order to establish the list
487
        # of symbols to be marked hidden.
488
        if [ "$libgcc_so" ]; then
489
          outV="libgcc/${dir}/${oname}.vis"
490
          outT="libgcc/${dir}/${oname}_t${objext}"
491
          echo ${outT}: stmp-dirs $file $libgcc_dep
492
          echo "        $gcc_compile" $flags -xassembler-with-cpp \
493
                  -c $file -o ${outT}
494
          echo $out: stmp-dirs $file $libgcc_dep $outV
495
          echo "        $gcc_compile" $flags -xassembler-with-cpp \
496
                  -include $outV -c $file -o $out
497
          echo "${outV}: ${outT}; \$(gen-hide-list)"
498
        else
499
          echo $out: stmp-dirs $file $libgcc_dep
500
          echo "        $gcc_compile" $flags -xassembler-with-cpp \
501
                  -c $file -o $out
502
        fi
503
      ;;
504
 
505
      *)
506
      echo "Unhandled extension: $file" >&2
507
      exit 1
508
      ;;
509
    esac
510
    echo $libgcc_a: $out
511
  done
512
 
513
  # If we don't have libgcc_eh.a, only LIB2ADDEH matters.  If we do, only
514
  # LIB2ADDEHSTATIC and LIB2ADDEHSHARED matter.  (Usually all three are
515
  # identical.)
516
 
517
  if [ "$libgcc_eh_a" ]; then
518
    for file in $LIB2ADDEHSTATIC; do
519
      name=`echo $file | sed -e 's/[.][cSo]$//' -e 's/[.]asm$//'`
520
      oname=`echo $name | sed -e 's,.*/,,'`
521
      out="libgcc/${dir}/${oname}${objext}"
522
 
523
      case $file in
524
        *.c)
525
          echo $out: stmp-dirs $file $LIB2ADDEHDEP $libgcc_dep
526
          echo "        $gcc_compile" $flags -fexceptions '$(vis_hide)' -c $file -o $out
527
          ;;
528
        *.asm | *.S)
529
          # We have to compile it twice in order to establish the list
530
          # of symbols to be marked hidden.
531
          outV="libgcc/${dir}/${oname}.vis"
532
          outT="libgcc/${dir}/${oname}_t${objext}"
533
          echo ${outT}: stmp-dirs $file $LIB2ADDEHDEP $libgcc_dep
534
          echo "        $gcc_compile" $flags -xassembler-with-cpp \
535
                  -c $file -o ${outT}
536
          echo $out: stmp-dirs $file $LIB2ADDEHDEP $libgcc_dep $outV
537
          echo "        $gcc_compile" $flags -xassembler-with-cpp \
538
                  -include $outV -c $file -o $out
539
          echo "${outV}: ${outT}; \$(gen-hide-list)"
540
          ;;
541
        *)   echo "Unhandled extension: $file">&2; exit 1 ;;
542
      esac
543
 
544
      echo $libgcc_eh_a: $out
545
    done
546
 
547
    for file in $LIB2ADDEHSHARED; do
548
      name=`echo $file | sed -e 's/[.][cSo]$//' -e 's/[.]asm$//'`
549
      oname=`echo $name | sed -e 's,.*/,,'`
550
      outS="libgcc/${dir}/${oname}_s${objext}"
551
 
552
      case $file in
553
        *.c)
554
          echo $outS: stmp-dirs $file $LIB2ADDEHDEP $libgcc_dep
555
          echo "        $gcc_s_compile" $flags -fexceptions -c $file -o $outS
556
          ;;
557
        *.asm | *.S)
558
          echo $outS: stmp-dirs $file $LIB2ADDEHDEP $libgcc_dep
559
          echo "        $gcc_s_compile" $flags -xassembler-with-cpp -c $file -o $outS
560
          ;;
561
        *)   echo "Unhandled extension: $file">&2; exit 1 ;;
562
      esac
563
 
564
      echo $libgcc_s_so: $outS
565
      if [ "$SHLIB_MKMAP" ]; then
566
        echo libgcc/${dir}/libgcc.map: $outS
567
      fi
568
    done
569
 
570
    # If nothing went into libgcc_eh.a, create a dummy object -
571
    # some linkers don't like totally empty archives.
572
    if [ -z "$LIB2ADDEHSTATIC" ]; then
573
      file=eh_dummy.c
574
      out="libgcc/${dir}/eh_dummy${objext}"
575
      need_eh_dummy=1
576
 
577
      echo $out: stmp-dirs $file
578
      echo "    $gcc_compile" $flags '$(vis_hide)' -fexceptions -c $file -o $out
579
      echo $libgcc_eh_a: $out
580
    fi
581
 
582
 
583
  else # no libgcc_eh.a
584
    for file in $LIB2ADDEH; do
585
      name=`echo $file | sed -e 's/[.][cSo]$//' -e 's/[.]asm$//'`
586
      oname=`echo $name | sed -e 's,.*/,,'`
587
      out="libgcc/${dir}/${oname}${objext}"
588
 
589
      case $file in
590
        *.c)
591
          echo $out: stmp-dirs $file $LIB2ADDEHDEP $libgcc_dep
592
          echo "        $gcc_compile" $flags '$(vis_hide)' -fexceptions -c $file -o $out
593
          ;;
594
        *.asm | *.S)
595
          echo $out: stmp-dirs $file $LIB2ADDEHDEP $libgcc_dep
596
          echo "        $gcc_compile" $flags -xassembler-with-cpp \
597
                  -c $file -o $out
598
          ;;
599
        *)   echo "Unhandled extension: $file">&2; exit 1 ;;
600
      esac
601
 
602
      echo $libgcc_a: $out
603
    done
604
  fi
605
 
606
  # We do _not_ handle assembly files in this context.
607
  if [ "$LIBUNWIND" ]; then
608
    for file in $LIBUNWIND; do
609
      case $file in
610
        *.c) ;;
611
        *)   echo "Unhandled extension: $file">&2; exit 1 ;;
612
       esac
613
 
614
      name=`echo $file | sed -e 's/[.]c$//'`
615
      oname=`echo $name | sed -e 's,.*/,,'`
616
 
617
      if [ "$libunwind_so" ]; then
618
        out="libgcc/${dir}/${oname}${objext}"
619
        outS="libgcc/${dir}/${oname}_s${objext}"
620
 
621
        echo $out: stmp-dirs $file $LIBUNWINDDEP
622
        echo "  $gcc_compile $flags -fexceptions \$(vis_hide) -c $file -o $out"
623
 
624
        echo $outS: stmp-dirs $file $LIBUNWINDDEP
625
        echo "  $gcc_s_compile $flags -fexceptions -c $file -o $outS"
626
 
627
        echo $libunwind_a: $out
628
        echo $libunwind_so: $outS
629
      else
630
        out="libgcc/${dir}/${oname}${objext}"
631
        echo $out: stmp-dirs $file $LIBUNWINDDEP
632
        echo "  $gcc_compile $flags -fexceptions \$(vis_hide) -c $file -o $out"
633
        echo $libunwind_a: $out
634
      fi
635
    done
636
  fi
637
 
638
  #
639
  # build libgcov components
640
  #
641
  for name in $LIBGCOV; do
642
    dir=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
643
    flags=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`;
644
    out="libgcc/${dir}/${name}${objext}"
645
 
646
    echo $out: $libgcov_c_dep
647
    echo "      $gcc_compile $flags -DL$name -c \$(srcdir)/libgcov.c -o $out"
648
    echo $libgcov_a: $out
649
  done
650
 
651
  # EXTRA_MULTILIB_PARTS.
652
  if [ -n "$EXTRA_MULTILIB_PARTS" ]; then
653
    # Each of the EXTRA_MULTILIB_PARTS is built by recursive invocation
654
    # of the parent Makefile.  We must do this just once for each
655
    # multilib, passing it all the EXTRA_MULTILIB_PARTS as
656
    # simultaneous goal targets, so that rules which cannot execute
657
    # simultaneously are properly serialized.
658
 
659
    extra=
660
    echo
661
    for f in $EXTRA_MULTILIB_PARTS; do
662
      case $dir in
663
      .) out=$f ; t= ;;
664
      *) out=$dir/$f ; t=$dir/ ;;
665
      esac
666
      case $out in
667
      # Prevent `make' from interpreting $out as a macro assignment
668
      *'$(EQ)'*) targ="T_TARGET=$out T_TARGET" ;;
669
      *) targ=$out ;;
670
      esac
671
      extra="$extra $targ"
672
    done
673
 
674
    if [ "$dir" = . ]; then
675
      suffix=
676
    else
677
      suffix=`echo $dir | sed s,/,_,g`
678
    fi
679
    echo extra$suffix: stmp-dirs
680
    echo "      $make_compile" \\
681
    echo '        LIBGCC2_CFLAGS="$(LIBGCC2_CFLAGS)' $flags '" ' \\
682
    echo '        MULTILIB_CFLAGS="'$flags'"' T=$t $extra
683
    echo "all: extra$suffix"
684
 
685
    # Make libunwind.so and libgcc_s.so depend on these, since they
686
    # are likely to be implicitly used by the link process.
687
    if [ "$libgcc_s_so" ]; then
688
      echo "$libgcc_s_so: extra$suffix"
689
    fi
690
    if [ "$libunwind_so" ]; then
691
      echo "$libunwind_so: extra$suffix"
692
    fi
693
  fi
694
 
695
  # Library build rules.
696
  dir=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
697
  flags=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`;
698
 
699
  # Map-file generation.
700
  if [ "$SHLIB_LINK" -a "$SHLIB_MKMAP" ]; then
701
    mapfile="libgcc/${dir}/libgcc.map"
702
    tmpmapfile="libgcc/${dir}/tmp-libgcc.map"
703
    # This uses a here document instead of echos because some shells
704
    # will convert the \1 in the second sed command to a control-A.
705
    # The behavior of here documents is more predictable.
706
    cat <
707
 
708
${mapfile}: $SHLIB_MKMAP $SHLIB_MAPFILES
709
        { \$(NM_FOR_TARGET) $SHLIB_NM_FLAGS \$(objects); echo %%; \\
710
          cat $SHLIB_MAPFILES \\
711
            | sed -e '/^[   ]*#/d' \\
712
                  -e 's/^%\(if\|else\|elif\|endif\|define\)/#\1/' \\
713
            | $gcc_compile $flags -E -xassembler-with-cpp -; \\
714
        } | \$(AWK) -f $SHLIB_MKMAP $SHLIB_MKMAP_OPTS > ${tmpmapfile}
715
        mv '$tmpmapfile' \$@
716
$libgcc_s_so: ${mapfile}
717
EOF
718
  fi
719
 
720
  # Static libraries.
721
 
722
  # Each of these .a files depends on stmp-dirs.  It would seem that
723
  # this dependency is redundant, since each of the object files
724
  # itself depends on stmp-dirs.  However, it is possible that there
725
  # are in fact no object files.  In that case, the stmp-dirs
726
  # dependency is required; the directory containing the archive must
727
  # exist before the archive itself can be created.
728
  echo ""
729
  echo "$libgcc_a: stmp-dirs"
730
  echo "        -rm -f $libgcc_a"
731
  echo '        $(AR_CREATE_FOR_TARGET)' $libgcc_a '$(objects)'
732
  echo '        $(RANLIB_FOR_TARGET)' $libgcc_a
733
  echo "all: $libgcc_a"
734
 
735
  echo ""
736
  echo "$libgcov_a: stmp-dirs"
737
  echo "        -rm -f $libgcov_a"
738
  echo '        $(AR_CREATE_FOR_TARGET)' $libgcov_a '$(objects)'
739
  echo '        $(RANLIB_FOR_TARGET)' $libgcov_a
740
  echo "all: $libgcov_a"
741
 
742
  # These libraries are not always built.
743
  if [ "$libunwind_a" ]; then
744
    echo ""
745
    echo "$libunwind_a: stmp-dirs"
746
    echo "      -rm -f $libunwind_a"
747
    echo '      $(AR_CREATE_FOR_TARGET)' $libunwind_a '$(objects)'
748
    echo '      $(RANLIB_FOR_TARGET)' $libunwind_a
749
    echo "all: $libunwind_a"
750
  fi
751
 
752
  if [ "$libgcc_eh_a" ]; then
753
    echo ""
754
    echo "${dir}/libgcc_eh.a: stmp-dirs"
755
    echo "      -rm -f ${dir}/libgcc_eh.a"
756
    echo '      $(AR_CREATE_FOR_TARGET)' ${dir}/libgcc_eh.a '$(objects)'
757
    echo '      $(RANLIB_FOR_TARGET)' ${dir}/libgcc_eh.a
758
    echo "all: $libgcc_eh_a"
759
  fi
760
 
761
  # Shared libraries.
762
  if [ "$libgcc_s_so" ]; then
763
    echo ""
764
    echo "$libgcc_s_so: stmp-dirs $libunwind_so"
765
    echo "      $SHLIB_LINK" \
766
         | sed -e "s%@multilib_flags@%$flags%g" \
767
               -e "s%@multilib_dir@%$dir%g" \
768
               -e "s%@shlib_objs@%\$(objects)%g" \
769
               -e "s%@shlib_base_name@%libgcc_s%g" \
770
               -e "s%@shlib_map_file@%$mapfile%g" \
771
               -e "s%@shlib_slibdir_qual@%$shlib_dir_qual%g"
772
    echo "all: $libgcc_s_so"
773
  fi
774
 
775
  if [ "$libunwind_so" ]; then
776
    echo ""
777
    echo "$libunwind_so: stmp-dirs"
778
    echo "      $SHLIBUNWIND_LINK" \
779
           | sed -e "s%@multilib_flags@%$flags%g" \
780
                 -e "s%@multilib_dir@%$dir%g" \
781
                 -e "s%@shlib_objs@%\$(objects)%g" \
782
                 -e "s%@shlib_base_name@%libunwind%g" \
783
                 -e "s%@shlib_slibdir_qual@%$shlib_dir_qual%g"
784
    echo "all: $libunwind_so"
785
  fi
786
 
787
done # ml in MULTILIBS
788
 
789
echo
790
echo "libgcc-stage-start:"
791
echo "  for dir in \$(dirs); do \\"
792
echo "    if [ -d \$(stage)/\$\$dir ]; then :; \\"
793
echo "    else $mkinstalldirs \$(stage)/\$\$dir; fi; \\"
794
echo "  done"
795
echo "  -for dir in \$(dirs); do \\"
796
echo "    mv \$\$dir/*${objext} \$(stage)/\$\$dir; \\"
797
echo "    mv \$\$dir/*.vis \$(stage)/\$\$dir; \\"
798
echo "    mv \$\$dir/*.map \$(stage)/\$\$dir; \\"
799
echo "    test ! -f \$\$dir/libgcc.a || mv \$\$dir/lib* \$(stage)/\$\$dir; \\"
800
echo "  done"
801
 
802
echo
803
echo "stmp-dirs:"
804
echo "  for d in \$(dirs); do \\"
805
echo "    if [ -d \$\$d ]; then true; else $mkinstalldirs \$\$d; fi; \\"
806
echo "  done"
807
echo "  if [ -f stmp-dirs ]; then true; else touch stmp-dirs; fi"
808
 
809
if [ "$need_eh_dummy" ]; then
810
  echo "eh_dummy.c:"
811
  echo "        echo 'int __libgcc_eh_dummy;' > \$@"
812
fi
813
 
814
echo ""
815
echo "install: all"
816
for ml in $MULTILIBS; do
817
  dir=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
818
  flags=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`;
819
  if [ $dir != . ]; then
820
    ldir='$(DESTDIR)$(libsubdir)'/$dir
821
    echo "      if [ -d $ldir ]; then true; else $mkinstalldirs $ldir; chmod a+rx $ldir; fi;"
822
  else
823
    ldir='$(DESTDIR)$(libsubdir)'
824
  fi
825
  echo '        $(INSTALL_DATA)' ${dir}/libgcc.a ${ldir}/
826
  echo '        $(RANLIB_FOR_TARGET)' ${ldir}/libgcc.a
827
  echo '        $(INSTALL_DATA)' ${dir}/libgcov.a ${ldir}/
828
  echo '        $(RANLIB_FOR_TARGET)' ${ldir}/libgcov.a
829
 
830
  if [ "$SHLIB_LINK" ]; then
831
    echo '      $(INSTALL_DATA)' ${dir}/libgcc_eh.a ${ldir}/
832
    echo '      $(RANLIB_FOR_TARGET)' ${ldir}/libgcc_eh.a
833
 
834
    shlib_slibdir_qual=
835
    os_multilib_dir=`$GCC_FOR_TARGET $flags --print-multi-os-directory`
836
    if [ "$os_multilib_dir" != . ]; then
837
      shlib_slibdir_qual="/$os_multilib_dir"
838
    fi
839
    echo "      $SHLIB_INSTALL" \
840
      | sed -e "s%@multilib_dir@%$dir%g" \
841
            -e "s%@shlib_base_name@%libgcc_s%g" \
842
            -e "s%@shlib_slibdir_qual@%$shlib_slibdir_qual%g"
843
    if [ "$LIBUNWIND" ]; then
844
      echo "    $SHLIBUNWIND_INSTALL" \
845
        | sed -e "s%@multilib_dir@%$dir%g" \
846
              -e "s%@shlib_base_name@%libunwind%g" \
847
              -e "s%@shlib_slibdir_qual@%$shlib_slibdir_qual%g"
848
      libunwinddir='$(DESTDIR)$(slibdir)$(shlib_slibdir_qual)/$(shlib_dir)'
849
      echo '    $(INSTALL_DATA)' ${dir}/libunwind.a ${libunwinddir}/
850
      echo '    $(RANLIB_FOR_TARGET)' ${libunwinddir}/libunwind.a
851
    fi
852
  fi
853
done
854
for f in $EXTRA_MULTILIB_PARTS; do
855
  for ml in $MULTILIBS; do
856
    dir=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
857
    if [ $dir != . ]; then
858
      out=${dir}/$f
859
      ldir='$(DESTDIR)$(libsubdir)'/$dir
860
    else
861
      out=$f
862
      ldir='$(DESTDIR)$(libsubdir)'
863
    fi
864
    echo '      $(INSTALL_DATA)' $out $ldir/
865
  done
866
done
867
 
868
echo '.PHONY: all install'

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.