]> sourceware.org Git - glibc.git/blob - csu/Makefile
initial import
[glibc.git] / csu / Makefile
1 # Makefile for csu code for GNU C library.
2
3 # Copyright (C) 1995 Free Software Foundation, Inc.
4 # This file is part of the GNU C Library.
5
6 # The GNU C Library is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU Library General Public License
8 # as published by the Free Software Foundation; either version 2 of
9 # the License, or (at your option) any later version.
10
11 # The GNU C Library is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 # Library General Public License for more details.
15
16 # You should have received a copy of the GNU Library General Public
17 # License along with the GNU C Library; see the file COPYING.LIB. If
18 # not, write to the Free Software Foundation, Inc., 675 Mass Ave,
19 # Cambridge, MA 02139, USA.
20
21 # This directory contains the C startup code (that which calls main). This
22 # consists of the startfile, built from start.c and installed as crt0.o
23 # (traditionally) or crt1.o (for ELF); and some initialization code which
24 # is in the C library itself. In ELF we also install crti.o and crtn.o,
25 # special "initializer" and "finalizer" files in used in the link to make
26 # the .init and .fini sections work right; both these files are built (in
27 # an arcane manner) from initfini.c.
28
29 subdir := csu
30
31 csu-dummies = $(filter-out $(start-installed-name),crt1.o Mcrt1.o)
32 extra-objs = start.o $(start-installed-name) $(csu-dummies)
33 omit-deps = $(patsubst %.o,%,$(start-installed-name) $(csu-dummies))
34 install-lib = $(start-installed-name) $(csu-dummies)
35 distribute = initfini.c
36
37 all: # Make this the default target; it will be defined in Rules.
38
39 include ../Makeconfig
40
41 ifneq ($(elf),yes)
42 # When not using ELF, there is just one startfile, called crt0.o.
43 start-installed-name = crt0.o
44 else
45 # In the ELF universe, crt0.o is called crt1.o, and there are
46 # some additional bizarre files.
47 start-installed-name = crt1.o
48 install-lib += crti.o crtn.o
49 extra-objs += crti.o crtn.o
50 generated += crti.s crtn.s
51 omit-deps += crti crtn
52
53 # Compile initfini.c to assembly code, which contains embedded shell
54 # commands that prodice crti.s-new and crtn.s-new when run. We need to
55 # disable emission of .size directives and debugging information, since
56 # they will get confused by the splitting of the output we do.
57 $(objpfx)cr%i.s $(objpfx)cr%n.s: initfini.c
58 -rm -f $(objpfx)crtcommon.tmp
59 (echo 'cat > crtcommon.tmp <<\EOF_common'; \
60 $(CC) $< $(CPPFLAGS) $(CFLAGS) -finhibit-size-directive -g0 -S -o -; \
61 echo 'EOF_common') | (cd $(@D); $(SHELL))
62 cat $(objpfx)crtcommon.tmp >> $(objpfx)crti.s-new
63 cat $(objpfx)crtcommon.tmp >> $(objpfx)crtn.s-new
64 rm -f $(objpfx)crtcommon.tmp
65 mv -f $(objpfx)crti.s-new $(objpfx)crti.s
66 mv -f $(objpfx)crtn.s-new $(objpfx)crtn.s
67 endif
68
69
70 include ../Rules
71
72 # The startfile is installed under different names, so we just call our
73 # source file `start.c' and copy to the installed name after compiling.
74 $(objpfx)$(start-installed-name): $(objpfx)start.o
75 -rm -f $@
76 ln $< $@
77
78 # These extra files are sometimes expected by system standard linking
79 # procedures, but we have nothing for them to do. So compile empty files.
80 $(addprefix $(objpfx),$(filter-out $(start-installed-name),$(csu-dummies))):
81 cp /dev/null $(@:.o=.c)
82 $(COMPILE.c) $(@:.o=.c) $(OUTPUT_OPTION)
83 rm -f $(@:.o=.c)
84
This page took 0.042663 seconds and 6 git commands to generate.