Makefile 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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. TARGETS = ldd ldconfig readelf
  21. ifeq ($(strip $(UCLIBC_HAS_LOCALE)),y)
  22. TARGET_ICONV = iconv
  23. else
  24. TARGET_ICONV =
  25. endif
  26. # NOTE: We build the utils AFTER we have a uClibc-targeted toolchain.
  27. ifeq ($(strip $(HAVE_SHARED)),y)
  28. all: $(TARGETS) $(TARGET_ICONV)
  29. else
  30. all: $(TARGET_ICONV)
  31. endif
  32. headers:
  33. @$(LN) -fs $(TOPDIR)include/elf.h
  34. readelf: readelf.c
  35. $(CC) $(CFLAGS) -Wl,-s $^ -o $@
  36. $(STRIPTOOL) -x -R .note -R .comment $@
  37. ldconfig: ldconfig.c readsoname.c
  38. $(CC) $(CFLAGS) -Wl,-s -static \
  39. -DUCLIBC_RUNTIME_PREFIX=\"$(RUNTIME_PREFIX)\" \
  40. -DUCLIBC_LDSO=$(UCLIBC_LDSO) -I. -I../ldso/include \
  41. $^ -o $@
  42. $(STRIPTOOL) -x -R .note -R .comment $@
  43. ldd: ldd.c
  44. $(CC) $(CFLAGS) $(PIEFLAG) $(LDPIEFLAG) -Wl,-s \
  45. -DUCLIBC_RUNTIME_PREFIX=\"$(RUNTIME_PREFIX)\" \
  46. -DUCLIBC_LDSO=$(UCLIBC_LDSO) -I. -I../ldso/include \
  47. $^ -o $@
  48. $(STRIPTOOL) -x -R .note -R .comment $@
  49. iconv: ../libc/misc/wchar/wchar.c
  50. $(CC) $(CFLAGS) $(PIEFLAG) $(LDPIEFLAG) -Wl,-s \
  51. -DL_iconv_main \
  52. $^ -o $@
  53. $(STRIPTOOL) -x -R .note -R .comment $@
  54. ifeq ($(strip $(HAVE_SHARED)),y)
  55. hostutils: ldd.host ldconfig.host readelf.host
  56. else
  57. hostutils: readelf.host
  58. endif
  59. ldd.host: ldd.c
  60. $(HOSTCC) $(HOSTCFLAGS) -Wl,-s \
  61. -DUCLIBC_RUNTIME_PREFIX=\"$(RUNTIME_PREFIX)\" \
  62. -DUCLIBC_LDSO=$(UCLIBC_LDSO) -I. -I../ldso/include \
  63. $^ -o $@
  64. ldconfig.host: ldconfig.c readsoname.c
  65. $(HOSTCC) $(HOSTCFLAGS) -Wl,-s \
  66. -DUCLIBC_RUNTIME_PREFIX=\"$(RUNTIME_PREFIX)\" \
  67. -DUCLIBC_LDSO=$(UCLIBC_LDSO) -I. -I../ldso/include \
  68. $^ -o $@
  69. readelf.host: readelf.c
  70. $(HOSTCC) $(HOSTCFLAGS) -Wl,-s $^ -o $@
  71. clean:
  72. $(RM) $(TARGETS) *.o *~ core *.target elf.h iconv *.host
  73. readelf.c readsoname.c ldconfig.c ldd.c: headers
  74. install: all
  75. ifeq ($(strip $(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 ($(strip $(UCLIBC_HAS_LOCALE)),y)
  83. $(INSTALL) -m 755 iconv $(PREFIX)$(RUNTIME_PREFIX)usr/bin/iconv
  84. endif