summaryrefslogtreecommitdiff
path: root/libc/Makefile.in
blob: 50201d4fd57cef1a1f22253792fc89cd3834672e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# Makefile for uClibc
#
# Copyright (C) 2000 by Lineo, inc.
# Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
#
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#

# Check if the target architecture has a version script for
# libc, and if so, include it when linking.
VERSION_SCRIPT := $(wildcard $(libc_DIR)/sysdeps/linux/$(TARGET_ARCH)/libc.map)
ifneq ($(VERSION_SCRIPT),)
VERSION_SCRIPT := --version-script $(VERSION_SCRIPT)
endif

LDFLAGS-libc.so := $(LDFLAGS) $(VERSION_SCRIPT) -init __uClibc_init

LIBS-libc.so := $(interp) $(top_builddir)lib/$(UCLIBC_LDSO)

# we have SHARED_MAJORNAME=libc.so.$(MAJOR_VERSION) defined in Rules.mak
libc_FULL_NAME := libuClibc-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so

libc_DIR := $(top_srcdir)libc
libc_OUT := $(top_builddir)libc

# this comes first, so duplicate removal works correctly
include $(libc_DIR)/sysdeps/Makefile.in

include $(libc_DIR)/misc/Makefile.in
include $(libc_DIR)/pwd_grp/Makefile.in
include $(libc_DIR)/stdio/Makefile.in
include $(libc_DIR)/string/Makefile.in
include $(libc_DIR)/termios/Makefile.in
include $(libc_DIR)/inet/Makefile.in
include $(libc_DIR)/signal/Makefile.in
include $(libc_DIR)/stdlib/Makefile.in
include $(libc_DIR)/unistd/Makefile.in

libc-a-y += $(libc-static-y)
libc-so-y += $(libc-shared-y)

libc-nomulti-y += $(libc-shared-y)

lib-a-y += $(top_builddir)lib/libc.a crt-y
lib-so-y += libc-y $(top_builddir)lib/$(NONSHARED_LIBNAME) crt-y
objclean-y += libc_clean

$(top_builddir)lib/libc.so: $(libc_OUT)/libc_so.a pre-y
	$(call link.so,$(libc_FULL_NAME),$(MAJOR_VERSION))
	$(Q)$(RM) $@
	$(Q)echo "/* GNU ld script" > $@
	$(Q)echo " * Use the shared library, but some functions are only in" >> $@
	$(Q)echo " * the static library, so try that secondarily. */" >> $@
ifeq ($(COMPAT_ATEXIT),y)
	$(Q)echo "GROUP ( $(NONSHARED_LIBNAME) $(SHARED_MAJORNAME) $(ASNEEDED) )" >> $@
else
	$(Q)echo "GROUP ( $(SHARED_MAJORNAME) $(NONSHARED_LIBNAME) $(ASNEEDED) )" >> $@
endif

$(libc_OUT)/libc_so.a: $(libc-so-y)
	$(Q)$(RM) $@
	$(do_strip)
	$(do_ar)

ifeq ($(DOPIC),y)
$(top_builddir)lib/libc.a: $(libc-a-y:.o=.os)
else
$(top_builddir)lib/libc.a: $(libc-a-y)
endif
	$(Q)$(INSTALL) -d $(dir $@)
	$(Q)$(RM) $@
	$(do_strip)
	$(do_ar)

libc_clean:
	$(RM) $(libc_OUT)/*.{o,os,a}