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) $(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$(TOPDIR)include
  30. XXFLAGS+=-isystem $(shell $(CC) -print-file-name=include)
  31. ifeq ($(strip $(SUPPORT_LD_DEBUG)),y)
  32. XXFLAGS+=-D__SUPPORT_LD_DEBUG__
  33. endif
  34. XXFLAGS_NOPIC:=$(XXFLAGS)
  35. ifeq ($(DOPIC),y)
  36. XXFLAGS += $(PICFLAG) -D__LIBDL_SHARED__
  37. endif
  38. LIB_NAME=libdl
  39. AR_LIB_NAME=$(TOPDIR)lib/$(LIB_NAME).a
  40. SO_LIB_NAME=$(TOPDIR)lib/$(LIB_NAME).so
  41. SO_FULL_NAME=$(LIB_NAME)-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so
  42. CSRC = libdl.c
  43. OBJS = libdl.o
  44. PIC_OBJS = libdl_pic.o
  45. # we do not get here, do we need a libdl.a, if ld.so is not ours?
  46. #ifeq ($(strip $(HAVE_SHARED)),y)
  47. all: $(AR_LIB_NAME) $(SO_LIB_NAME)
  48. #else
  49. #all: $(AR_LIB_NAME)
  50. #endif
  51. $(AR_LIB_NAME): $(OBJS) ../ldso/$(TARGET_ARCH)/resolve.o
  52. $(INSTALL) -d $(TOPDIR)lib
  53. $(RM) $(AR_LIB_NAME)
  54. $(AR) $(ARFLAGS) $(AR_LIB_NAME) $(OBJS) ../ldso/$(TARGET_ARCH)/resolve.o
  55. shared_$(LIB_NAME).a: $(PIC_OBJS)
  56. $(RM) shared_$(LIB_NAME).a
  57. $(AR) $(ARFLAGS) shared_$(LIB_NAME).a $(PIC_OBJS)
  58. # this will be built only on the second round, when libc.so is present,
  59. # else we would link against libc.a
  60. $(SO_LIB_NAME): shared_$(LIB_NAME).a
  61. if [ -f $(TOPDIR)lib/libc.so ] ; then \
  62. $(RM) $(TOPDIR)lib/$(SO_FULL_NAME) $(SO_LIB_NAME).$(MAJOR_VERSION) $(SO_LIB_NAME) ; \
  63. $(LD) $(LDFLAGS) -soname=$(LIB_NAME).so.$(MAJOR_VERSION) \
  64. -o $(TOPDIR)lib/$(SO_FULL_NAME) -fini dl_cleanup --whole-archive shared_$(LIB_NAME).a \
  65. --no-whole-archive $(TOPDIR)libc/misc/internals/interp.o \
  66. -L$(TOPDIR)lib -lc $(LDADD_LIBFLOAT) $(TOPDIR)lib/$(UCLIBC_LDSO) $(LIBGCC) ; \
  67. $(LN) -sf $(SO_FULL_NAME) $(SO_LIB_NAME).$(MAJOR_VERSION) ; \
  68. $(LN) -sf $(SO_FULL_NAME) $(SO_LIB_NAME) ; \
  69. fi
  70. $(OBJS): %.o : %.c
  71. $(CC) $(XXFLAGS_NOPIC) -c $< -o $@
  72. $(STRIPTOOL) -x -R .note -R .comment $*.o
  73. libdl_pic.o: libdl.c
  74. $(CC) $(XXFLAGS) -c $< -o $@
  75. $(STRIPTOOL) -x -R .note -R .comment $*.o
  76. clean:
  77. $(RM) *.o *~ core *.a