Makefile 2.8 KB

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