Makefile 2.6 KB

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