Makefile 3.3 KB

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