2 # Makefile to call either uclibc or glibc optimizer
4 # Copyright (C) 2004 Broadcom Corporation
7 # Platform dependencies, use different utility to optimize glibc and uclibc
8 ifneq ($(strip $(BRCM_UCLIBC)),)
14 ifneq ($(strip $(BRCM_APP_PHONE)),)
20 ifeq ($(PLATFORM),glibc)
24 ifeq ($(PLATFORM),uclibc)
26 LINKER := ld-uClibc.so.0
29 LINKER := ld-linux.so.2
33 # $(LIBC) and $(LINKER) is copied directly from toolchain installation, if no optimization
34 # $(LIBC) and $(LINKER) is copied from $(PLATFORM) after optimization, if we need optimization
35 # mklibs.py can optimize all the libraries, not just libc
36 # mklibs.py automatically finds all the necessary libraries, so the extralibs.mak applies to
37 # glibc or no optimization, which we have to manually specify
41 TARGETS := $(LIBDIR)/$(LIBC) $(LIBDIR)/$(LINKER)
43 ifneq ($(strip $(BUILD_GDBSERVER)),)
44 TARGETS += $(LIBDIR)/libthread_db.so.1
47 # Additional libraries to install
54 # Optimize libraries from archives
55 # if glibc, $(LIBC) is generated in $(PLATFORM) directory by generate_library
56 # if uclic, $(LIBC) is generated in $(PLATFORM) directory by mklibs.py
58 ifeq ($(PLATFORM),glibc)
59 TARGETS := $(PLATFORM)/$(LIBC) $(PLATFORM)/$(LINKER)
61 ifeq ($(PLATFORM),uclibc)
62 TARGETS := $(PLATFORM)/lib* $(PLATFORM)/$(LINKER)
65 BINARIES := `find $(INSTALL_DIR) -path $(INSTALL_DIR)/lib -prune -o -type f -print | file -f - | grep ELF | cut -d':' -f1`
68 @echo Optimizing C run-time library...
69 @if [ "$(PLATFORM)" = "glibc" ]; then \
70 @cp -f $(LIBDIR)/$(LINKER) $(PLATFORM); \
71 $(SHELL) -e generate_library $(PLATFORM) $(BINARIES); \
73 @if [ "$(PLATFORM)" = "uclibc" ]; then \
74 python ./mklibs.py -D -L $(LIBDIR) -L $(INSTALL_DIR)/lib --target=$(CROSS_COMPILE) -d $(PLATFORM) $(BINARIES); \
77 # Additional libraries to install
78 ifeq ($(PLATFORM),glibc)
84 # run-time start-ups, not needed any more.
85 #ifeq ($(PLATFORM),glibc)
86 # TARGETS += $(LIBDIR)/crt1.o
88 # ifeq ($(PLATFORM),uclibc)
89 # TARGETS += $(LIBDIR)/crt0.o
93 #TARGETS += $(LIBDIR)/crti.o
94 #TARGETS += $(LIBDIR)/crtn.o
99 install $(TARGETS) $(INSTALL_DIR)/lib
100 @cp -f $(LIBDIR)/libdl.so $(INSTALL_DIR)/lib/libdl.so.0
103 @if [ "$(INSTALL_DIR)" != "" -a "$(INSTALL_DIR)" != "/" ]; then rm -f $(INSTALL_DIR)/lib/*; fi
104 @if [ "$(PLATFORM)" = "glibc" ]; then rm -f $(PLATFORM)/$(LIBC) $(PLATFORM)/$(LINKER); fi
105 @if [ "$(PLATFORM)" = "uclibc" ]; then rm -f $(PLATFORM)/*.0; fi