Makefile 2.5 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. TOPDIR=../../
  20. include $(TOPDIR)Rules.mak
  21. XXFLAGS+=-DUCLIBC_TARGET_PREFIX=\"$(TARGET_PREFIX)\" \
  22. -DUCLIBC_DEVEL_PREFIX=\"$(DEVEL_PREFIX)\" \
  23. -DUCLIBC_BUILD_DIR=\"$(shell cd $(TOPDIR) && pwd)\"
  24. ifeq ($(strip $(SUPPORT_LD_DEBUG)),y)
  25. XXFLAGS+=-D__SUPPORT_LD_DEBUG__
  26. endif
  27. LIBDL=libdl.a
  28. LIBDL_PIC=libdl_pic.a
  29. LIBDL_SHARED=libdl.so
  30. LIBDL_SHARED_FULLNAME=libdl-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so
  31. CSRC=dlib.c
  32. OBJS=dlib.o
  33. PIC_OBJS=dlib_pic.o
  34. all: $(OBJS) $(LIBDL) shared
  35. $(LIBDL): ar-target
  36. ar-target: $(OBJS) $(PIC_OBJS)
  37. $(AR) $(ARFLAGS) $(LIBDL) ../ldso/$(TARGET_ARCH)/resolve.o $(OBJS)
  38. $(AR) $(ARFLAGS) $(LIBDL_PIC) $(PIC_OBJS)
  39. install -d $(TOPDIR)lib
  40. rm -f $(TOPDIR)lib/$(LIBDL)
  41. install -m 644 $(LIBDL) $(TOPDIR)lib
  42. dlib.o: dlib.c
  43. $(CC) -I../ldso -I../ldso/$(TARGET_ARCH) $(CFLAGS_NOPIC) $(XXFLAGS) -c dlib.c -o dlib.o
  44. $(STRIPTOOL) -x -R .note -R .comment $*.o
  45. dlib_pic.o: dlib.c
  46. $(CC) -I../ldso -I../ldso/$(TARGET_ARCH) $(CFLAGS) -c dlib.c -o dlib_pic.o
  47. $(STRIPTOOL) -x -R .note -R .comment $*.o
  48. $(OBJ): Makefile
  49. shared:
  50. $(LD) $(LDFLAGS) -soname=$(LIBDL_SHARED).$(MAJOR_VERSION) \
  51. -o $(LIBDL_SHARED_FULLNAME) --whole-archive $(LIBDL_PIC) \
  52. --no-whole-archive $(TOPDIR)/libc/misc/internals/interp.o \
  53. -L$(TOPDIR)/lib -lc;
  54. install -d $(TOPDIR)lib
  55. rm -f $(TOPDIR)lib/$(LIBDL_SHARED_FULLNAME) $(TOPDIR)lib/$(LIBDL_SHARED).$(MAJOR_VERSION)
  56. install -m 644 $(LIBDL_SHARED_FULLNAME) $(TOPDIR)lib;
  57. (cd $(TOPDIR)lib && ln -sf $(LIBDL_SHARED_FULLNAME) $(LIBDL_SHARED));
  58. (cd $(TOPDIR)lib && ln -sf $(LIBDL_SHARED_FULLNAME) $(LIBDL_SHARED).$(MAJOR_VERSION));
  59. clean:
  60. $(RM) -f .depend $(LIBDL_SHARED)* $(LIBDL_SHARED_FULLNAME) core *.o *.a *.s *.i tmp_make foo *~