Makefile 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. # Makefile for uClibc
  2. #
  3. # Copyright (C) 2000 by Lineo, inc.
  4. # Copyright (C) 2000,2001 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 = $(MALLOC)
  26. ALL_SUBDIRS = malloc malloc-930716 malloc-simple
  27. MSRC = stdlib.c
  28. MOBJ = abs.o labs.o atoi.o atol.o strtol.o strtoul.o _stdlib_strto_l.o \
  29. qsort.o bsearch.o
  30. ifeq ($(HAS_LONG_LONG),true)
  31. MOBJ += llabs.o atoll.o strtoll.o strtoull.o _stdlib_strto_ll.o
  32. endif
  33. ifeq ($(HAS_WCHAR),true)
  34. MOBJ += mblen.o mbtowc.o wctomb.o mbstowcs.o wcstombs.o \
  35. _stdlib_mb_cur_max.o
  36. endif
  37. MSRC2=atexit.c
  38. MOBJ2=atexit.o on_exit.o __exit_handler.o exit.o
  39. CSRC = abort.c getenv.c mktemp.c realpath.c mkstemp.c mkstemp64.c \
  40. rand.c random.c random_r.c setenv.c system.c div.c ldiv.c \
  41. getpt.c ptsname.c grantpt.c unlockpt.c gcvt.c drand48.c \
  42. drand48-iter.c drand48_r.c erand48.c erand48_r.c jrand48.c \
  43. jrand48_r.c lrand48.c lrand48_r.c mrand48.c mrand48_r.c \
  44. nrand48.c nrand48_r.c rand_r.c srand48.c srand48_r.c calloc.c
  45. ifeq ($(HAS_FLOATING_POINT),true)
  46. CSRC += strtod.c strtof.c strtold.c
  47. endif
  48. COBJS=$(patsubst %.c,%.o, $(CSRC))
  49. OBJS=$(MOBJ) $(MOBJ2) $(COBJS)
  50. all: $(OBJS) $(LIBC)
  51. $(LIBC): ar-target subdirs
  52. ar-target: $(OBJS)
  53. $(AR) $(ARFLAGS) $(LIBC) $(OBJS)
  54. $(MOBJ): $(MSRC)
  55. $(CC) $(CFLAGS) -DL_$* $< -c -o $*.o
  56. $(STRIPTOOL) -x -R .note -R .comment $*.o
  57. $(MOBJ2): $(MSRC2)
  58. $(CC) $(CFLAGS) -DL_$* $< -c -o $*.o
  59. $(STRIPTOOL) -x -R .note -R .comment $*.o
  60. $(COBJS): %.o : %.c
  61. $(CC) $(CFLAGS) -c $< -o $@
  62. $(STRIPTOOL) -x -R .note -R .comment $*.o
  63. $(OBJ): Makefile
  64. subdirs: $(patsubst %, _dir_%, $(DIRS))
  65. subdirs_clean: $(patsubst %, _dirclean_%, $(ALL_SUBDIRS))
  66. $(patsubst %, _dir_%, $(DIRS)) : dummy
  67. $(MAKE) -C $(patsubst _dir_%, %, $@)
  68. $(patsubst %, _dirclean_%, $(ALL_SUBDIRS)) : dummy
  69. $(MAKE) -C $(patsubst _dirclean_%, %, $@) clean
  70. clean: subdirs_clean
  71. rm -f *.[oa] *~ core
  72. .PHONY: dummy