blob: ff77bcb6a2e10b74a6ff4408fbcb2513141869f4 [file] [log] [blame]
lh9ed821d2023-04-07 01:36:19 -07001# Makefile for uClibc
2#
3# Copyright (C) 2004 Manuel Novoa III <mjn3@uclibc.org>
4# Copyright (C) 2000-2008 Erik Andersen <andersen@uclibc.org>
5#
6# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
7#
8# Dedicated to Toni. See uClibc/DEDICATION.mjn3 for details.
9#
10
11subdirs += libc/stdio
12
13# SUSv3 functions
14CSRC := \
15 fclose.c fcloseall.c fdopen.c fgetpos.c fopen.c freopen.c \
16 fseeko.c fsetpos.c ftello.c getdelim.c getline.c gets.c getw.c \
17 perror.c puts.c putw.c remove.c rewind.c setbuf.c setbuffer.c \
18 setlinebuf.c setvbuf.c ungetc.c \
19 printf.c vprintf.c vsprintf.c fprintf.c snprintf.c dprintf.c \
20 asprintf.c sprintf.c vasprintf.c vdprintf.c vsnprintf.c \
21 tmpfile.c popen.c ctermid.c
22
23ifeq ($(UCLIBC_HAS_LFS),y)
24CSRC += fgetpos64.c fopen64.c freopen64.c fseeko64.c fsetpos64.c ftello64.c
25endif
26ifeq ($(UCLIBC_SUSV4_LEGACY),y)
27CSRC += tmpnam.c tmpnam_r.c tempnam.c
28endif
29
30# getc -> alias for fgetc
31# putc -> alias for fputc
32# rename is a syscall
33
34# Implementation support functions
35CSRC += \
36 _READ.c _WRITE.c _adjust_pos.c _fopen.c _fwrite.c \
37 _rfill.c _stdio.c _trans2r.c _trans2w.c _wcommit.c \
38 _cs_funcs.c _load_inttype.c _store_inttype.c _uintmaxtostr.c
39ifeq ($(UCLIBC_HAS_FLOATS),y)
40CSRC += _fpmaxtostr.c
41endif
42
43# stdio_ext.h functions
44CSRC += \
45 __fbufsize.c __flbf.c __fpending.c __fpurge.c __freadable.c \
46 __freading.c __fsetlocking.c __fwritable.c __fwriting.c _flushlbf.c
47
48# Other glibc extensions
49ifeq ($(UCLIBC_HAS_GLIBC_CUSTOM_STREAMS),y)
50CSRC += fopencookie.c fmemopen.c open_memstream.c
51endif
52
53# pthread functions
54CSRC += flockfile.c ftrylockfile.c funlockfile.c
55
56# Functions with unlocked versions
57CUSRC := \
58 clearerr.c feof.c ferror.c fflush.c fgetc.c fgets.c fileno.c \
59 fputc.c fputs.c fread.c fwrite.c getchar.c putchar.c
60# getc_unlocked -> alias for fgetc_unlocked
61# putc_unlocked -> alias for fputc_unlocked
62
63# vfprintf and support functions
64ifneq ($(USE_OLD_VFPRINTF),y)
65VF_CSRC := \
66 vfprintf.c \
67 _vfprintf_internal.c \
68 _ppfs_init.c _ppfs_prepargs.c _ppfs_setargs.c _ppfs_parsespec.c \
69 register_printf_function.c parse_printf_format.c
70CSRC += $(VF_CSRC)
71else
72CSRC += old_vfprintf.c
73endif
74
75# vfscanf and support functions plus other *scanf funcs
76CSRC += \
77 vfscanf.c __scan_cookie.c __psfs_parse_spec.c __psfs_do_numeric.c \
78 scanf.c sscanf.c fscanf.c vscanf.c vsscanf.c
79
80ifeq ($(UCLIBC_HAS_WCHAR),y)
81CSRC += _wfwrite.c fwprintf.c swprintf.c vswprintf.c vwprintf.c wprintf.c \
82 fwide.c ungetwc.c
83CUSRC += fgetwc.c getwchar.c fgetws.c fputwc.c putwchar.c fputws.c
84# getwc (fgetwc alias) getwc_unlocked (fgetwc_unlocked alias)
85# putwc (fputwc alias) putwc_unlocked (fputwc_unlocked alias)
86CSRC += vfwprintf.c _vfwprintf_internal.c
87CSRC += wscanf.c swscanf.c fwscanf.c vwscanf.c vswscanf.c vfwscanf.c
88endif
89
90CUSRC_UNLOCKED := $(patsubst %.c,%_unlocked.c,$(CUSRC))
91
92CSRC += $(CUSRC) $(CUSRC_UNLOCKED)
93
94STDIO_DIR := $(top_srcdir)libc/stdio
95STDIO_OUT := $(top_builddir)libc/stdio
96
97STDIO_SRC := $(patsubst %.c,$(STDIO_DIR)/%.c,$(CSRC))
98STDIO_OBJ := $(patsubst %.c,$(STDIO_OUT)/%.o,$(CSRC))
99
100libc-y += $(STDIO_OBJ)
101
102ifneq ($(USE_OLD_VFPRINTF),y)
103libc-nomulti-y += $(patsubst %.c,$(STDIO_OUT)/%.o,$(VF_CSRC))
104endif
105ifeq ($(UCLIBC_HAS_WCHAR),y)
106libc-nomulti-y += $(STDIO_OUT)/vfwprintf.o $(STDIO_OUT)/vfwscanf.o
107endif
108
109objclean-y += CLEAN_libc/stdio
110
111CLEAN_libc/stdio:
112 $(do_rm) $(addprefix $(STDIO_OUT)/*., o os oS)