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 TARGETS += $(LIBDIR)/libresolv.so.0
45 ifneq ($(strip $(BUILD_GDBSERVER)),)
46 TARGETS += $(LIBDIR)/libthread_db.so.1
49 # Additional libraries to install
56 # Optimize libraries from archives
57 # if glibc, $(LIBC) is generated in $(PLATFORM) directory by generate_library
58 # if uclic, $(LIBC) is generated in $(PLATFORM) directory by mklibs.py
60 ifeq ($(PLATFORM),glibc)
61 TARGETS := $(PLATFORM)/$(LIBC) $(PLATFORM)/$(LINKER)
63 ifeq ($(PLATFORM),uclibc)
64 TARGETS := $(PLATFORM)/lib* $(PLATFORM)/$(LINKER)
67 BINARIES := `find $(INSTALL_DIR) -path $(INSTALL_DIR)/lib -prune -o -type f -print | file -f - | grep ELF | cut -d':' -f1`
70 @echo Optimizing C run-time library...
71 @if [ "$(PLATFORM)" = "glibc" ]; then \
72 @cp -f $(LIBDIR)/$(LINKER) $(PLATFORM); \
73 $(SHELL) -e generate_library $(PLATFORM) $(BINARIES); \
75 @if [ "$(PLATFORM)" = "uclibc" ]; then \
76 python ./mklibs.py -D -L $(LIBDIR) -L $(INSTALL_DIR)/lib --target=$(CROSS_COMPILE) -d $(PLATFORM) $(BINARIES); \
79 # Additional libraries to install
80 ifeq ($(PLATFORM),glibc)
86 # run-time start-ups, not needed any more.
87 #ifeq ($(PLATFORM),glibc)
88 # TARGETS += $(LIBDIR)/crt1.o
90 # ifeq ($(PLATFORM),uclibc)
91 # TARGETS += $(LIBDIR)/crt0.o
95 #TARGETS += $(LIBDIR)/crti.o
96 #TARGETS += $(LIBDIR)/crtn.o
101 install $(TARGETS) $(INSTALL_DIR)/lib
102 @cp -f $(LIBDIR)/libdl.so $(INSTALL_DIR)/lib/libdl.so.0
105 @if [ "$(INSTALL_DIR)" != "" -a "$(INSTALL_DIR)" != "/" ]; then rm -f $(INSTALL_DIR)/lib/*; fi
106 @if [ "$(PLATFORM)" = "glibc" ]; then rm -f $(PLATFORM)/$(LIBC) $(PLATFORM)/$(LINKER); fi
107 @if [ "$(PLATFORM)" = "uclibc" ]; then rm -f $(PLATFORM)/*; fi