Makefile.in 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. # Makefile for uClibc
  2. #
  3. # Copyright (C) 2000 by Lineo, inc.
  4. # Copyright (C) 2004 Manuel Novoa III <mjn3@codepoet.org>
  5. # Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
  6. #
  7. # Licensed under LGPL v2.1, see the file COPYING.LIB in this tarball for details.
  8. #
  9. # Note: The *64.o objects are empty when compiled without large file support.
  10. # SUSv3 functions
  11. CSRC:= fclose.c fcloseall.c fdopen.c fgetpos.c fopen.c freopen.c \
  12. fseeko.c fsetpos.c ftello.c getdelim.c getline.c gets.c getw.c \
  13. perror.c puts.c putw.c remove.c rewind.c setbuf.c setbuffer.c \
  14. setlinebuf.c setvbuf.c ungetc.c \
  15. printf.c vprintf.c vsprintf.c fprintf.c snprintf.c dprintf.c \
  16. asprintf.c sprintf.c vasprintf.c vdprintf.c vsnprintf.c \
  17. tmpfile.c tmpnam.c tmpnam_r.c popen.c tempnam.c ctermid.c
  18. # getc -> alias for fgetc
  19. # putc -> alias for fputc
  20. # rename is a syscall
  21. # Implementation support functions
  22. CSRC+= _READ.c _WRITE.c _adjust_pos.c _fopen.c _fwrite.c \
  23. _rfill.c _stdio.c _trans2r.c _trans2w.c _wcommit.c \
  24. _cs_funcs.c _load_inttype.c _store_inttype.c _uintmaxtostr.c
  25. ifeq ($(UCLIBC_HAS_FLOATS),y)
  26. CSRC+=_fpmaxtostr.c
  27. endif
  28. # stdio_ext.h functions
  29. CSRC+= __fbufsize.c __flbf.c __fpending.c __fpurge.c __freadable.c \
  30. __freading.c __fsetlocking.c __fwritable.c __fwriting.c _flushlbf.c
  31. # Other glibc extensions
  32. ifeq ($(UCLIBC_HAS_GLIBC_CUSTOM_STREAMS),y)
  33. CSRC+=fopencookie.c fmemopen.c open_memstream.c
  34. endif
  35. # pthread functions
  36. CSRC+=flockfile.c ftrylockfile.c funlockfile.c
  37. # Functions with unlocked versions
  38. CUSRC:= clearerr.c feof.c ferror.c fflush.c fgetc.c fgets.c fileno.c \
  39. fputc.c fputs.c fread.c fwrite.c getchar.c putchar.c
  40. # getc_unlocked -> alias for fgetc_unlocked
  41. # putc_unlocked -> alias for fputc_unlocked
  42. # Largefile functions (%64.o)
  43. CLSRC:=
  44. ifeq ($(UCLIBC_HAS_LFS),y)
  45. CLSRC:=fgetpos.c fopen.c freopen.c fseeko.c fsetpos.c ftello.c # tmpfile
  46. endif
  47. # vfprintf and support functions
  48. MSRC1:=vfprintf.c
  49. ifneq ($(USE_OLD_VFPRINTF),y)
  50. MOBJ1:= vfprintf.o \
  51. _ppfs_init.o _ppfs_prepargs.o _ppfs_setargs.o _ppfs_parsespec.o \
  52. register_printf_function.o parse_printf_format.o
  53. else
  54. MOBJ1:=
  55. CSRC+=old_vfprintf.c
  56. endif
  57. # vfscanf and support functions plus other *scanf funcs
  58. MSRC2:=scanf.c
  59. MOBJ2:= vfscanf.o __scan_cookie.o __psfs_parse_spec.o __psfs_do_numeric.o \
  60. scanf.o sscanf.o fscanf.o vscanf.o vsscanf.o
  61. CWSRC:=
  62. ifeq ($(UCLIBC_HAS_WCHAR),y)
  63. CWSRC+=_wfwrite.c fwprintf.c swprintf.c vswprintf.c vwprintf.c wprintf.c \
  64. fwide.c ungetwc.c
  65. CUSRC+=fgetwc.c getwchar.c fgetws.c fputwc.c putwchar.c fputws.c
  66. # getwc (fgetwc alias) getwc_unlocked (fgetwc_unlocked alias)
  67. # putwc (fputwc alias) putwc_unlocked (fputwc_unlocked alias)
  68. MOBJ1+=vfwprintf.o
  69. MOBJ2+=wscanf.o swscanf.o fwscanf.o vwscanf.o vswscanf.o vfwscanf.o
  70. endif
  71. CSRC+=$(CUSRC) $(CWSRC)
  72. ifneq ($(DOMULTI),n)
  73. STDIO_CSRC_NO_MULTI:=fwrite.c fputc.c fputs.c fprintf.c _fpmaxtostr.c
  74. CSRC:=$(filter-out $(STDIO_CSRC_NO_MULTI),$(CSRC))
  75. endif
  76. STDIO_MOBJ1_NO_MULTI:=vfprintf.o vfwprintf.o register_printf_function.o
  77. STDIO_MOBJ2_NO_MULTI:=vfscanf.o vfwscanf.o fscanf.o
  78. STDIO_MOBJ_NO_MULTI:=$(STDIO_MOBJ1_NO_MULTI) $(STDIO_MOBJ2_NO_MULTI)
  79. STDIO_DIR:=$(top_srcdir)libc/stdio
  80. STDIO_OUT:=$(top_builddir)libc/stdio
  81. STDIO_SRC:=$(patsubst %.c,$(STDIO_DIR)/%.c,$(CSRC))
  82. STDIO_OBJ:=$(patsubst %.c,$(STDIO_OUT)/%.o,$(CSRC))
  83. STDIO_CUSRC:=$(patsubst %.c,$(STDIO_DIR)/%.c,$(CUSRC))
  84. STDIO_CUOBJ:=$(patsubst %.c,$(STDIO_OUT)/%_unlocked.o,$(CUSRC))
  85. STDIO_CLSRC:=$(patsubst %.c,$(STDIO_OUT)/%64.c,$(CLSRC))
  86. STDIO_CLOBJ:=$(patsubst %.c,$(STDIO_OUT)/%64.o,$(CLSRC))
  87. STDIO_MSRC1:=$(patsubst %.c,$(STDIO_DIR)/%.c,$(MSRC1))
  88. STDIO_MSRC2:=$(patsubst %.c,$(STDIO_DIR)/%.c,$(MSRC2))
  89. STDIO_MOBJ1:=$(patsubst %.o,$(STDIO_OUT)/%.o,$(MOBJ1))
  90. STDIO_MOBJ2:=$(patsubst %.o,$(STDIO_OUT)/%.o,$(MOBJ2))
  91. STDIO_MSRC:=$(STDIO_MSRC1) $(STDIO_MSRC2)
  92. STDIO_MOBJ:=$(STDIO_MOBJ1) $(STDIO_MOBJ2)
  93. STDIO_DEF:=$(patsubst %,-DL_%,$(subst .o,,$(filter-out $(STDIO_MOBJ_NO_MULTI),$(notdir $(STDIO_MOBJ)))))
  94. STDIO_OBJS:=$(STDIO_OBJ) $(STDIO_MOBJ) $(STDIO_CUOBJ) $(STDIO_CLOBJ)
  95. STDIO_NO_MULTI:=$(STDIO_CUOBJ) $(STDIO_CLOBJ)
  96. # these need special handling or rewrite to support multi-build
  97. # CUOBJ
  98. %_unlocked.o: %.c
  99. $(compile.c) -D__DO_UNLOCKED
  100. %_unlocked.os: %.c
  101. $(compile.c) -D__DO_UNLOCKED
  102. # need this, else the other %64 files will get false rules
  103. $(STDIO_CLSRC): $(STDIO_OUT)/%64.c : $(STDIO_DIR)/%.c
  104. @cp $< $@
  105. $(STDIO_CLOBJ): %.o : %.c
  106. $(compile.c) -D__DO_LARGEFILE
  107. $(STDIO_CLOBJ:.o=.os): %.os : %.c
  108. $(compile.c) -D__DO_LARGEFILE
  109. $(STDIO_MOBJ1): $(STDIO_MSRC1)
  110. $(compile.m)
  111. $(STDIO_MOBJ1:.o=.os): $(STDIO_MSRC1)
  112. $(compile.m)
  113. $(STDIO_MOBJ2): $(STDIO_MSRC2)
  114. $(compile.m)
  115. $(STDIO_MOBJ2:.o=.os): $(STDIO_MSRC2)
  116. $(compile.m)
  117. libc-a-y+=$(STDIO_OBJS)
  118. libc-so-y+=$(STDIO_OBJS:.o=.os)
  119. CFLAGS-multi-y+=$(STDIO_DEF)
  120. libc-multi-y+=$(STDIO_SRC) $(STDIO_MSRC)
  121. libc-nomulti-y+=$(STDIO_NO_MULTI)
  122. libc-nomulti-y+=$(patsubst %.c,$(STDIO_OUT)/%.o,$(STDIO_CSRC_NO_MULTI))
  123. libc-nomulti-y+=$(patsubst %.o,$(STDIO_OUT)/%.o,$(STDIO_MOBJ_NO_MULTI))
  124. objclean-y+=stdio_objclean
  125. stdio_objclean:
  126. $(RM) $(STDIO_OUT)/*.{o,os} $(STDIO_OUT)/*64.c