localedata: Once again correct and regenerate i18n_ctype.
[glibc.git] / csu / Makefile
blobfd668a5d0092f7923e7aaa70883ea25fa2e99212
1 # Makefile for csu code for GNU C library.
2 # Copyright (C) 1995-2017 Free Software Foundation, Inc.
3 # This file is part of the GNU C Library.
5 # The GNU C Library is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU Lesser General Public
7 # License as published by the Free Software Foundation; either
8 # version 2.1 of the License, or (at your option) any later version.
10 # The GNU C Library 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 GNU
13 # Lesser General Public License for more details.
15 # You should have received a copy of the GNU Lesser General Public
16 # License along with the GNU C Library; if not, see
17 # <http://www.gnu.org/licenses/>.
19 # This directory contains the C startup code (that which calls main). This
20 # consists of the startfile, built from start.c and installed as crt0.o
21 # (traditionally) or crt1.o (for ELF). In ELF we also install crti.o and
22 # crtn.o, special "initializer" and "finalizer" files used in the link
23 # to make the .init and .fini sections work right.
25 subdir := csu
27 include ../Makeconfig
29 routines = init-first libc-start $(libc-init) sysdep version check_fds \
30 libc-tls elf-init dso_handle
31 aux = errno
32 elide-routines.os = libc-tls
33 static-only-routines = elf-init
34 csu-dummies = $(filter-out $(start-installed-name),crt1.o Mcrt1.o)
35 extra-objs = start.o \
36 $(start-installed-name) g$(start-installed-name) $(csu-dummies) \
37 S$(start-installed-name)
38 omit-deps = $(patsubst %.o,%,$(start-installed-name) g$(start-installed-name) \
39 b$(start-installed-name) $(csu-dummies) \
40 S$(start-installed-name))
41 install-lib = $(start-installed-name) g$(start-installed-name) $(csu-dummies)
43 # No tests are allowed in the csu/ subdirectory because the startup
44 # code is compiled with special flags.
45 tests =
47 CFLAGS-.o += $(no-stack-protector)
48 CFLAGS-.op += $(no-stack-protector)
49 CFLAGS-.os += $(no-stack-protector)
51 ifeq (yes,$(build-shared))
52 extra-objs += S$(start-installed-name) gmon-start.os
53 ifneq ($(start-installed-name),$(static-start-installed-name))
54 extra-objs += gmon-start.o
55 endif
56 install-lib += S$(start-installed-name)
57 generated += start.os
58 else
59 extra-objs += gmon-start.o
60 endif
62 ifneq ($(start-installed-name),$(static-start-installed-name))
63 extra-objs += $(static-start-installed-name) g$(static-start-installed-name)
64 omit-deps += $(patsubst %.o,%,$(static-start-installed-name) \
65 g$(static-start-installed-name))
66 install-lib += $(static-start-installed-name) g$(static-start-installed-name)
67 endif
69 before-compile += $(objpfx)abi-tag.h
70 generated += abi-tag.h
72 # These are the special initializer/finalizer files. They are always the
73 # first and last file in the link. crti.o ... crtn.o define the global
74 # "functions" _init and _fini to run the .init and .fini sections.
75 crtstuff = crti crtn
77 install-lib += $(crtstuff:=.o)
78 extra-objs += $(crtstuff:=.o)
80 extra-objs += abi-note.o init.o
81 asm-CPPFLAGS += -I$(objpfx).
83 # Enable unwinding so backtrace unwinds to __libc_start_main
84 CFLAGS-libc-start.c += -funwind-tables
86 include ../Rules
88 # Make these in the lib pass so they're available in time to link things with.
89 subdir_lib: $(extra-objs:%=$(objpfx)%)
91 define link-relocatable
92 $(CC) -nostdlib -nostartfiles -r -o $@ $^
93 endef
95 ifndef start-installed-name-rule
96 # We link the ELF startfile along with a SHT_NOTE section indicating
97 # the kernel ABI the binaries linked with this library will require.
98 $(objpfx)$(start-installed-name): $(objpfx)start.o $(objpfx)abi-note.o \
99 $(objpfx)init.o
100 $(link-relocatable)
101 $(objpfx)S$(start-installed-name): $(objpfx)start.os $(objpfx)abi-note.o \
102 $(objpfx)init.o
103 $(link-relocatable)
104 endif
106 # The profiling startfile is made by linking together the normal
107 # startfile with gmon-start.o, which defines a constructor function
108 # to turn on profiling code at startup.
109 ifeq (yes,$(build-shared))
110 $(objpfx)g$(start-installed-name): \
111 $(objpfx)g%: $(objpfx)S% $(objpfx)gmon-start.os
112 $(link-relocatable)
113 ifneq ($(start-installed-name),$(static-start-installed-name))
114 $(objpfx)g$(static-start-installed-name): \
115 $(objpfx)g%: $(objpfx)% $(objpfx)gmon-start.o
116 $(link-relocatable)
117 endif
118 else
119 $(addprefix $(objpfx),$(sort g$(start-installed-name) \
120 g$(static-start-installed-name))): \
121 $(objpfx)g%: $(objpfx)% $(objpfx)gmon-start.o
122 $(link-relocatable)
123 endif
125 # These extra files are sometimes expected by system standard linking
126 # procedures, but we have nothing for them to do. So compile empty files.
127 $(addprefix $(objpfx),$(filter-out $(start-installed-name), $(csu-dummies))):\
128 $(before-compile)
129 $(COMPILE.c) -o $@ -x c /dev/null
131 # These headers are used by the startup code.
132 $(objpfx)abi-tag.h: $(..)abi-tags
133 $(make-target-directory)
134 rm -f $@.new
135 sed -e 's/#.*$$//' -e '/^[ ]*$$/d' $< | \
136 while read conf tagos tagver; do \
137 test `expr '$(config-machine)-$(config-vendor)-$(config-os)' \
138 : "$$conf"` != 0 || continue; \
139 ( echo "$$tagos" | \
140 sed -e 's/[^0-9xXa-fA-F ]//' \
141 -e 's/^/#define __ABI_TAG_OS /'; \
142 echo "#ifndef __ABI_TAG_VERSION"; \
143 echo "$$tagver" | \
144 sed -e 's/[^0-9xXa-fA-F]/ /g' -e 's/ *$$//' \
145 -e 's/ /,/g' -e 's/^/# define __ABI_TAG_VERSION /'; \
146 echo "#endif" ) > $@.new; \
147 done
148 if test -r $@.new; then mv -f $@.new $@; \
149 else echo >&2 'This configuration not matched in $<'; exit 1; fi