Makefile 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. # Makefile for uClibc
  2. #
  3. # Copyright (C) 2000-2004 Erik Andersen <andersen@uclibc.org>
  4. #
  5. # This program is free software; you can redistribute it and/or modify it under
  6. # the terms of the GNU Library General Public License as published by the Free
  7. # Software Foundation; either version 2 of the License, or (at your option) any
  8. # later version.
  9. #
  10. # This program is distributed in the hope that it will be useful, but WITHOUT
  11. # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  12. # FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more
  13. # details.
  14. #
  15. # You should have received a copy of the GNU Library General Public License
  16. # along with this program; if not, write to the Free Software Foundation, Inc.,
  17. # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  18. TOPDIR=../../
  19. include $(TOPDIR)Rules.mak
  20. XXFLAGS=$(XWARNINGS) $(SSP_DISABLE_FLAGS)
  21. ifeq ($(DODEBUG),y)
  22. # Not really much point in including debugging info, since gdb
  23. # can't really debug ldso, since gdb requires help from ldso to
  24. # debug things....
  25. XXFLAGS+=-Os -g
  26. else
  27. XXFLAGS+=$(OPTIMIZATION)
  28. endif
  29. XXFLAGS+= -DUCLIBC_LDSO=\"$(UCLIBC_LDSO)\" $(XARCH_CFLAGS) $(CPU_CFLAGS) $(PICFLAG) \
  30. -DUCLIBC_RUNTIME_PREFIX=\"$(RUNTIME_PREFIX)\" \
  31. -fno-builtin -nostdinc -D_LIBC -I$(TOPDIR)ldso/include -I. -I$(TOPDIR)include
  32. XXFLAGS+=-isystem $(shell $(CC) -print-file-name=include)
  33. ifeq ($(SUPPORT_LD_DEBUG),y)
  34. XXFLAGS+=-D__SUPPORT_LD_DEBUG__
  35. endif
  36. ifeq ($(SUPPORT_LD_DEBUG_EARLY),y)
  37. XXFLAGS+=-D__SUPPORT_LD_DEBUG_EARLY__
  38. endif
  39. #This stuff will not work with -fomit-frame-pointer
  40. XXFLAGS := $(XXFLAGS:-fomit-frame-pointer=)
  41. # BEWARE!!! At least mips* will die if -O0 is used!!!
  42. ifeq ($(strip $(TARGET_ARCH)),mips)
  43. XXFLAGS := $(XXFLAGS:-O0=-O1)
  44. endif
  45. ASFLAGS=$(XXFLAGS)
  46. ifeq ($(UCLIBC_BUILD_NOEXECSTACK),y)
  47. ASFLAGS+=$(call check_as,--noexecstack)
  48. endif
  49. LDFLAGS=$(CPU_LDFLAGS-y) -e _start -z now -Bsymbolic -shared --warn-common --export-dynamic --sort-common \
  50. -z combreloc --discard-locals --discard-all --no-undefined
  51. ifeq ($(UCLIBC_BUILD_RELRO),y)
  52. LDFLAGS+=-z relro
  53. endif
  54. ifneq ($(SUPPORT_LD_DEBUG),y)
  55. LDFLAGS+=-s
  56. endif
  57. LIB_NAME := ld-uClibc
  58. SO_LIB_NAME := $(TOPDIR)lib/$(UCLIBC_LDSO)
  59. SO_FULL_NAME := $(LIB_NAME)-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so
  60. CSRC := ldso.c
  61. COBJ := $(patsubst %.c,%.o, $(CSRC))
  62. SSRC := $(wildcard $(TARGET_ARCH)/*.S)
  63. SOBJ := $(patsubst %.S,%.o, $(SSRC))
  64. OBJS := $(SOBJ) $(COBJ)
  65. all: $(SO_LIB_NAME)
  66. $(SO_LIB_NAME): $(OBJS)
  67. $(INSTALL) -d $(TOPDIR)lib
  68. $(RM) $(TOPDIR)lib/$(SO_FULL_NAME) $@
  69. $(STRIPTOOL) -x -R .note -R .comment $^
  70. $(LD) $(LDFLAGS) -soname=$(UCLIBC_LDSO) \
  71. -o $(TOPDIR)lib/$(SO_FULL_NAME) $^ $(LIBGCC)
  72. $(LN) -sf $(SO_FULL_NAME) $@
  73. $(COBJ): %.o : %.c
  74. $(CC) $(XXFLAGS) -c $< -o $@
  75. $(SOBJ): %.o : %.S
  76. $(CC) $(ASFLAGS) -c $< -o $@
  77. clean:
  78. $(RM) *.o */*.o *~ core