Makefile 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. # Makefile for uClibc
  2. #
  3. # Copyright (C) 2000 by Lineo, inc.
  4. # Copyright (C) 2000-2002 Erik Andersen <andersen@uclibc.org>
  5. #
  6. # This program is free software; you can redistribute it and/or modify it under
  7. # the terms of the GNU Library General Public License as published by the Free
  8. # Software Foundation; either version 2 of the License, or (at your option) any
  9. # later version.
  10. #
  11. # This program is distributed in the hope that it will be useful, but WITHOUT
  12. # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  13. # FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more
  14. # details.
  15. #
  16. # You should have received a copy of the GNU Library General Public License
  17. # along with this program; if not, write to the Free Software Foundation, Inc.,
  18. # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  19. #
  20. # Derived in part from the Linux-8086 C library, the GNU C Library, and several
  21. # other sundry sources. Files within this library are copyright by their
  22. # respective copyright holders.
  23. TOPDIR=../../
  24. include $(TOPDIR)Rules.mak
  25. LDSO_FULLNAME=ld-uClibc-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so
  26. XXFLAGS+=-DUCLIBC_TARGET_PREFIX=\"$(TARGET_PREFIX)\" \
  27. -DUCLIBC_DEVEL_PREFIX=\"$(DEVEL_PREFIX)\" \
  28. -DUCLIBC_BUILD_DIR=\"$(shell cd $(TOPDIR) && pwd)\"
  29. LDFLAGS=-shared --warn-common --export-dynamic --sort-common \
  30. -z combreloc --discard-locals --discard-all
  31. CSRC= ldso.c #hash.c readelflib1.c $(TARGET_ARCH)/elfinterp.c
  32. COBJS=$(patsubst %.c,%.o, $(CSRC))
  33. ASRC=$(shell ls $(TARGET_ARCH)/*.S)
  34. AOBJS=$(patsubst %.S,%.o, $(ASRC))
  35. OBJS=$(AOBJS) $(COBJS)
  36. ifeq ($(strip $(TARGET_ARCH)),cris)
  37. LDFLAGS+=-mcrislinux
  38. endif
  39. ifneq ($(strip $(DODEBUG)),true)
  40. LDFLAGS+=-s
  41. endif
  42. all: lib
  43. lib:: ldso.h $(OBJS) $(DLINK_OBJS)
  44. $(LD) $(LDFLAGS) -e _dl_boot -soname=$(UCLIBC_LDSO) \
  45. -o $(LDSO_FULLNAME) $(OBJS) $(LIBGCC);
  46. install -d $(TOPDIR)lib
  47. install -m 755 $(LDSO_FULLNAME) $(TOPDIR)lib
  48. (cd $(TOPDIR)lib && ln -sf $(LDSO_FULLNAME) $(UCLIBC_LDSO))
  49. ldso.h: Makefile
  50. echo "const char *_dl_progname=\""$(UCLIBC_LDSO)"\";" > ldso.h
  51. echo "#include \"$(TARGET_ARCH)/elfinterp.c\"" >> ldso.h
  52. $(COBJS): %.o : %.c
  53. $(CC) $(CFLAGS) $(XXFLAGS) -I. -I./$(TARGET_ARCH) -I../libdl -c $< -o $@
  54. $(STRIPTOOL) -x -R .note -R .comment $*.o
  55. $(AOBJS): %.o : %.S
  56. $(CC) $(CFLAGS) -I. -I./$(TARGET_ARCH) -I../libdl -c $< -o $@
  57. $(STRIPTOOL) -x -R .note -R .comment $*.o
  58. ldso.o: ldso.c hash.c readelflib1.c $(TARGET_ARCH)/elfinterp.c \
  59. ld_hash.h ld_string.h ld_syscall.h ldso.h linuxelf.h
  60. clean::
  61. $(RM) -f $(UCLIBC_LDSO)* $(OBJS) $(LDSO_FULLNAME)* core *.o *.a *.s *.i ldso.h *~