Makefile 2.9 KB

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