]> git.ipfire.org Git - thirdparty/glibc.git/blob - stdio/Makefile
initial import
[thirdparty/glibc.git] / stdio / Makefile
1 # Copyright (C) 1991, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
2 # This file is part of the GNU C Library.
3
4 # The GNU C Library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Library General Public License as
6 # published by the Free Software Foundation; either version 2 of the
7 # License, or (at your option) any later version.
8
9 # The GNU C Library is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 # Library General Public License for more details.
13
14 # You should have received a copy of the GNU Library General Public
15 # License along with the GNU C Library; see the file COPYING.LIB. If
16 # not, write to the Free Software Foundation, Inc., 675 Mass Ave,
17 # Cambridge, MA 02139, USA.
18
19 #
20 # Specific makefile for stdio.
21 #
22 subdir := stdio
23
24 headers := stdio.h stdio_lim.h printf.h
25
26 routines := \
27 ctermid cuserid \
28 feof ferror clearerr fileno \
29 newstream fopen freopen fdopen fopncook fmemopen \
30 setbuf setvbuf setbuffer setlinebuf \
31 fseek ftell rewind fgetpos fsetpos \
32 vfprintf vprintf printf_fp reg-printf printf-prs _itoa \
33 vsnprintf vsprintf vasprintf \
34 fprintf printf snprintf sprintf asprintf \
35 dprintf vdprintf \
36 vfscanf vscanf vsscanf \
37 fscanf scanf sscanf \
38 fread fwrite \
39 ungetc \
40 fgetc getc getchar getw \
41 fputc putc putchar putw \
42 fgets gets fputs puts \
43 getdelim getline \
44 perror psignal \
45 tmpfile tmpnam tempnam tempname \
46 fclose fflush \
47 remove rename \
48 memstream obstream \
49 internals sysd-stdio pipestream stdio_init libc_fatal
50
51 # Several mpn functions from GNU MP are used by the printf_fp function.
52 mpn-routines := add_1 add_n addmul_1 cmp divmod divmod_1 udiv_qrnnd \
53 lshift rshift mod_1 mul mul_1 mul_n sub_n submul_1
54 mpn-headers = longlong.h gmp.h gmp-impl.h gmp-mparam.h asm-syntax.h
55
56 routines := $(strip $(routines) $(mpn-routines)) \
57 dbl2mpn ldbl2mpn \
58 mpn2flt mpn2dbl mpn2ldbl
59 aux := errlist siglist defs glue mp_clz_tab fpioconst
60 distribute = $(mpn-headers) gen-mpn-copy _itoa.h fpioconst.h
61
62 tests := tst-printf tstscanf test_rdwr test-popen tstgetln test-fseek \
63 temptest tst-fileno test-fwrite \
64 xbug errnobug \
65 bug1 bug2 bug3 bug4 bug5 bug6 bug7
66
67
68 include ../Rules
69
70
71 ifdef gmp-srcdir
72
73 gmp-srcdir := $(firstword $(filter-out ..//%,$(..)$(gmp-srcdir) $(gmp-srcdir)))
74
75 # Copy the mpn source files we use from the GNU MP source directory.
76 # `gmp-srcdir' is set by doing `configure --with-gmp=DIR'.
77 # (Do not try this at home. You need an as yet unreleased version of GNU MP.)
78
79 mpn-sysdep := $(addsuffix .c,$(mpn-routines)) \
80 $(addsuffix .S,$(mpn-routines)) \
81 $(addsuffix .s,$(mpn-routines)) gmp-mparam.h asm-syntax.h
82
83 mpn-try := $(addprefix $(gmp-srcdir)/mpn/*/,$(mpn-sysdep))
84 mpn-found := $(wildcard $(mpn-try))
85 mpn-found := $(filter-out $(patsubst %.S,%.s,$(filter %.s,$(mpn-found))),\
86 $(mpn-found))
87
88 include mpn-copy.mk
89 %.mk: gen-%; sh $< > $@
90
91 mpn-copy-1 := $(patsubst $(gmp-srcdir)/mpn/%,$(sysdep_dir)/%,$(mpn-found))
92 mpn-copy-sysdep := $(mpn-copy-sysdep) $(mpn-copy-1)
93 $(mpn-copy-1): $(sysdep_dir)/%: $(ignore gmp2glibc.sed) $(gmp-srcdir)/mpn/%
94 $(gmp2glibc)
95
96 mpn-stuff = $(mpn-copy-sysdep) $(mpn-copy)
97
98 # chmod so I don't edit them by mistake.
99 define gmp2glibc
100 $(ignore sed -f $^ > $@-tmp)
101 cp $< $@-tmp
102 chmod a-w $@-tmp
103 mv -f $@-tmp $@
104 endef
105
106 mpn-copy = $(filter-out $(mpn-sysdep),$(mpn-headers) mp_clz_tab.c)
107 $(mpn-copy): %: $(ignore gmp2glibc.sed) $(gmp-srcdir)/%; $(gmp2glibc)
108
109 .PHONY: copy-mpn clean-mpn
110 copy-mpn: $(mpn-stuff)
111 clean-mpn:
112 rm -f $(mpn-stuff)
113
114 endif