nptl/errno: Use a separate __errno_location for libpthread.
[uclibc-ng.git] / libc / Makefile.in
blobdd666ac7c095c6e559f353f239d9349269e32078
1 # Makefile for uClibc
3 # Copyright (C) 2000-2008 Erik Andersen <andersen@uclibc.org>
5 # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
8 libc_DIR := $(top_srcdir)libc
9 libc_OUT := $(top_builddir)libc
11 # Check if the target architecture has a version script for
12 # libc, and if so, include it when linking.
13 VERSION_SCRIPT := $(wildcard $(libc_DIR)/sysdeps/linux/$(TARGET_ARCH)/libc.map)
14 ifneq ($(VERSION_SCRIPT),)
15 VERSION_SCRIPT := -Wl,--version-script,$(VERSION_SCRIPT)
16 endif
18 LDFLAGS-libc.so := $(LDFLAGS) $(VERSION_SCRIPT) -Wl,-init,$(SYMBOL_PREFIX)__uClibc_init
19 ifeq ($(UCLIBC_HAS_STDIO_FUTEXES),y)
20 CFLAGS += -D__USE_STDIO_FUTEXES__
21 endif
22 LIBS-libc.so := $(interp) $(ldso) $(top_builddir)lib/$(NONSHARED_LIBNAME)
24 # we have SHARED_LIBNAME=libc.so.$(ABI_VERSION) defined in Rules.mak
25 libc_FULL_NAME := libuClibc-$(VERSION).so
27 # this comes first, so duplicate removal works correctly
28 include $(libc_DIR)/sysdeps/Makefile.in
30 include $(libc_DIR)/misc/Makefile.in
31 include $(libc_DIR)/pwd_grp/Makefile.in
32 include $(libc_DIR)/stdio/Makefile.in
33 include $(libc_DIR)/string/Makefile.in
34 include $(libc_DIR)/termios/Makefile.in
35 include $(libc_DIR)/inet/Makefile.in
36 include $(libc_DIR)/signal/Makefile.in
37 include $(libc_DIR)/stdlib/Makefile.in
38 include $(libc_DIR)/unistd/Makefile.in
40 ifeq ($(DOPIC),y)
41 libc-a-y = $(libc-y:.o=.os) $(libc-static-y:.o=.os)
42 else
43 libc-a-y = $(libc-y) $(libc-static-y)
44 endif
46 ifeq ($(DOMULTI),n)
47 libc-so-y = $(libc-y:.o=.os) $(libc-shared-y)
48 else
49 all_sources = $(libc-y:.o=.c)
50 all_sources += $(libc-shared-y:.oS=.c)
51 libc-multi-y = $(filter-out $(libc-nomulti-y:.o=.c),$(all_sources))
52 endif
54 lib-a-y += $(top_builddir)lib/libc.a
55 lib-gdb-y += $(top_builddir)lib/libc.gdb
56 lib-so-y += $(libc.depend)
57 objclean-y += CLEAN_libc
59 OUTPUT_FORMAT = $(CC) $(CFLAGS) -Wl,--verbose 2>&1 | $(SED) -n '/OUTPUT_FORMAT/,/)/p'
61 ifeq ($(DOMULTI),n)
62 $(libc.depend): $(libc_OUT)/libc_so.a $(LIBS-libc.so)
63 $(call link.so,$(libc_FULL_NAME),$(ABI_VERSION))
64 else
65 $(libc.depend): $(libc_OUT)/libc.oS $(libc-nomulti-y:.o=.oS) | $(LIBS-libc.so)
66 $(call linkm.so,$(libc_FULL_NAME),$(ABI_VERSION))
67 endif
68 $(Q)$(RM) $@
69 $(Q)cat $(top_srcdir)extra/scripts/format.lds > $@.tmp
70 $(Q)$(OUTPUT_FORMAT) >> $@.tmp
71 ifeq ($(COMPAT_ATEXIT),y)
72 $(Q)echo "GROUP ( $(NONSHARED_LIBNAME) $(SHARED_LIBNAME) $(ASNEEDED) )" >> $@.tmp
73 else
74 $(Q)echo "GROUP ( $(SHARED_LIBNAME) $(NONSHARED_LIBNAME) $(ASNEEDED) )" >> $@.tmp
75 endif
76 $(Q)mv $@.tmp $@
78 $(libc_OUT)/libc_so.a: $(libc-so-y) | $(top_builddir)lib/libc.a $(top_builddir)lib/$(NONSHARED_LIBNAME)
79 $(Q)$(RM) $@
80 ifeq ($(DOPIC),y)
81 $(Q)$(STRIPTOOL) $(STRIP_FLAGS) $(libc-shared-y)
82 else
83 $(do_strip)
84 endif
85 $(do_ar)
87 $(libc_OUT)/libc.oS: $(libc-multi-y) | $(top_builddir)lib/libc.a $(top_builddir)lib/$(NONSHARED_LIBNAME)
88 $(Q)$(RM) $@
89 $(compile-m)
91 $(top_builddir)lib/libc.a: $(libc-a-y) | $(crt-y)
92 $(Q)$(INSTALL) -d $(dir $@)
93 $(Q)$(RM) $@
94 $(do_ar)
96 # We use libc_so.a so that we can compile the shared library with special
97 # flags - i.e. -mleaf-id-shared-library. The static libc.a needs to be
98 # compiled without it.
99 $(top_builddir)lib/libc.gdb: $(libc_OUT)/libc_so.a $(LINK_FLAT_CRTS)
100 $(call link-flat.so,$(@:.gdb=),$(UCLIBC_SHARED_FLAT_ID))
102 CLEAN_libc:
103 $(do_rm) $(addprefix $(libc_OUT)/*., o os oS a)