Makefile 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. # Makefile for uClibc
  2. #
  3. # Copyright (C) 2000 by Lineo, inc.
  4. # Copyright (C) 2000,2001 Erik Andersen <andersen@uclibc.org>
  5. # Copyright (C) 2004 Manuel Novoa III <mjn3@codepoet.org>
  6. #
  7. # This program is free software; you can redistribute it and/or modify it under
  8. # the terms of the GNU Library General Public License as published by the Free
  9. # Software Foundation; either version 2 of the License, or (at your option) any
  10. # later version.
  11. #
  12. # This program is distributed in the hope that it will be useful, but WITHOUT
  13. # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  14. # FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more
  15. # details.
  16. #
  17. # You should have received a copy of the GNU Library General Public License
  18. # along with this program; if not, write to the Free Software Foundation, Inc.,
  19. # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  20. #
  21. # Derived in part from the Linux-8086 C library, the GNU C Library, and several
  22. # other sundry sources. Files within this library are copyright by their
  23. # respective copyright holders.
  24. TOPDIR=../../
  25. include $(TOPDIR)Rules.mak
  26. # Note: The *64.o objects are empty when compiled without large file support.
  27. # SUSv3 functions
  28. CSRC = fclose.c fcloseall.c fdopen.c fgetpos.c fopen.c freopen.c \
  29. fseeko.c fsetpos.c ftello.c getdelim.c getline.c gets.c getw.c \
  30. perror.c puts.c putw.c remove.c rewind.c setbuf.c setbuffer.c \
  31. setlinebuf.c setvbuf.c ungetc.c \
  32. printf.c vprintf.c vsprintf.c fprintf.c snprintf.c dprintf.c \
  33. asprintf.c sprintf.c vasprintf.c vdprintf.c vsnprintf.c \
  34. tmpfile.c tmpnam.c tmpnam_r.c popen.c tempnam.c ctermid.c
  35. # getc -> alias for fgetc
  36. # putc -> alias for fputc
  37. # rename is a syscall
  38. # Implementation support functions
  39. CSRC += _READ.c _WRITE.c _adjust_pos.c _fopen.c _fwrite.c \
  40. _rfill.c _stdio.c _trans2r.c _trans2w.c _wcommit.c \
  41. _cs_funcs.c _load_inttype.c _store_inttype.c _uintmaxtostr.c
  42. ifeq ($(strip $(UCLIBC_HAS_FLOATS)),y)
  43. CSRC += _fpmaxtostr.c
  44. endif
  45. # stdio_ext.h functions
  46. CSRC += __fbufsize.c __flbf.c __fpending.c __fpurge.c __freadable.c \
  47. __freading.c __fsetlocking.c __fwritable.c __fwriting.c _flushlbf.c
  48. # Other glibc extensions
  49. ifeq ($(strip $(UCLIBC_HAS_GLIBC_CUSTOM_STREAMS)),y)
  50. CSRC += fopencookie.c fmemopen.c open_memstream.c
  51. endif
  52. # pthread functions
  53. ifeq ($(strip $(UCLIBC_HAS_THREADS)),y)
  54. CSRC += flockfile.c ftrylockfile.c funlockfile.c
  55. endif
  56. # Functions with unlocked versions
  57. CUSRC = clearerr.c feof.c ferror.c fflush.c fgetc.c fgets.c fileno.c \
  58. fputc.c fputs.c fread.c fwrite.c getchar.c putchar.c
  59. # getc_unlocked -> alias for fgetc_unlocked
  60. # putc_unlocked -> alias for fputc_unlocked
  61. # Largefile functions
  62. CLOBJS = fgetpos64.o fopen64.o freopen64.o fseeko64.o fsetpos64.o ftello64.o
  63. # tmpfile64.o
  64. # vfprintf and support functions
  65. MSRC2= vfprintf.c
  66. ifneq ($(USE_OLD_VFPRINTF),y)
  67. MOBJ2= vfprintf.o \
  68. _ppfs_init.o _ppfs_prepargs.o _ppfs_setargs.o _ppfs_parsespec.o \
  69. register_printf_function.o parse_printf_format.o
  70. else
  71. MOBJ2=
  72. CSRC += old_vfprintf.c
  73. endif
  74. # vfscanf and support functions plus other *scanf funcs
  75. MSRC3= scanf.c
  76. MOBJ3= vfscanf.o __scan_cookie.o __psfs_parse_spec.o __psfs_do_numeric.o \
  77. scanf.o sscanf.o fscanf.o vscanf.o vsscanf.o
  78. MWSRC= wstdio.c
  79. MWOBJ=
  80. CWSRC =
  81. ifeq ($(UCLIBC_HAS_WCHAR),y)
  82. CWSRC += _wfwrite.c fwprintf.c swprintf.c vswprintf.c vwprintf.c wprintf.c \
  83. fwide.c ungetwc.c
  84. CUSRC += fgetwc.c getwchar.c fgetws.c fputwc.c putwchar.c fputws.c
  85. # getwc (fgetwc alias) getwc_unlocked (fgetwc_unlocked alias)
  86. # putwc (fputwc alias) putwc_unlocked (fputwc_unlocked alias)
  87. MOBJ2 += vfwprintf.o
  88. MOBJ3 += wscanf.o swscanf.o fwscanf.o vwscanf.o vswscanf.o vfwscanf.o
  89. endif
  90. CSRC += $(CUSRC)
  91. COBJS = $(patsubst %.c,%.o, $(CSRC))
  92. CUOBJS = $(patsubst %.c,%_unlocked.o, $(CUSRC))
  93. CWOBJS = $(patsubst %.c,%.o, $(CWSRC))
  94. ifeq ($(strip $(UCLIBC_HAS_WCHAR)),y)
  95. COBJS += $(CWOBJS)
  96. endif
  97. OBJS = $(COBJS) $(CUOBJS) $(MOBJ2) $(MOBJ3) $(MWOBJ)
  98. ifeq ($(strip $(UCLIBC_HAS_LFS)),y)
  99. OBJS += $(CLOBJS)
  100. endif
  101. all: $(OBJS) $(LIBC)
  102. $(LIBC): ar-target
  103. ar-target: $(OBJS)
  104. $(AR) $(ARFLAGS) $(LIBC) $(OBJS)
  105. $(COBJS): %.o : %.c
  106. $(CC) $(CFLAGS) -c $< -o $@
  107. $(STRIPTOOL) -x -R .note -R .comment $@
  108. %_unlocked.o : %.c
  109. $(CC) $(CFLAGS) -D__DO_UNLOCKED -c $< -o $@
  110. $(STRIPTOOL) -x -R .note -R .comment $@
  111. %64.o : %.c
  112. $(CC) $(CFLAGS) -D__DO_LARGEFILE -c $< -o $@
  113. $(STRIPTOOL) -x -R .note -R .comment $@
  114. $(MOBJ2): $(MSRC2)
  115. $(CC) $(CFLAGS) -DL_$* $< -c -o $*.o
  116. $(STRIPTOOL) -x -R .note -R .comment $*.o
  117. $(MOBJ3): $(MSRC3)
  118. $(CC) $(CFLAGS) -DL_$* $< -c -o $*.o
  119. $(STRIPTOOL) -x -R .note -R .comment $*.o
  120. $(MWOBJ): $(MWSRC)
  121. $(CC) $(CFLAGS) -DL_$* $< -c -o $*.o
  122. $(STRIPTOOL) -x -R .note -R .comment $*.o
  123. $(OBJ): Makefile
  124. clean:
  125. rm -f *.[oa] *~ core