Makefile 2.7 KB

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