Makefile 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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. XXFLAGS=$(XWARNINGS) $(LIBRARY_CACHE)
  22. ifeq ($(DODEBUG),y)
  23. # Not really much point in including debugging info, since gdb
  24. # can't really debug ldso, since gdb requires help from ldso to
  25. # debug things....
  26. XXFLAGS+=-Os #-g3
  27. else
  28. XXFLAGS+=$(OPTIMIZATION)
  29. endif
  30. XXFLAGS+= $(XARCH_CFLAGS) $(CPU_CFLAGS) $(PICFLAG) \
  31. -DUCLIBC_RUNTIME_PREFIX=\"$(RUNTIME_PREFIX)\" \
  32. -fno-builtin -nostdinc -D_LIBC -I$(TOPDIR)ldso/include -I. -I$(TOPDIR)include
  33. # BEWARE!!! At least mips* will die if -O0 is used!!!
  34. XXFLAGS :=$(XXFLAGS:-O0=-O1)
  35. XXFLAGS+=$(shell $(CC) -print-search-dirs | sed -ne "s/install: *\(.*\)/-I\1include/gp")
  36. LDFLAGS=$(CPU_LDFLAGS-y) -shared --warn-common --export-dynamic --sort-common \
  37. -z combreloc --discard-locals --discard-all --no-undefined
  38. CSRC= ldso.c dl-startup.c
  39. COBJS=$(patsubst %.c,%.o, $(CSRC))
  40. ASRC=$(shell ls $(TARGET_ARCH)/*.S)
  41. AOBJS=$(patsubst %.S,%.o, $(ASRC))
  42. OBJS=$(AOBJS) $(COBJS)
  43. ifneq ($(strip $(SUPPORT_LD_DEBUG)),y)
  44. LDFLAGS+=-s
  45. endif
  46. ifeq ($(strip $(SUPPORT_LD_DEBUG)),y)
  47. XXFLAGS+=-D__SUPPORT_LD_DEBUG__
  48. endif
  49. ifeq ($(strip $(SUPPORT_LD_DEBUG_EARLY)),y)
  50. XXFLAGS+=-D__SUPPORT_LD_DEBUG_EARLY__
  51. endif
  52. ifeq ($(strip $(FORCE_SHAREABLE_TEXT_SEGMENTS)),y)
  53. XXFLAGS+=-DFORCE_SHAREABLE_TEXT_SEGMENTS
  54. endif
  55. #This stuff will not work with -fomit-frame-pointer
  56. XXFLAGS := $(XXFLAGS:-fomit-frame-pointer=)
  57. all: lib
  58. lib:: $(OBJS) $(DLINK_OBJS)
  59. $(LD) $(LDFLAGS) -e _dl_boot -soname=$(UCLIBC_LDSO) \
  60. -o $(LDSO_FULLNAME) $(OBJS) $(LIBGCC);
  61. $(INSTALL) -d $(TOPDIR)lib
  62. $(INSTALL) -m 755 $(LDSO_FULLNAME) $(TOPDIR)lib
  63. $(LN) -sf $(LDSO_FULLNAME) $(TOPDIR)lib/$(UCLIBC_LDSO)
  64. $(COBJS): %.o : %.c
  65. $(CC) $(XXFLAGS) -I../libdl -c $< -o $@
  66. $(STRIPTOOL) -x -R .note -R .comment $*.o
  67. $(AOBJS): %.o : %.S
  68. $(CC) $(XXFLAGS) -I../libdl -c $< -o $@
  69. $(STRIPTOOL) -x -R .note -R .comment $*.o
  70. ldso.o: $(CSRC)
  71. clean:
  72. $(RM) $(UCLIBC_LDSO)* $(OBJS) $(LDSO_FULLNAME)* core *.o *.a *.s *.i ldso.h *~