Makefile 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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. top_srcdir=../
  8. top_builddir=../
  9. include $(top_builddir)Rules.mak
  10. CFLAGS += $(SSP_ALL_CFLAGS) -B$(top_builddir)lib -I$(top_srcdir)ldso/include
  11. TARGETS = ldd ldconfig
  12. ifeq ($(UCLIBC_HAS_LOCALE),y)
  13. TARGET_ICONV = iconv
  14. else
  15. TARGET_ICONV =
  16. endif
  17. ifeq ($(LDSO_CACHE_SUPPORT),y)
  18. HOST_LDSO_CACHE_FLAG = -D__LDSO_CACHE_SUPPORT__=1
  19. else
  20. HOST_LDSO_CACHE_FLAG =
  21. endif
  22. # NOTE: We build the utils AFTER we have a uClibc-targeted toolchain.
  23. ifeq ($(HAVE_SHARED),y)
  24. all: $(TARGETS) $(TARGET_ICONV)
  25. else
  26. all: $(TARGET_ICONV)
  27. endif
  28. readelf: readelf.c
  29. $(CC) $(CFLAGS) $^ -o $@
  30. $(STRIPTOOL) -s -x -R .note -R .comment $@
  31. ifeq ($(UCLIBC_STATIC_LDCONFIG),y)
  32. LDCONFIG_CFLAGS := -static
  33. else
  34. LDCONFIG_CFLAGS := $(PIEFLAG) $(LDPIEFLAG)
  35. endif
  36. ldconfig: ldconfig.c chroot_realpath.c
  37. $(CC) $(CFLAGS) $(LDCONFIG_CFLAGS) \
  38. -DUCLIBC_RUNTIME_PREFIX=\"$(RUNTIME_PREFIX)\" \
  39. -DUCLIBC_LDSO=$(UCLIBC_LDSO) \
  40. $^ -o $@
  41. $(STRIPTOOL) -s -x -R .note -R .comment $@
  42. LDD_CFLAGS := $(PIEFLAG) $(LDPIEFLAG)
  43. ldd: ldd.c
  44. $(CC) $(CFLAGS) $(LDD_CFLAGS) \
  45. -DUCLIBC_RUNTIME_PREFIX=\"$(RUNTIME_PREFIX)\" \
  46. -DUCLIBC_LDSO=$(UCLIBC_LDSO) \
  47. $^ -o $@
  48. $(STRIPTOOL) -s -x -R .note -R .comment $@
  49. ICONV_CFLAGS := $(PIEFLAG) $(LDPIEFLAG)
  50. iconv: $(top_srcdir)libc/misc/wchar/wchar.c
  51. $(CC) $(CFLAGS) $(ICONV_CFLAGS) \
  52. -DL_iconv_main \
  53. $^ -o $@
  54. $(STRIPTOOL) -s -x -R .note -R .comment $@
  55. ifeq ($(HAVE_SHARED),y)
  56. hostutils: ldd.host ldconfig.host readelf.host
  57. else
  58. hostutils: readelf.host
  59. endif
  60. ldd.host: ldd.c
  61. $(HOSTCC) $(HOSTCFLAGS) -Wl,-s \
  62. -DUCLIBC_RUNTIME_PREFIX=\"$(RUNTIME_PREFIX)\" $(HOST_LDSO_CACHE_FLAG) \
  63. -DUCLIBC_LDSO=$(UCLIBC_LDSO) -I$(top_srcdir)ldso/include \
  64. $^ -o $@
  65. ldconfig.host: ldconfig.c chroot_realpath.c
  66. $(HOSTCC) $(HOSTCFLAGS) -Wl,-s \
  67. -DUCLIBC_RUNTIME_PREFIX=\"$(RUNTIME_PREFIX)\" $(HOST_LDSO_CACHE_FLAG) \
  68. -DUCLIBC_LDSO=$(UCLIBC_LDSO) -I$(top_srcdir)ldso/include \
  69. $^ -o $@
  70. readelf.host: readelf.c
  71. $(HOSTCC) $(HOSTCFLAGS) -Wl,-s $^ -o $@
  72. clean:
  73. $(RM) $(TARGETS) *.o *~ core readelf iconv *.host
  74. install: all
  75. ifeq ($(HAVE_SHARED),y)
  76. $(INSTALL) -d $(PREFIX)$(RUNTIME_PREFIX)sbin
  77. $(INSTALL) -d $(PREFIX)$(RUNTIME_PREFIX)usr/bin
  78. $(INSTALL) -m 755 ldd $(PREFIX)$(RUNTIME_PREFIX)usr/bin/ldd
  79. $(INSTALL) -m 755 ldconfig $(PREFIX)$(RUNTIME_PREFIX)sbin/ldconfig
  80. #$(INSTALL) -m 755 readelf $(PREFIX)$(RUNTIME_PREFIX)usr/bin/readelf
  81. endif
  82. ifeq ($(UCLIBC_HAS_LOCALE),y)
  83. $(INSTALL) -m 755 iconv $(PREFIX)$(RUNTIME_PREFIX)usr/bin/iconv
  84. endif