Makefile 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. # Makefile for uClibc
  2. #
  3. # Copyright (C) 2000-2004 Erik Andersen <andersen@uclibc.org>
  4. #
  5. # This program is free software; you can redistribute it and/or modify it under
  6. # the terms of the GNU Library General Public License as published by the Free
  7. # Software Foundation; either version 2 of the License, or (at your option) any
  8. # later version.
  9. #
  10. # This program is distributed in the hope that it will be useful, but WITHOUT
  11. # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  12. # FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more
  13. # details.
  14. #
  15. # You should have received a copy of the GNU Library General Public License
  16. # along with this program; if not, write to the Free Software Foundation, Inc.,
  17. # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  18. TOPDIR=../../
  19. include $(TOPDIR)Rules.mak
  20. LDSO_FULLNAME=ld-uClibc-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so
  21. SSPFLAGS=$(call check_gcc,-fno-stack-protector,)
  22. XXFLAGS=$(XWARNINGS) $(LIBRARY_CACHE) $(SSPFLAGS)
  23. ifeq ($(DODEBUG),y)
  24. # Not really much point in including debugging info, since gdb
  25. # can't really debug ldso, since gdb requires help from ldso to
  26. # debug things....
  27. XXFLAGS+=-Os #-g3
  28. else
  29. XXFLAGS+=$(OPTIMIZATION)
  30. endif
  31. XXFLAGS+= $(XARCH_CFLAGS) $(CPU_CFLAGS) $(PICFLAG) \
  32. -DUCLIBC_RUNTIME_PREFIX=\"$(RUNTIME_PREFIX)\" \
  33. -fno-builtin -nostdinc -D_LIBC -I$(TOPDIR)ldso/include -I. -I$(TOPDIR)include
  34. # BEWARE!!! At least mips* will die if -O0 is used!!!
  35. XXFLAGS :=$(XXFLAGS:-O0=-O1)
  36. XXFLAGS+=$(shell $(CC) -print-search-dirs | sed -ne "s/install: *\(.*\)/-I\1include/gp")
  37. LDFLAGS=$(CPU_LDFLAGS-y) -Bsymbolic -shared --warn-common --export-dynamic --sort-common \
  38. -z combreloc --discard-locals --discard-all --no-undefined
  39. CSRC= ldso.c
  40. COBJS=$(patsubst %.c,%.o, $(CSRC))
  41. ASRC=$(shell ls $(TARGET_ARCH)/*.S)
  42. AOBJS=$(patsubst %.S,%.o, $(ASRC))
  43. OBJS=$(AOBJS) $(COBJS)
  44. ifneq ($(strip $(SUPPORT_LD_DEBUG)),y)
  45. LDFLAGS+=-s
  46. endif
  47. ifeq ($(strip $(SUPPORT_LD_DEBUG)),y)
  48. XXFLAGS+=-D__SUPPORT_LD_DEBUG__
  49. endif
  50. ifeq ($(strip $(SUPPORT_LD_DEBUG_EARLY)),y)
  51. XXFLAGS+=-D__SUPPORT_LD_DEBUG_EARLY__
  52. endif
  53. ifeq ($(strip $(FORCE_SHAREABLE_TEXT_SEGMENTS)),y)
  54. XXFLAGS+=-DFORCE_SHAREABLE_TEXT_SEGMENTS
  55. endif
  56. #This stuff will not work with -fomit-frame-pointer
  57. XXFLAGS := $(XXFLAGS:-fomit-frame-pointer=)
  58. all: lib
  59. lib:: $(OBJS) $(DLINK_OBJS)
  60. $(LD) $(LDFLAGS) -e _dl_boot -soname=$(UCLIBC_LDSO) \
  61. -o $(LDSO_FULLNAME) $(OBJS) $(LIBGCC);
  62. $(INSTALL) -d $(TOPDIR)lib
  63. $(INSTALL) -m 755 $(LDSO_FULLNAME) $(TOPDIR)lib
  64. $(LN) -sf $(LDSO_FULLNAME) $(TOPDIR)lib/$(UCLIBC_LDSO)
  65. $(COBJS): %.o : %.c
  66. $(CC) $(XXFLAGS) -I../libdl -c $< -o $@
  67. $(STRIPTOOL) -x -R .note -R .comment $*.o
  68. $(AOBJS): %.o : %.S
  69. $(CC) $(XXFLAGS) -I../libdl -c $< -o $@
  70. $(STRIPTOOL) -x -R .note -R .comment $*.o
  71. ldso.o: $(CSRC)
  72. clean:
  73. $(RM) $(UCLIBC_LDSO)* $(OBJS) $(LDSO_FULLNAME)* core *.o *.a *.s *.i ldso.h *~