Makefile 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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. # BEWARE!!! At least mips* will die if -O0 is used!!!
  33. XXFLAGS:=$(XXFLAGS:-O0=-O1)
  34. XXFLAGS+=-isystem $(shell $(CC) -print-file-name=include)
  35. ifeq ($(strip $(SUPPORT_LD_DEBUG)),y)
  36. XXFLAGS+=-D__SUPPORT_LD_DEBUG__
  37. endif
  38. ifeq ($(strip $(SUPPORT_LD_DEBUG_EARLY)),y)
  39. XXFLAGS+=-D__SUPPORT_LD_DEBUG_EARLY__
  40. endif
  41. #This stuff will not work with -fomit-frame-pointer
  42. XXFLAGS := $(XXFLAGS:-fomit-frame-pointer=)
  43. ASFLAGS=$(XXFLAGS)
  44. ifeq ($(UCLIBC_BUILD_NOEXECSTACK),y)
  45. ASFLAGS+=$(call check_as,--noexecstack)
  46. endif
  47. LDFLAGS=$(CPU_LDFLAGS-y) -e _start -z now -Bsymbolic -shared --warn-common --export-dynamic --sort-common \
  48. -z combreloc --discard-locals --discard-all --no-undefined
  49. ifeq ($(UCLIBC_BUILD_RELRO),y)
  50. LDFLAGS+=-z relro
  51. endif
  52. ifneq ($(strip $(SUPPORT_LD_DEBUG)),y)
  53. LDFLAGS+=-s
  54. endif
  55. LIB_NAME=ld-uClibc
  56. SO_LIB_NAME=$(TOPDIR)lib/$(UCLIBC_LDSO)
  57. SO_FULL_NAME=$(LIB_NAME)-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so
  58. CSRC= ldso.c
  59. COBJS=$(patsubst %.c,%.o, $(CSRC))
  60. ASRC=$(wildcard $(TARGET_ARCH)/*.S)
  61. AOBJS=$(patsubst %.S,%.o, $(ASRC))
  62. OBJS=$(AOBJS) $(COBJS)
  63. all: $(SO_LIB_NAME)
  64. $(SO_LIB_NAME): $(OBJS)
  65. $(INSTALL) -d $(TOPDIR)lib
  66. $(RM) $(TOPDIR)lib/$(SO_FULL_NAME) $(SO_LIB_NAME)
  67. $(LD) $(LDFLAGS) -soname=$(UCLIBC_LDSO) \
  68. -o $(TOPDIR)lib/$(SO_FULL_NAME) $(OBJS) $(LIBGCC)
  69. $(LN) -sf $(SO_FULL_NAME) $(SO_LIB_NAME)
  70. $(COBJS): %.o : %.c
  71. $(CC) $(XXFLAGS) -c $< -o $@
  72. $(STRIPTOOL) -x -R .note -R .comment $*.o
  73. $(AOBJS): %.o : %.S
  74. $(CC) $(ASFLAGS) -c $< -o $@
  75. $(STRIPTOOL) -x -R .note -R .comment $*.o
  76. clean:
  77. $(RM) *.o */*.o *~ core