summaryrefslogtreecommitdiff
path: root/Makefile.cfg
blob: 4a002d5440757a66b9d1f9c6f014291faae64454 (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
# -*- makefile -*-
## Customize Makefile.maint.

move_if_change = move-if-change

# List the hosts to which test releases are copied.
# `a' and `b' are merely placeholders, and correspond to the
# `a_' and `b_' prefixes of the following variables.
hosts = a b
a_host = alpha.gnu.org
b_host = freefriends.org

alpha_subdir = gnu/fetish
a_url_dir = $(alpha_subdir)
b_url_dir = $(alpha_subdir)

# Files that `make wget-update' should update.
wget_files = \
  $(srcdir)/config.guess \
  $(srcdir)/config.sub \
  $(srcdir)/doc/texinfo.tex \
  $(srcdir)/src/ansi2knr.c

###############################################

io_functions = \
  clearerr feof ferror fflush fgets fputc fputs \
  fread fwrite getc getchar putc putchar
unlocked_io_functions = $(patsubst %,%_unlocked,$(io_functions))

comma_separated = $(shell echo $(unlocked_io_functions)|tr -s ' ' ,)
base_functions = $(patsubst %_unlocked,%,$(unlocked_io_functions))

# This temp file may not be e.g., $@t, since that may be in a read-only
# directory.  Instead, use a file in the current directory.
t_io = $(notdir $@)t

# This rule requires GNU make.
$(srcdir)/m4/jm-glibc-io.m4: $(srcdir)/m4/jm-glibc-io.m4n Makefile.am
	echo dnl This file is automatically generated from $(notdir $<). \
	  > $(t_io)
	echo >> $(t_io)
	sed							\
	  -e 's/@space_separated@/$(unlocked_io_functions)/g'	\
	  -e 's/@comma_separated@/$(comma_separated)/g'		\
	  $< >> $(t_io)
	move-if-change $(t_io) $@

# This rule requires GNU make.
unlocked-io.h: unlocked-io.hin Makefile.cfg
	tmp=t$$$$;							\
	echo						> $$tmp;	\
	for f in $(base_functions); do					\
	  u=`echo $$f|tr '[:lower:]' '[:upper:]'`;			\
	  echo "#  if HAVE_$${u}_UNLOCKED"		>> $$tmp;	\
	  echo "#   undef $$f"				>> $$tmp;	\
	  echo "#   define $$f(S) $${f}_unlocked (S)"	>> $$tmp;	\
	  echo '#endif'					>> $$tmp;	\
	done;								\
	sed "/^@replace_this@$$/r$$tmp" $<				\
	  | sed "/^@replace_this@$$/d"					\
	  > $@t;							\
	rm -f $$tmp;							\
	mv $@t $@