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
)
18 CFLAGS-libc
:=# intentionally left blank
19 LDFLAGS-
$(UCLIBC_FORMAT_DSBT_ELF
)-libc.so
:= -Wl
,--dsbt-index
=2
20 LDFLAGS-libc.so
:= $(LDFLAGS
) $(VERSION_SCRIPT
) -Wl
,-init
,$(SYMBOL_PREFIX
)__uClibc_init
21 LIBS-libc.so
:= $(interp
) $(ldso
) $(top_builddir
)lib
/$(NONSHARED_LIBNAME
) $(top_builddir
)lib
/$(NONSHARED_LIBPTHREAD
)
23 # we have SHARED_LIBNAME=libc.so.$(ABI_VERSION) defined in Rules.mak
24 libc_FULL_NAME
:= libuClibc-
$(VERSION
).so
26 # this comes first, so duplicate removal works correctly
27 include $(libc_DIR
)/sysdeps
/Makefile.in
29 include $(libc_DIR
)/misc
/Makefile.in
30 include $(libc_DIR
)/pwd_grp
/Makefile.in
31 include $(libc_DIR
)/stdio
/Makefile.in
32 include $(libc_DIR
)/string
/Makefile.in
33 include $(libc_DIR
)/termios
/Makefile.in
34 include $(libc_DIR
)/inet
/Makefile.in
35 include $(libc_DIR
)/signal
/Makefile.in
36 include $(libc_DIR
)/stdlib
/Makefile.in
37 include $(libc_DIR
)/unistd
/Makefile.in
40 libc-a-y
= $(libc-y
:.o
=.os
) $(libc-static-y
:.o
=.os
)
42 libc-a-y
= $(libc-y
) $(libc-static-y
)
45 libc-a-y
+= $(libnsl-a-y
)
46 libc-a-y
+= $(libresolv-a-y
)
47 libc-a-
$(HAVE_SHARED
) += $(libdl-a-y
)
48 libc-a-y
+= $(libm-a-y
)
49 libc-a-
$(UCLIBC_HAS_LIBUTIL
) += $(libutil-a-y
)
50 libc-a-
$(UCLIBC_HAS_CRYPT
) += $(libcrypt-a-y
)
51 libc-a-
$(UCLIBC_HAS_ARGP
) += $(libuargp-a-y
)
52 libc-a-
$(UCLIBC_HAS_THREADS
) += $(libpthread-a-y
)
53 libc-a-
$(UCLIBC_HAS_REALTIME
) += $(librt-a-y
)
54 libc-a-
$(UCLIBC_HAS_GETTEXT_AWARENESS
) += $(libintl-a-y
)
55 libc-a-
$(UCLIBC_HAS_BACKTRACE
) += $(libubacktrace-a-y
)
57 libc-so-y
= $(libc-y
:.o
=.os
) $(libc-shared-y
)
59 libc-so-y
+= $(libnsl-so-y
)
60 libc-so-y
+= $(libresolv-so-y
)
61 libc-so-y
+= $(libdl-so-y
)
62 libc-so-y
+= $(libm-so-y
)
63 libc-so-
$(UCLIBC_HAS_LIBUTIL
) += $(libutil-so-y
)
64 libc-so-
$(UCLIBC_HAS_CRYPT
) += $(libcrypt-so-y
)
65 libc-so-
$(UCLIBC_HAS_ARGP
) += $(libuargp-so-y
)
66 libc-so-
$(UCLIBC_HAS_THREADS
) += $(libpthread-so-y
)
67 libc-so-
$(UCLIBC_HAS_REALTIME
) += $(librt-so-y
)
68 libc-so-
$(UCLIBC_HAS_GETTEXT_AWARENESS
) += $(libintl-so-y
)
69 libc-so-
$(UCLIBC_HAS_BACKTRACE
) += $(libubacktrace-so-y
)
71 lib-a-y
+= $(top_builddir
)lib
/libc.a
72 lib-gdb-y
+= $(top_builddir
)lib
/libc.gdb
73 lib-so-y
+= $(libc.depend
)
74 objclean-y
+= CLEAN_libc
76 OUTPUT_FORMAT
= $(CC
) $(CFLAGS
) -Wl
,--verbose
2>&1 |
$(SED
) -n
'/OUTPUT_FORMAT/,/)/p'
78 $(libc.depend
): $(libc_OUT
)/libc_so.a
$(LIBS-libc.so
)
79 $(call link.so
,$(libc_FULL_NAME
),$(ABI_VERSION
))
80 # link for backward compatibility
81 $(call link.so
,$(libc_FULL_NAME
),0)
83 $(Q
)cat
$(top_srcdir
)extra
/scripts
/format.lds
> $@.tmp
84 $(Q
)$(OUTPUT_FORMAT
) >> $@.tmp
85 ifeq ($(COMPAT_ATEXIT
),y
)
86 $(Q
)echo
"GROUP ( $(NONSHARED_LIBNAME) $(NONSHARED_LIBPTHREAD) $(SHARED_LIBNAME) $(ASNEEDED) )" >> $@.tmp
88 $(Q
)echo
"GROUP ( $(SHARED_LIBNAME) $(NONSHARED_LIBNAME) $(NONSHARED_LIBPTHREAD) $(ASNEEDED) )" >> $@.tmp
92 $(libc_OUT
)/libc_so.a
: $(libc-so-y
) |
$(top_builddir
)lib
/libc.a
$(top_builddir
)lib
/$(NONSHARED_LIBNAME
)
95 $(Q
)$(STRIPTOOL
) $(STRIP_FLAGS
) $(libc-shared-y
)
101 $(libc_OUT
)/libc.oS
: $(libc-multi-y
) |
$(top_builddir
)lib
/libc.a
$(top_builddir
)lib
/$(NONSHARED_LIBNAME
)
105 $(top_builddir
)lib
/libc.a
: $(libc-a-y
)
109 # We use libc_so.a so that we can compile the shared library with special
110 # flags - i.e. -mleaf-id-shared-library. The static libc.a needs to be
111 # compiled without it.
112 $(top_builddir
)lib
/libc.gdb
: $(libc_OUT
)/libc_so.a
$(LINK_FLAT_CRTS
)
113 $(call link-flat.so
,$(@
:.gdb
=),$(UCLIBC_SHARED_FLAT_ID
))
116 $(do_rm
) $(addprefix $(libc_OUT
)/*.
, o os oS a
)