Makefile.in 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  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. # SUSv3 functions
  10. CSRC := \
  11. 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. ifeq ($(UCLIBC_HAS_LFS),y)
  19. CSRC += fgetpos64.c fopen64.c freopen64.c fseeko64.c fsetpos64.c ftello64.c
  20. endif
  21. # getc -> alias for fgetc
  22. # putc -> alias for fputc
  23. # rename is a syscall
  24. # Implementation support functions
  25. CSRC += \
  26. _READ.c _WRITE.c _adjust_pos.c _fopen.c _fwrite.c \
  27. _rfill.c _stdio.c _trans2r.c _trans2w.c _wcommit.c \
  28. _cs_funcs.c _load_inttype.c _store_inttype.c _uintmaxtostr.c
  29. ifeq ($(UCLIBC_HAS_FLOATS),y)
  30. CSRC += _fpmaxtostr.c
  31. endif
  32. # stdio_ext.h functions
  33. CSRC += \
  34. __fbufsize.c __flbf.c __fpending.c __fpurge.c __freadable.c \
  35. __freading.c __fsetlocking.c __fwritable.c __fwriting.c _flushlbf.c
  36. # Other glibc extensions
  37. ifeq ($(UCLIBC_HAS_GLIBC_CUSTOM_STREAMS),y)
  38. CSRC += fopencookie.c fmemopen.c open_memstream.c
  39. endif
  40. # pthread functions
  41. CSRC += flockfile.c ftrylockfile.c funlockfile.c
  42. # Functions with unlocked versions
  43. CUSRC := \
  44. clearerr.c feof.c ferror.c fflush.c fgetc.c fgets.c fileno.c \
  45. fputc.c fputs.c fread.c fwrite.c getchar.c putchar.c
  46. # getc_unlocked -> alias for fgetc_unlocked
  47. # putc_unlocked -> alias for fputc_unlocked
  48. # vfprintf and support functions
  49. MSRC1 := vfprintf.c
  50. ifneq ($(USE_OLD_VFPRINTF),y)
  51. MOBJ1 := \
  52. vfprintf.o \
  53. _ppfs_init.o _ppfs_prepargs.o _ppfs_setargs.o _ppfs_parsespec.o \
  54. register_printf_function.o parse_printf_format.o
  55. else
  56. MOBJ1 :=
  57. CSRC += old_vfprintf.c
  58. endif
  59. # vfscanf and support functions plus other *scanf funcs
  60. MSRC2 := scanf.c
  61. MOBJ2 := \
  62. vfscanf.o __scan_cookie.o __psfs_parse_spec.o __psfs_do_numeric.o \
  63. scanf.o sscanf.o fscanf.o vscanf.o vsscanf.o
  64. CWSRC :=
  65. ifeq ($(UCLIBC_HAS_WCHAR),y)
  66. CWSRC += _wfwrite.c fwprintf.c swprintf.c vswprintf.c vwprintf.c wprintf.c \
  67. fwide.c ungetwc.c
  68. CUSRC += fgetwc.c getwchar.c fgetws.c fputwc.c putwchar.c fputws.c
  69. # getwc (fgetwc alias) getwc_unlocked (fgetwc_unlocked alias)
  70. # putwc (fputwc alias) putwc_unlocked (fputwc_unlocked alias)
  71. MOBJ1 += vfwprintf.o
  72. MOBJ2 += wscanf.o swscanf.o fwscanf.o vwscanf.o vswscanf.o vfwscanf.o
  73. endif
  74. CSRC += $(CUSRC) $(CWSRC)
  75. ifneq ($(DOMULTI),n)
  76. STDIO_CSRC_NO_MULTI := fwrite.c fputc.c fputs.c fprintf.c _fpmaxtostr.c
  77. CSRC := $(filter-out $(STDIO_CSRC_NO_MULTI),$(CSRC))
  78. endif
  79. STDIO_MOBJ1_NO_MULTI := vfprintf.o vfwprintf.o register_printf_function.o
  80. STDIO_MOBJ2_NO_MULTI := vfscanf.o vfwscanf.o fscanf.o
  81. STDIO_MOBJ_NO_MULTI := $(STDIO_MOBJ1_NO_MULTI) $(STDIO_MOBJ2_NO_MULTI)
  82. STDIO_DIR := $(top_srcdir)libc/stdio
  83. STDIO_OUT := $(top_builddir)libc/stdio
  84. STDIO_SRC := $(patsubst %.c,$(STDIO_DIR)/%.c,$(CSRC))
  85. STDIO_OBJ := $(patsubst %.c,$(STDIO_OUT)/%.o,$(CSRC))
  86. STDIO_CUSRC := $(patsubst %.c,$(STDIO_DIR)/%.c,$(CUSRC))
  87. STDIO_CUOBJ := $(patsubst %.c,$(STDIO_OUT)/%_unlocked.o,$(CUSRC))
  88. STDIO_MSRC1 := $(patsubst %.c,$(STDIO_DIR)/%.c,$(MSRC1))
  89. STDIO_MSRC2 := $(patsubst %.c,$(STDIO_DIR)/%.c,$(MSRC2))
  90. STDIO_MOBJ1 := $(patsubst %.o,$(STDIO_OUT)/%.o,$(MOBJ1))
  91. STDIO_MOBJ2 := $(patsubst %.o,$(STDIO_OUT)/%.o,$(MOBJ2))
  92. STDIO_MSRC := $(STDIO_MSRC1) $(STDIO_MSRC2)
  93. STDIO_MOBJ := $(STDIO_MOBJ1) $(STDIO_MOBJ2)
  94. STDIO_DEF := $(patsubst %,-DL_%,$(subst .o,,$(filter-out $(STDIO_MOBJ_NO_MULTI),$(notdir $(STDIO_MOBJ)))))
  95. STDIO_OBJS := $(STDIO_OBJ) $(STDIO_MOBJ) $(STDIO_CUOBJ)
  96. STDIO_NO_MULTI := $(STDIO_CUOBJ)
  97. # these need special handling or rewrite to support multi-build
  98. # CUOBJ
  99. %_unlocked.o: %.c
  100. $(compile.c) -D__DO_UNLOCKED
  101. %_unlocked.os: %.c
  102. $(compile.c) -D__DO_UNLOCKED
  103. $(STDIO_MOBJ1): $(STDIO_MSRC1)
  104. $(compile.m)
  105. $(STDIO_MOBJ1:.o=.os): $(STDIO_MSRC1)
  106. $(compile.m)
  107. $(STDIO_MOBJ2): $(STDIO_MSRC2)
  108. $(compile.m)
  109. $(STDIO_MOBJ2:.o=.os): $(STDIO_MSRC2)
  110. $(compile.m)
  111. libc-a-y+=$(STDIO_OBJS)
  112. libc-so-y+=$(STDIO_OBJS:.o=.os)
  113. CFLAGS-multi-y+=$(STDIO_DEF)
  114. libc-multi-y+=$(STDIO_SRC) $(STDIO_MSRC)
  115. libc-nomulti-y+=$(STDIO_NO_MULTI)
  116. libc-nomulti-y+=$(patsubst %.c,$(STDIO_OUT)/%.o,$(STDIO_CSRC_NO_MULTI))
  117. libc-nomulti-y+=$(patsubst %.o,$(STDIO_OUT)/%.o,$(STDIO_MOBJ_NO_MULTI))
  118. objclean-y+=stdio_objclean
  119. stdio_objclean:
  120. $(RM) $(STDIO_OUT)/*.{o,os}