Makefile 3.0 KB

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