Makefile 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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) $(LIBRARY_CACHE)
  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+=$(shell $(CC) -print-search-dirs | sed -ne "s/install: *\(.*\)/-I\1include/gp")
  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: $(OBJS) $(LIBDL) shared
  46. $(LIBDL): ar-target
  47. $(LIBDL_PIC): ar-target
  48. ar-target: $(OBJS) $(PIC_OBJS)
  49. $(AR) $(ARFLAGS) $(LIBDL) ../ldso/$(TARGET_ARCH)/resolve.o $(OBJS)
  50. $(AR) $(ARFLAGS) $(LIBDL_PIC) $(PIC_OBJS)
  51. $(INSTALL) -d $(TOPDIR)lib
  52. $(RM) $(TOPDIR)lib/$(LIBDL)
  53. $(INSTALL) -m 644 $(LIBDL) $(TOPDIR)lib
  54. libdl.o: libdl.c
  55. $(CC) $(XXFLAGS_NOPIC) -c libdl.c -o libdl.o
  56. $(STRIPTOOL) -x -R .note -R .comment $*.o
  57. libdl_pic.o: libdl.c
  58. $(CC) $(XXFLAGS) -c libdl.c -o libdl_pic.o
  59. $(STRIPTOOL) -x -R .note -R .comment $*.o
  60. $(OBJ): Makefile
  61. shared: $(LIBDL_PIC)
  62. $(LD) $(LDFLAGS) -soname=$(LIBDL_SHARED).$(MAJOR_VERSION) \
  63. -o $(LIBDL_SHARED_FULLNAME) -fini dl_cleanup --whole-archive $(LIBDL_PIC) \
  64. --no-whole-archive $(TOPDIR)/libc/misc/internals/interp.o \
  65. -L$(TOPDIR)/lib -lc $(LDADD_LIBFLOAT) $(LIBGCC);
  66. $(INSTALL) -d $(TOPDIR)lib
  67. $(RM) $(TOPDIR)lib/$(LIBDL_SHARED_FULLNAME) $(TOPDIR)lib/$(LIBDL_SHARED).$(MAJOR_VERSION)
  68. $(INSTALL) -m 644 $(LIBDL_SHARED_FULLNAME) $(TOPDIR)lib
  69. $(LN) -sf $(LIBDL_SHARED_FULLNAME) $(TOPDIR)lib/$(LIBDL_SHARED)
  70. $(LN) -sf $(LIBDL_SHARED_FULLNAME) $(TOPDIR)lib/$(LIBDL_SHARED).$(MAJOR_VERSION)
  71. clean:
  72. $(RM) .depend $(LIBDL_SHARED)* $(LIBDL_SHARED_FULLNAME) core *.o *.a *.s *.i tmp_make foo *~