Makefile 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. # Makefile for uClibc
  2. #
  3. # Copyright (C) 2000 by Lineo, inc.
  4. # Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
  5. #
  6. # This program is free software; you can redistribute it and/or modify it under
  7. # the terms of the GNU Library General Public License as published by the Free
  8. # Software Foundation; either version 2 of the License, or (at your option) any
  9. # later version.
  10. #
  11. # This program is distributed in the hope that it will be useful, but WITHOUT
  12. # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  13. # FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more
  14. # details.
  15. #
  16. # You should have received a copy of the GNU Library General Public License
  17. # along with this program; if not, write to the Free Software Foundation, Inc.,
  18. # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  19. #
  20. # Derived in part from the Linux-8086 C library, the GNU C Library, and several
  21. # other sundry sources. Files within this library are copyright by their
  22. # respective copyright holders.
  23. TOPDIR=../../
  24. include $(TOPDIR)Rules.mak
  25. DIRS =
  26. ifeq ($(MALLOC),y)
  27. DIRS += malloc
  28. endif
  29. ifeq ($(MALLOC_SIMPLE),y)
  30. DIRS += malloc-simple
  31. endif
  32. ifeq ($(MALLOC_STANDARD),y)
  33. DIRS += malloc-standard
  34. endif
  35. MSRC := stdlib.c
  36. MOBJ = abs.o labs.o atoi.o atol.o strtol.o strtoul.o _stdlib_strto_l.o \
  37. qsort.o bsearch.o \
  38. llabs.o atoll.o strtoll.o strtoull.o _stdlib_strto_ll.o
  39. # (aliases) strtoq.o strtouq.o
  40. ifeq ($(UCLIBC_HAS_XLOCALE),y)
  41. MOBJx = strtol_l.o strtoul_l.o _stdlib_strto_l_l.o \
  42. strtoll_l.o strtoull_l.o _stdlib_strto_ll_l.o
  43. endif
  44. MSRC1 := strtod.c
  45. MOBJ1 =
  46. MOBJ1x =
  47. ifeq ($(UCLIBC_HAS_FLOATS),y)
  48. MOBJ += atof.o
  49. MOBJ1 += strtod.o strtof.o strtold.o __strtofpmax.o __fp_range_check.o
  50. ifeq ($(UCLIBC_HAS_XLOCALE),y)
  51. MOBJ1x += strtod_l.o strtof_l.o strtold_l.o __strtofpmax_l.o
  52. endif
  53. ifeq ($(UCLIBC_HAS_WCHAR),y)
  54. MOBJ1 += wcstod.o wcstof.o wcstold.o __wcstofpmax.o
  55. ifeq ($(UCLIBC_HAS_XLOCALE),y)
  56. MOBJ1x += wcstod_l.o wcstof_l.o wcstold_l.o __wcstofpmax_l.o
  57. endif
  58. endif
  59. endif
  60. ifeq ($(UCLIBC_HAS_WCHAR),y)
  61. MOBJ += mblen.o mbtowc.o wctomb.o mbstowcs.o wcstombs.o \
  62. _stdlib_mb_cur_max.o _stdlib_wcsto_l.o _stdlib_wcsto_ll.o \
  63. wcstol.o wcstoul.o wcstoll.o wcstoull.o
  64. ifeq ($(UCLIBC_HAS_XLOCALE),y)
  65. MOBJx += _stdlib_wcsto_l_l.o _stdlib_wcsto_ll_l.o \
  66. wcstol_l.o wcstoul_l.o wcstoll_l.o wcstoull_l.o
  67. endif
  68. endif
  69. # (aliases) wcstoq.o wcstouq.o
  70. # wcstod wcstof wcstold
  71. MSRC2 := atexit.c
  72. MOBJ2 = on_exit.o __cxa_atexit.o __cxa_finalize.o __exit_handler.o exit.o
  73. ifeq ($(COMPAT_ATEXIT),y)
  74. MOBJ2 += old_atexit.o
  75. endif
  76. CSRC = \
  77. abort.c getenv.c mkdtemp.c mktemp.c realpath.c mkstemp.c mkstemp64.c \
  78. rand.c random.c random_r.c setenv.c system.c div.c ldiv.c lldiv.c \
  79. getpt.c ptsname.c grantpt.c unlockpt.c gcvt.c drand48-iter.c jrand48.c \
  80. jrand48_r.c lrand48.c lrand48_r.c mrand48.c mrand48_r.c nrand48.c \
  81. nrand48_r.c rand_r.c srand48.c srand48_r.c seed48.c seed48_r.c \
  82. valloc.c posix_memalign.c a64l.c l64a.c
  83. ifeq ($(UCLIBC_HAS_FLOATS),y)
  84. CSRC += drand48.c drand48_r.c erand48.c erand48_r.c
  85. endif
  86. COBJ := $(patsubst %.c,%.o, $(CSRC))
  87. OBJS := $(MOBJ) $(MOBJx) $(MOBJ1) $(MOBJ1x) $(MOBJ2) $(COBJ)
  88. NONSHARED_OBJS := atexit.o
  89. OBJ_LIST := ../obj.stdlib
  90. NONSHARED_OBJ_LIST := ../nonshared_obj.stdlib
  91. all: $(OBJ_LIST) $(NONSHARED_OBJ_LIST) subdirs
  92. $(OBJ_LIST): $(OBJS)
  93. $(STRIPTOOL) -x -R .note -R .comment $^
  94. echo $(patsubst %, stdlib/%, $^) > $@
  95. $(NONSHARED_OBJ_LIST): $(NONSHARED_OBJS)
  96. $(STRIPTOOL) -x -R .note -R .comment $^
  97. echo $(patsubst %, stdlib/%, $^) > $@
  98. $(MOBJ): $(MSRC)
  99. $(CC) $(CFLAGS) -DL_$* $< -c -o $*.o
  100. $(MOBJx): $(MSRC)
  101. $(CC) $(CFLAGS) -DL_$* -D__UCLIBC_DO_XLOCALE $< -c -o $*.o
  102. $(MOBJ1): $(MSRC1)
  103. $(CC) $(CFLAGS) -DL_$* $< -c -o $*.o
  104. $(MOBJ1x): $(MSRC1)
  105. $(CC) $(CFLAGS) -DL_$* -D__UCLIBC_DO_XLOCALE $< -c -o $*.o
  106. $(MOBJ2) atexit.o: $(MSRC2)
  107. $(CC) $(CFLAGS) -DL_$* $< -c -o $*.o
  108. $(COBJ): %.o : %.c
  109. $(CC) $(CFLAGS) -c $< -o $@
  110. subdirs: $(patsubst %, _dir_%, $(DIRS))
  111. subdirs_clean: $(patsubst %, _dirclean_%, $(ALL_SUBDIRS))
  112. $(patsubst %, _dir_%, $(DIRS)) : dummy
  113. $(MAKE) -C $(patsubst _dir_%, %, $@)
  114. $(patsubst %, _dirclean_%, $(ALL_SUBDIRS)) : dummy
  115. $(MAKE) -C $(patsubst _dirclean_%, %, $@) clean
  116. clean: subdirs_clean
  117. $(RM) *.o *~ core
  118. .PHONY: dummy