Makefile 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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=$(XWARNINGS) $(SSP_CFLAGS) $(SSP_ALL_CFLAGS)
  22. ifeq ($(DODEBUG),y)
  23. XXFLAGS+=-O0 -g3
  24. else
  25. XXFLAGS+=$(OPTIMIZATION)
  26. endif
  27. XXFLAGS+= $(XARCH_CFLAGS) $(CPU_CFLAGS) \
  28. -DUCLIBC_RUNTIME_PREFIX=\"$(RUNTIME_PREFIX)\" \
  29. -fno-builtin -nostdinc -D_LIBC -I$(TOPDIR)ldso/include -I$(TOPDIR)ldso/ldso -I. -I$(TOPDIR)include
  30. XXFLAGS+=-isystem $(shell $(CC) -print-file-name=include)
  31. XXFLAGS_NOPIC:=$(XXFLAGS)
  32. ifeq ($(DOPIC),y)
  33. XXFLAGS += $(PICFLAG) -D__LIBDL_SHARED__
  34. endif
  35. ifeq ($(strip $(SUPPORT_LD_DEBUG)),y)
  36. XXFLAGS+=-D__SUPPORT_LD_DEBUG__
  37. endif
  38. LIBDL=libdl.a
  39. LIBDL_PIC=libdl_pic.a
  40. LIBDL_SHARED=libdl.so
  41. LIBDL_SHARED_FULLNAME=libdl-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so
  42. CSRC=libdl.c
  43. OBJS=libdl.o
  44. PIC_OBJS=libdl_pic.o
  45. all: $(LIBDL) $(LIBDL_PIC)
  46. ar-target: $(LIBDL) $(LIBDL_PIC)
  47. $(LIBDL): $(OBJS)
  48. $(AR) $(ARFLAGS) $(LIBDL) ../ldso/$(TARGET_ARCH)/resolve.o $(OBJS)
  49. $(INSTALL) -d $(TOPDIR)lib
  50. $(RM) $(TOPDIR)lib/$(LIBDL)
  51. $(INSTALL) -m 644 $(LIBDL) $(TOPDIR)lib
  52. $(LIBDL_PIC): $(PIC_OBJS)
  53. $(AR) $(ARFLAGS) $(LIBDL_PIC) $(PIC_OBJS)
  54. libdl.o: libdl.c $(TOPDIR)ldso/include/*.h
  55. $(CC) $(XXFLAGS_NOPIC) -c libdl.c -o libdl.o
  56. $(STRIPTOOL) -x -R .note -R .comment $*.o
  57. libdl_pic.o: libdl.c $(TOPDIR)ldso/include/*.h
  58. $(CC) $(XXFLAGS) -c libdl.c -o libdl_pic.o
  59. $(STRIPTOOL) -x -R .note -R .comment $*.o
  60. shared: $(LIBDL_PIC)
  61. $(LD) $(LDFLAGS) -soname=$(LIBDL_SHARED).$(MAJOR_VERSION) \
  62. -o $(LIBDL_SHARED_FULLNAME) -fini dl_cleanup --whole-archive $(LIBDL_PIC) \
  63. --no-whole-archive $(TOPDIR)/libc/misc/internals/interp.o \
  64. -L$(TOPDIR)/lib -lc $(LDADD_LIBFLOAT) $(LIBGCC);
  65. $(INSTALL) -d $(TOPDIR)lib
  66. $(RM) $(TOPDIR)lib/$(LIBDL_SHARED_FULLNAME) $(TOPDIR)lib/$(LIBDL_SHARED).$(MAJOR_VERSION)
  67. $(INSTALL) -m 644 $(LIBDL_SHARED_FULLNAME) $(TOPDIR)lib
  68. $(LN) -sf $(LIBDL_SHARED_FULLNAME) $(TOPDIR)lib/$(LIBDL_SHARED)
  69. $(LN) -sf $(LIBDL_SHARED_FULLNAME) $(TOPDIR)lib/$(LIBDL_SHARED).$(MAJOR_VERSION)
  70. clean:
  71. $(RM) .depend $(LIBDL_SHARED)* $(LIBDL_SHARED_FULLNAME) core *.o *.a *.s *.i tmp_make foo *~