Makefile 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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_builddir)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. headers:
  29. @$(LN) -fs $(top_builddir)include/elf.h
  30. @$(LN) -fs $(top_builddir)include/link.h
  31. readelf.c ldconfig.c ldd.c: headers
  32. readelf: readelf.c
  33. $(CC) $(CFLAGS) $^ -o $@
  34. $(STRIPTOOL) -s -x -R .note -R .comment $@
  35. ifeq ($(UCLIBC_STATIC_LDCONFIG),y)
  36. LDCONFIG_CFLAGS := -static
  37. else
  38. LDCONFIG_CFLAGS := $(PIEFLAG) $(LDPIEFLAG)
  39. endif
  40. ldconfig: ldconfig.c chroot_realpath.c
  41. $(CC) $(CFLAGS) $(LDCONFIG_CFLAGS) \
  42. -DUCLIBC_RUNTIME_PREFIX=\"$(RUNTIME_PREFIX)\" \
  43. -DUCLIBC_LDSO=$(UCLIBC_LDSO) \
  44. $^ -o $@
  45. $(STRIPTOOL) -s -x -R .note -R .comment $@
  46. LDD_CFLAGS := $(PIEFLAG) $(LDPIEFLAG)
  47. ldd: ldd.c
  48. $(CC) $(CFLAGS) $(LDD_CFLAGS) \
  49. -DUCLIBC_RUNTIME_PREFIX=\"$(RUNTIME_PREFIX)\" \
  50. -DUCLIBC_LDSO=$(UCLIBC_LDSO) \
  51. $^ -o $@
  52. $(STRIPTOOL) -s -x -R .note -R .comment $@
  53. ICONV_CFLAGS := $(PIEFLAG) $(LDPIEFLAG)
  54. iconv: $(top_srcdir)libc/misc/wchar/wchar.c
  55. $(CC) $(CFLAGS) $(ICONV_CFLAGS) \
  56. -DL_iconv_main \
  57. $^ -o $@
  58. $(STRIPTOOL) -s -x -R .note -R .comment $@
  59. ifeq ($(HAVE_SHARED),y)
  60. hostutils: ldd.host ldconfig.host readelf.host
  61. else
  62. hostutils: readelf.host
  63. endif
  64. ldd.host: ldd.c
  65. $(HOSTCC) $(HOSTCFLAGS) -Wl,-s \
  66. -DUCLIBC_RUNTIME_PREFIX=\"$(RUNTIME_PREFIX)\" $(HOST_LDSO_CACHE_FLAG) \
  67. -DUCLIBC_LDSO=$(UCLIBC_LDSO) -I. -I$(top_builddir)ldso/include \
  68. $^ -o $@
  69. ldconfig.host: ldconfig.c chroot_realpath.c
  70. $(HOSTCC) $(HOSTCFLAGS) -Wl,-s \
  71. -DUCLIBC_RUNTIME_PREFIX=\"$(RUNTIME_PREFIX)\" $(HOST_LDSO_CACHE_FLAG) \
  72. -DUCLIBC_LDSO=$(UCLIBC_LDSO) -I. -I$(top_builddir)ldso/include \
  73. $^ -o $@
  74. readelf.host: readelf.c
  75. $(HOSTCC) $(HOSTCFLAGS) -Wl,-s $^ -o $@
  76. clean:
  77. $(RM) $(TARGETS) *.o *~ core elf.h link.h readelf iconv *.host
  78. install: all
  79. ifeq ($(HAVE_SHARED),y)
  80. $(INSTALL) -d $(PREFIX)$(RUNTIME_PREFIX)sbin
  81. $(INSTALL) -d $(PREFIX)$(RUNTIME_PREFIX)usr/bin
  82. $(INSTALL) -m 755 ldd $(PREFIX)$(RUNTIME_PREFIX)usr/bin/ldd
  83. $(INSTALL) -m 755 ldconfig $(PREFIX)$(RUNTIME_PREFIX)sbin/ldconfig
  84. #$(INSTALL) -m 755 readelf $(PREFIX)$(RUNTIME_PREFIX)usr/bin/readelf
  85. endif
  86. ifeq ($(UCLIBC_HAS_LOCALE),y)
  87. $(INSTALL) -m 755 iconv $(PREFIX)$(RUNTIME_PREFIX)usr/bin/iconv
  88. endif