summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c/am/bootstrap.am
blob: 734d059c83be0d6e7dbce837f9d5cd409d2595a9 (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
## texk/web2c/am/bootstrap.am: Makefile fragment for tangle and ctangle.

## Bootstrapping tangle requires making it with itself.  We use the opportunity
## to create an up-to-date tangleboot as well.
bin_PROGRAMS += tangle
nodist_tangle_SOURCES = tangle.c tangle.h
tangle.c tangle.h: tangle-web2c
tangle-web2c: tangle.p
	$(web2c) tangle
	echo timestamp >$@
	touch tangle.c tangle.h
## tangle.p is a special case, since it is needed to compile itself.  We
## convert and compile the (distributed) tangleboot.p to make a tangle
## which we use to make the other programs.  We depend on tangleboot, even
## though we might not use it.
EXTRA_DIST += tangle.web tangle.ch
tangle.p: tangleboot tangle.web tangle.ch
	WEBINPUTS=.:$(srcdir) $(tangleboot) tangle tangle
tangle.web:
	@echo "You seem to be missing tangle.web, perhaps because you" >&2
	@echo "didn't retrieve web.tar.gz, only web2c.tar.gz." >&2
	@echo "You need both." >&2
	@echo >&2
	@echo "web.tar.gz should be available from the" >&2
	@echo "same place that you got web2c.tar.gz." >&2
	@echo "In any case, you can get it from" >&2
	@echo "ftp://ftp.tug.org/tex/web.tar.gz." >&2
	false
DISTCLEANFILES += tangle.c tangle.h tangle.p tangle-web2c
if HAVE_EXEEXT
tangle: tangle$(EXEEXT)
	echo timestamp >$@
CLEANFILES += tangle
endif HAVE_EXEEXT

noinst_PROGRAMS += tangleboot
nodist_tangleboot_SOURCES = tangleboot.c tangleboot.h
tangleboot.c tangleboot.h: stamp-tangle $(web2c_programs) $(web2c_common)
	$(web2c) tangleboot
## tangleboot.p is in the distribution
EXTRA_DIST += tangleboot.p
stamp-tangle: tangleboot.p
	date >stamp-tangle
## This is not run unless tangle.web or tangle.ch is changed.
## Only try to run ./tangle if it actually exists, otherwise
## just touch tangleboot.p and build tangle.
tangleboot.p: tangle.web tangle.ch
	if [ -r $(TANGLE) ] || [ -r $(TANGLE).exe ]; then \
	  $(tangle) tangle tangle; \
	  mv tangle.p tangleboot.p; \
	elif [ -r tangleboot.p ]; then \
	  touch tangleboot.p; \
	else \
	  cp $(srcdir)/tangleboot.p .; \
	fi
	date >stamp-tangle
	$(MAKE) $(AM_MAKEFLAGS) tangle$(EXEEXT)
DISTCLEANFILES += stamp-tangle tangleboot.c tangleboot.h
if HAVE_EXEEXT
tangleboot: tangleboot$(EXEEXT)
	echo timestamp >$@
CLEANFILES += tangleboot
endif HAVE_EXEEXT

## Bootstrapping ctangle requires making it with itself.  We use the opportunity
## to create an up-to-date ctangleboot as well.
bin_PROGRAMS += ctangle
nodist_ctangle_SOURCES = ctangle.c cweb.c
## ctangle.c is a special case, since it is needed to compile itself.
## We depend on ctangleboot, even though we might not use it.
EXTRA_DIST += cwebdir
## We install man/cweb.man, not cwebdir/cweb.1
## nodist_man_MANS += cwebdir/cweb.1
ctangle.c: ctangleboot cwebdir/ctangle.w cwebdir/ctang-w2c.ch
	CWEBINPUTS=$(srcdir)/cwebdir $(ctangleboot) ctangle ctang-w2c
cweb.c: ctangleboot cwebdir/common.w cwebdir/comm-w2c.ch
	CWEBINPUTS=$(srcdir)/cwebdir $(ctangleboot) common comm-w2c cweb.c
DISTCLEANFILES += ctangle.c cweb.c
if HAVE_EXEEXT
ctangle: ctangle$(EXEEXT)
	echo timestamp >$@
CLEANFILES += ctangle
endif HAVE_EXEEXT

noinst_PROGRAMS += ctangleboot
nodist_ctangleboot_SOURCES = ctangleboot.c cwebboot.c
## ctangleboot.c and cwebboot.c are in the distribution
EXTRA_DIST += ctangleboot.c cwebboot.c
stamp-ctangle: ctangleboot.c cwebboot.c
	date >stamp-ctangle
## This is not run unless one of the cwebdir/* files is changed.
## Only try to run ./ctangle if it actually exists, otherwise
## just touch ctangleboot.c and/or cwebboot.c and build ctangle.
ctangleboot.c: cwebdir/ctangle.w cwebdir/ctang-w2c.ch
	if [ -r $(CTANGLE) ] || [ -r $(CTANGLE).exe ]; then \
	  CWEBINPUTS=$(srcdir)/cwebdir $(ctangle) ctangle ctang-w2c; \
	  mv ctangle.c ctangleboot.c; \
	elif [ -r ctangleboot.c ]; then \
	  touch ctangleboot.c; \
	else \
	  cp $(srcdir)/ctangleboot.c .; \
	fi
	date >stamp-ctangle
	$(MAKE) $(AM_MAKEFLAGS) ctangle$(EXEEXT)
cwebboot.c: cwebdir/common.w cwebdir/comm-w2c.ch
	if [ -r $(CTANGLE) ] || [ -r $(CTANGLE).exe ]; then \
	  CWEBINPUTS=$(srcdir)/cwebdir $(ctangle) common comm-w2c cweb.c; \
	  mv cweb.c cwebboot.c; \
	elif [ -r cwebboot.c ]; then \
	  touch cwebboot.c; \
	else \
	  cp $(srcdir)/cwebboot.c .; \
	fi
	date >stamp-ctangle
	$(MAKE) $(AM_MAKEFLAGS) ctangle$(EXEEXT)
DISTCLEANFILES += stamp-ctangle
if HAVE_EXEEXT
ctangleboot: ctangleboot$(EXEEXT)
	echo timestamp >$@
CLEANFILES += ctangleboot
endif HAVE_EXEEXT

## Tests

dist_check_SCRIPTS += tangle.test

TESTS += tangle.test

DISTCLEANFILES += cftest.p