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 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__
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
41 libc-a-y
= $(libc-y
:.o
=.os
) $(libc-static-y
:.o
=.os
)
43 libc-a-y
= $(libc-y
) $(libc-static-y
)
47 libc-so-y
= $(libc-y
:.o
=.os
) $(libc-shared-y
)
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
))
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'
62 $(libc.depend
): $(libc_OUT
)/libc_so.a
$(LIBS-libc.so
)
63 $(call link.so
,$(libc_FULL_NAME
),$(ABI_VERSION
))
65 $(libc.depend
): $(libc_OUT
)/libc.oS
$(libc-nomulti-y
:.o
=.oS
) |
$(LIBS-libc.so
)
66 $(call linkm.so
,$(libc_FULL_NAME
),$(ABI_VERSION
))
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
74 $(Q
)echo
"GROUP ( $(SHARED_LIBNAME) $(NONSHARED_LIBNAME) $(ASNEEDED) )" >> $@.tmp
78 $(libc_OUT
)/libc_so.a
: $(libc-so-y
) |
$(top_builddir
)lib
/libc.a
$(top_builddir
)lib
/$(NONSHARED_LIBNAME
)
81 $(Q
)$(STRIPTOOL
) $(STRIP_FLAGS
) $(libc-shared-y
)
87 $(libc_OUT
)/libc.oS
: $(libc-multi-y
) |
$(top_builddir
)lib
/libc.a
$(top_builddir
)lib
/$(NONSHARED_LIBNAME
)
91 $(top_builddir
)lib
/libc.a
: $(libc-a-y
) |
$(crt-y
)
92 $(Q
)$(INSTALL
) -d
$(dir $@
)
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
))
103 $(do_rm
) $(addprefix $(libc_OUT
)/*.
, o os oS a
)