Makefile 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  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 ($(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 ($(UCLIBC_HAS_GLIBC_CUSTOM_STREAMS),y)
  50. CSRC += fopencookie.c fmemopen.c open_memstream.c
  51. endif
  52. # pthread functions
  53. CSRC += flockfile.c ftrylockfile.c funlockfile.c
  54. # Functions with unlocked versions
  55. CUSRC = clearerr.c feof.c ferror.c fflush.c fgetc.c fgets.c fileno.c \
  56. fputc.c fputs.c fread.c fwrite.c getchar.c putchar.c
  57. # getc_unlocked -> alias for fgetc_unlocked
  58. # putc_unlocked -> alias for fputc_unlocked
  59. # Largefile functions
  60. CLOBJS = fgetpos64.o fopen64.o freopen64.o fseeko64.o fsetpos64.o ftello64.o
  61. # tmpfile64.o
  62. # vfprintf and support functions
  63. MSRC2= vfprintf.c
  64. ifneq ($(USE_OLD_VFPRINTF),y)
  65. MOBJ2= vfprintf.o \
  66. _ppfs_init.o _ppfs_prepargs.o _ppfs_setargs.o _ppfs_parsespec.o \
  67. register_printf_function.o parse_printf_format.o
  68. else
  69. MOBJ2=
  70. CSRC += old_vfprintf.c
  71. endif
  72. # vfscanf and support functions plus other *scanf funcs
  73. MSRC3= scanf.c
  74. MOBJ3= vfscanf.o __scan_cookie.o __psfs_parse_spec.o __psfs_do_numeric.o \
  75. scanf.o sscanf.o fscanf.o vscanf.o vsscanf.o
  76. MWSRC= wstdio.c
  77. MWOBJ=
  78. CWSRC =
  79. ifeq ($(UCLIBC_HAS_WCHAR),y)
  80. CWSRC += _wfwrite.c fwprintf.c swprintf.c vswprintf.c vwprintf.c wprintf.c \
  81. fwide.c ungetwc.c
  82. CUSRC += fgetwc.c getwchar.c fgetws.c fputwc.c putwchar.c fputws.c
  83. # getwc (fgetwc alias) getwc_unlocked (fgetwc_unlocked alias)
  84. # putwc (fputwc alias) putwc_unlocked (fputwc_unlocked alias)
  85. MOBJ2 += vfwprintf.o
  86. MOBJ3 += wscanf.o swscanf.o fwscanf.o vwscanf.o vswscanf.o vfwscanf.o
  87. endif
  88. CSRC += $(CUSRC)
  89. COBJ = $(patsubst %.c,%.o, $(CSRC))
  90. CUOBJS = $(patsubst %.c,%_unlocked.o, $(CUSRC))
  91. CWOBJS = $(patsubst %.c,%.o, $(CWSRC))
  92. ifeq ($(UCLIBC_HAS_WCHAR),y)
  93. COBJ += $(CWOBJS)
  94. endif
  95. OBJS = $(COBJ) $(CUOBJS) $(MOBJ2) $(MOBJ3) $(MWOBJ)
  96. ifeq ($(UCLIBC_HAS_LFS),y)
  97. OBJS += $(CLOBJS)
  98. endif
  99. ifeq ($(UCLIBC_HAS_THREADS),y)
  100. CFLAGS += $(PTINC)
  101. endif
  102. OBJ_LIST := ../obj.stdio
  103. all: $(OBJ_LIST)
  104. $(OBJ_LIST): $(OBJS)
  105. $(STRIPTOOL) -x -R .note -R .comment $^
  106. echo $(patsubst %, stdio/%, $^) > $@
  107. $(COBJ): %.o : %.c
  108. $(CC) $(CFLAGS) -c $< -o $@
  109. %_unlocked.o : %.c
  110. $(CC) $(CFLAGS) -D__DO_UNLOCKED -c $< -o $@
  111. %64.o : %.c
  112. $(CC) $(CFLAGS) -D__DO_LARGEFILE -c $< -o $@
  113. $(MOBJ2): $(MSRC2)
  114. $(CC) $(CFLAGS) -DL_$* $< -c -o $*.o
  115. $(MOBJ3): $(MSRC3)
  116. $(CC) $(CFLAGS) -DL_$* $< -c -o $*.o
  117. $(MWOBJ): $(MWSRC)
  118. $(CC) $(CFLAGS) -DL_$* $< -c -o $*.o
  119. clean:
  120. $(RM) *.o *~ core