summaryrefslogtreecommitdiff
path: root/libc/stdio/Makefile.in
blob: a2b4aac8781d83f80c7f059075743344e3a580ec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
# Makefile for uClibc
#
# Copyright (C) 2000 by Lineo, inc.
# Copyright (C) 2004 Manuel Novoa III <mjn3@codepoet.org>
# Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
#
# Licensed under LGPL v2.1, see the file COPYING.LIB in this tarball for details.
#

# Note: The *64.o objects are empty when compiled without large file support.

# SUSv3 functions
CSRC:=	fclose.c fcloseall.c fdopen.c fgetpos.c fopen.c freopen.c \
	fseeko.c fsetpos.c ftello.c getdelim.c getline.c gets.c getw.c \
	perror.c puts.c putw.c remove.c rewind.c setbuf.c setbuffer.c \
	setlinebuf.c setvbuf.c ungetc.c \
	printf.c vprintf.c vsprintf.c fprintf.c snprintf.c dprintf.c \
	asprintf.c sprintf.c vasprintf.c vdprintf.c vsnprintf.c \
	tmpfile.c tmpnam.c tmpnam_r.c popen.c tempnam.c ctermid.c

# getc -> alias for fgetc
# putc -> alias for fputc
# rename is a syscall

# Implementation support functions
CSRC+=	_READ.c _WRITE.c _adjust_pos.c _fopen.c _fwrite.c \
	_rfill.c _stdio.c _trans2r.c _trans2w.c _wcommit.c \
	_cs_funcs.c _load_inttype.c _store_inttype.c _uintmaxtostr.c
ifeq ($(UCLIBC_HAS_FLOATS),y)
CSRC+=_fpmaxtostr.c
endif

# stdio_ext.h functions
CSRC+=	__fbufsize.c __flbf.c __fpending.c __fpurge.c __freadable.c \
	__freading.c __fsetlocking.c __fwritable.c __fwriting.c _flushlbf.c

# Other glibc extensions
ifeq ($(UCLIBC_HAS_GLIBC_CUSTOM_STREAMS),y)
CSRC+=fopencookie.c fmemopen.c open_memstream.c
endif

# pthread functions
CSRC+=flockfile.c ftrylockfile.c funlockfile.c

# Functions with unlocked versions
CUSRC:=	clearerr.c feof.c ferror.c fflush.c fgetc.c fgets.c fileno.c \
	fputc.c fputs.c fread.c fwrite.c getchar.c putchar.c
# getc_unlocked -> alias for fgetc_unlocked
# putc_unlocked -> alias for fputc_unlocked

# Largefile functions (%64.o)
CLSRC:=
ifeq ($(UCLIBC_HAS_LFS),y)
CLSRC:=fgetpos.c fopen.c freopen.c fseeko.c fsetpos.c ftello.c # tmpfile
endif

# vfprintf and support functions
MSRC1:=vfprintf.c
ifneq ($(USE_OLD_VFPRINTF),y)
MOBJ1:=	vfprintf.o \
	_ppfs_init.o _ppfs_prepargs.o _ppfs_setargs.o _ppfs_parsespec.o \
	register_printf_function.o parse_printf_format.o
else
MOBJ1:=
CSRC+=old_vfprintf.c
endif

# vfscanf and support functions plus other *scanf funcs
MSRC2:=scanf.c
MOBJ2:=	vfscanf.o __scan_cookie.o __psfs_parse_spec.o __psfs_do_numeric.o \
	scanf.o sscanf.o fscanf.o vscanf.o vsscanf.o

CWSRC:=
ifeq ($(UCLIBC_HAS_WCHAR),y)
CWSRC+=_wfwrite.c fwprintf.c swprintf.c vswprintf.c vwprintf.c wprintf.c \
	fwide.c ungetwc.c
CUSRC+=fgetwc.c getwchar.c fgetws.c fputwc.c putwchar.c fputws.c
# getwc (fgetwc alias) getwc_unlocked (fgetwc_unlocked alias)
# putwc (fputwc alias) putwc_unlocked (fputwc_unlocked alias)
MOBJ1+=vfwprintf.o
MOBJ2+=wscanf.o swscanf.o fwscanf.o vwscanf.o vswscanf.o vfwscanf.o
endif

CSRC+=$(CUSRC) $(CWSRC)

STDIO_DIR:=$(top_srcdir)libc/stdio
STDIO_OUT:=$(top_builddir)libc/stdio

STDIO_SRC:=$(patsubst %.c,$(STDIO_DIR)/%.c,$(CSRC))
STDIO_OBJ:=$(patsubst %.c,$(STDIO_OUT)/%.o,$(CSRC))
STDIO_CUSRC:=$(patsubst %.c,$(STDIO_DIR)/%.c,$(CUSRC))
STDIO_CUOBJ:=$(patsubst %.c,$(STDIO_OUT)/%_unlocked.o,$(CUSRC))
STDIO_CLSRC:=$(patsubst %.c,$(STDIO_OUT)/%64.c,$(CLSRC))
STDIO_CLOBJ:=$(patsubst %.c,$(STDIO_OUT)/%64.o,$(CLSRC))

STDIO_MSRC1:=$(patsubst %.c,$(STDIO_DIR)/%.c,$(MSRC1))
STDIO_MSRC2:=$(patsubst %.c,$(STDIO_DIR)/%.c,$(MSRC2))
STDIO_MOBJ1:=$(patsubst %.o,$(STDIO_OUT)/%.o,$(MOBJ1))
STDIO_MOBJ2:=$(patsubst %.o,$(STDIO_OUT)/%.o,$(MOBJ2))

STDIO_MSRC:=$(STDIO_MSRC1) $(STDIO_MSRC2)
STDIO_MOBJ:=$(STDIO_MOBJ1) $(STDIO_MOBJ2)

#STDIO_DEF:=$(patsubst %,-DL_%,$(subst .o,,$(notdir $(STDIO_MOBJ))))

STDIO_OBJS:=$(STDIO_OBJ) $(STDIO_MOBJ) $(STDIO_CUOBJ) $(STDIO_CLOBJ)

#STDIO_NO_MULTI:=$(STDIO_CUOBJ) $(STDIO_CLOBJ)

# these need special handling or rewrite to support multi-build
# CUOBJ
%_unlocked.o %_unlocked.os: %.c
	$(compile.c) -D__DO_UNLOCKED

# need this, else the other %64 files will get false rules
$(STDIO_CLSRC): $(STDIO_OUT)/%64.c : $(STDIO_DIR)/%.c
	cp $< $@

$(STDIO_CLOBJ): %.o : %.c
	$(compile.c) -D__DO_LARGEFILE

$(STDIO_CLOBJ:.o=.os): %.os : %.c
	$(compile.c) -D__DO_LARGEFILE

$(STDIO_MOBJ1) $(STDIO_MOBJ1:.o=.os): $(STDIO_MSRC1)
	$(compile.m)

$(STDIO_MOBJ2) $(STDIO_MOBJ2:.o=.os): $(STDIO_MSRC2)
	$(compile.m)

libc-a-y+=$(STDIO_OBJS)
libc-so-y+=$(STDIO_OBJS:.o=.os)

#CFLAGS-multi-y+=$(STDIO_DEF)
#libc-multi-y+=$(STDIO_SRC) $(STDIO_MSRC)
#libc-nomulti-y+=$(STDIO_NO_MULTI)
libc-nomulti-y+=$(STDIO_OBJS)

objclean-y+=stdio_objclean

stdio_objclean:
	$(RM) $(STDIO_OUT)/*.{o,os}