Makefile.in 5.0 KB

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