lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame^] | 1 | # 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 | |
| 11 | subdirs += libc/stdio |
| 12 | |
| 13 | # SUSv3 functions |
| 14 | CSRC := \ |
| 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 | |
| 23 | ifeq ($(UCLIBC_HAS_LFS),y) |
| 24 | CSRC += fgetpos64.c fopen64.c freopen64.c fseeko64.c fsetpos64.c ftello64.c |
| 25 | endif |
| 26 | ifeq ($(UCLIBC_SUSV4_LEGACY),y) |
| 27 | CSRC += tmpnam.c tmpnam_r.c tempnam.c |
| 28 | endif |
| 29 | |
| 30 | # getc -> alias for fgetc |
| 31 | # putc -> alias for fputc |
| 32 | # rename is a syscall |
| 33 | |
| 34 | # Implementation support functions |
| 35 | CSRC += \ |
| 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 |
| 39 | ifeq ($(UCLIBC_HAS_FLOATS),y) |
| 40 | CSRC += _fpmaxtostr.c |
| 41 | endif |
| 42 | |
| 43 | # stdio_ext.h functions |
| 44 | CSRC += \ |
| 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 |
| 49 | ifeq ($(UCLIBC_HAS_GLIBC_CUSTOM_STREAMS),y) |
| 50 | CSRC += fopencookie.c fmemopen.c open_memstream.c |
| 51 | endif |
| 52 | |
| 53 | # pthread functions |
| 54 | CSRC += flockfile.c ftrylockfile.c funlockfile.c |
| 55 | |
| 56 | # Functions with unlocked versions |
| 57 | CUSRC := \ |
| 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 |
| 64 | ifneq ($(USE_OLD_VFPRINTF),y) |
| 65 | VF_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 |
| 70 | CSRC += $(VF_CSRC) |
| 71 | else |
| 72 | CSRC += old_vfprintf.c |
| 73 | endif |
| 74 | |
| 75 | # vfscanf and support functions plus other *scanf funcs |
| 76 | CSRC += \ |
| 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 | |
| 80 | ifeq ($(UCLIBC_HAS_WCHAR),y) |
| 81 | CSRC += _wfwrite.c fwprintf.c swprintf.c vswprintf.c vwprintf.c wprintf.c \ |
| 82 | fwide.c ungetwc.c |
| 83 | CUSRC += 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) |
| 86 | CSRC += vfwprintf.c _vfwprintf_internal.c |
| 87 | CSRC += wscanf.c swscanf.c fwscanf.c vwscanf.c vswscanf.c vfwscanf.c |
| 88 | endif |
| 89 | |
| 90 | CUSRC_UNLOCKED := $(patsubst %.c,%_unlocked.c,$(CUSRC)) |
| 91 | |
| 92 | CSRC += $(CUSRC) $(CUSRC_UNLOCKED) |
| 93 | |
| 94 | STDIO_DIR := $(top_srcdir)libc/stdio |
| 95 | STDIO_OUT := $(top_builddir)libc/stdio |
| 96 | |
| 97 | STDIO_SRC := $(patsubst %.c,$(STDIO_DIR)/%.c,$(CSRC)) |
| 98 | STDIO_OBJ := $(patsubst %.c,$(STDIO_OUT)/%.o,$(CSRC)) |
| 99 | |
| 100 | libc-y += $(STDIO_OBJ) |
| 101 | |
| 102 | ifneq ($(USE_OLD_VFPRINTF),y) |
| 103 | libc-nomulti-y += $(patsubst %.c,$(STDIO_OUT)/%.o,$(VF_CSRC)) |
| 104 | endif |
| 105 | ifeq ($(UCLIBC_HAS_WCHAR),y) |
| 106 | libc-nomulti-y += $(STDIO_OUT)/vfwprintf.o $(STDIO_OUT)/vfwscanf.o |
| 107 | endif |
| 108 | |
| 109 | objclean-y += CLEAN_libc/stdio |
| 110 | |
| 111 | CLEAN_libc/stdio: |
| 112 | $(do_rm) $(addprefix $(STDIO_OUT)/*., o os oS) |