Makefile 3.1 KB

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