Makefile 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. # Makefile for uClibc
  2. #
  3. # Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
  4. #
  5. # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
  6. #
  7. TOPDIR=../
  8. include $(TOPDIR)Rules.mak
  9. CFLAGS += $(SSP_ALL_CFLAGS) -B$(TOPDIR)lib -I$(TOPDIR)ldso/include
  10. TARGETS = ldd ldconfig
  11. ifeq ($(UCLIBC_HAS_LOCALE),y)
  12. TARGET_ICONV = iconv
  13. else
  14. TARGET_ICONV =
  15. endif
  16. ifeq ($(LDSO_CACHE_SUPPORT),y)
  17. HOST_LDSO_CACHE_FLAG = -D__LDSO_CACHE_SUPPORT__=1
  18. else
  19. HOST_LDSO_CACHE_FLAG =
  20. endif
  21. # NOTE: We build the utils AFTER we have a uClibc-targeted toolchain.
  22. ifeq ($(HAVE_SHARED),y)
  23. all: $(TARGETS) $(TARGET_ICONV)
  24. else
  25. all: $(TARGET_ICONV)
  26. endif
  27. headers:
  28. @$(LN) -fs $(TOPDIR)include/elf.h
  29. @$(LN) -fs $(TOPDIR)include/link.h
  30. readelf.c ldconfig.c ldd.c: headers
  31. readelf: readelf.c
  32. $(CC) $(CFLAGS) $^ -o $@
  33. $(STRIPTOOL) -s -x -R .note -R .comment $@
  34. ifeq ($(UCLIBC_STATIC_LDCONFIG),y)
  35. LDCONFIG_CFLAGS := -static
  36. else
  37. LDCONFIG_CFLAGS := $(PIEFLAG) $(LDPIEFLAG)
  38. endif
  39. ldconfig: ldconfig.c chroot_realpath.c
  40. $(CC) $(CFLAGS) $(LDCONFIG_CFLAGS) \
  41. -DUCLIBC_RUNTIME_PREFIX=\"$(RUNTIME_PREFIX)\" \
  42. -DUCLIBC_LDSO=$(UCLIBC_LDSO) \
  43. $^ -o $@
  44. $(STRIPTOOL) -s -x -R .note -R .comment $@
  45. LDD_CFLAGS := $(PIEFLAG) $(LDPIEFLAG)
  46. ldd: ldd.c
  47. $(CC) $(CFLAGS) $(LDD_CFLAGS) \
  48. -DUCLIBC_RUNTIME_PREFIX=\"$(RUNTIME_PREFIX)\" \
  49. -DUCLIBC_LDSO=$(UCLIBC_LDSO) \
  50. $^ -o $@
  51. $(STRIPTOOL) -s -x -R .note -R .comment $@
  52. ICONV_CFLAGS := $(PIEFLAG) $(LDPIEFLAG)
  53. iconv: $(TOPDIR)libc/misc/wchar/wchar.c
  54. $(CC) $(CFLAGS) $(ICONV_CFLAGS) \
  55. -DL_iconv_main \
  56. $^ -o $@
  57. $(STRIPTOOL) -s -x -R .note -R .comment $@
  58. ifeq ($(HAVE_SHARED),y)
  59. hostutils: ldd.host ldconfig.host readelf.host
  60. else
  61. hostutils: readelf.host
  62. endif
  63. ldd.host: ldd.c
  64. $(HOSTCC) $(HOSTCFLAGS) -Wl,-s \
  65. -DUCLIBC_RUNTIME_PREFIX=\"$(RUNTIME_PREFIX)\" $(HOST_LDSO_CACHE_FLAG) \
  66. -DUCLIBC_LDSO=$(UCLIBC_LDSO) -I. -I$(TOPDIR)ldso/include \
  67. $^ -o $@
  68. ldconfig.host: ldconfig.c chroot_realpath.c
  69. $(HOSTCC) $(HOSTCFLAGS) -Wl,-s \
  70. -DUCLIBC_RUNTIME_PREFIX=\"$(RUNTIME_PREFIX)\" $(HOST_LDSO_CACHE_FLAG) \
  71. -DUCLIBC_LDSO=$(UCLIBC_LDSO) -I. -I$(TOPDIR)ldso/include \
  72. $^ -o $@
  73. readelf.host: readelf.c
  74. $(HOSTCC) $(HOSTCFLAGS) -Wl,-s $^ -o $@
  75. clean:
  76. $(RM) $(TARGETS) *.o *~ core elf.h link.h readelf iconv *.host
  77. install: all
  78. ifeq ($(HAVE_SHARED),y)
  79. $(INSTALL) -d $(PREFIX)$(RUNTIME_PREFIX)sbin
  80. $(INSTALL) -d $(PREFIX)$(RUNTIME_PREFIX)usr/bin
  81. $(INSTALL) -m 755 ldd $(PREFIX)$(RUNTIME_PREFIX)usr/bin/ldd
  82. $(INSTALL) -m 755 ldconfig $(PREFIX)$(RUNTIME_PREFIX)sbin/ldconfig
  83. #$(INSTALL) -m 755 readelf $(PREFIX)$(RUNTIME_PREFIX)usr/bin/readelf
  84. endif
  85. ifeq ($(UCLIBC_HAS_LOCALE),y)
  86. $(INSTALL) -m 755 iconv $(PREFIX)$(RUNTIME_PREFIX)usr/bin/iconv
  87. endif