summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c/am/bootstrap.am
blob: e6cbd3f3b3c46fec27091d43451f590c4bb4d30e (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
## texk/web2c/am/bootstrap.am: Makefile fragment for tangle and ctangle.
##
## Copyright (C) 2009-2012 Peter Breitenlohner <tex-live@tug.org>
## You may freely use, modify and/or distribute this file.

cp_silent = $(cp_silent_@AM_V@)
cp_silent_ = $(cp_silent_@AM_DEFAULT_V@)
cp_silent_0 = @echo "  COPY    " $@;
cp_silent_1 =

# Bootstrapping tangle requires making it with itself.  We use the opportunity
# to create an up-to-date tangleboot.pin as well.
bin_PROGRAMS += tangle
nodist_tangle_SOURCES = tangle.c tangle.h
tangle.c tangle.h: tangle-web2c
	@$(web2c) tangle
tangle-web2c: tangle.p $(web2c_depend)
	@$(web2c) tangle
# tangle.p is a special case, since it is needed to compile itself.  We
# convert and compile the (distributed) tangleboot.pin to make a tangle
# which we use to make the other programs.  We depend on tangleboot, even
# though we might not use it.
tangle.p: tangleboot$(EXEEXT) tangle.web tangle.ch
	$(tangleboot) tangle tangle
	@cmp -s tangle.p $(srcdir)/tangleboot.pin || { \
	  if $(AM_V_P); then \
	    echo "Updating tangle.p => $(srcdir)/tangleboot.pin"; \
	  else \
	    echo "  UPD     " tangleboot.pin; \
	  fi; cp -f tangle.p $(srcdir)/tangleboot.pin; }
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
EXTRA_DIST += tangle.web tangle.ch
DISTCLEANFILES += tangle.c tangle.h tangle.p tangle-web2c

noinst_PROGRAMS += tangleboot
nodist_tangleboot_SOURCES = tangleboot.c tangleboot.h
tangleboot.c tangleboot.h: tangleboot-web2c
	@$(web2c) tangleboot
tangleboot-web2c: tangleboot.p $(web2c_depend)
	@$(web2c) tangleboot
# tangleboot.pin is in the distribution
.pin.p:
	$(cp_silent)cp -f $< $@
$(tangleboot_OBJECTS): $(tangleboot_DEPENDENCIES)
tangleboot_DEPENDENCIES = $(default_dependencies)
EXTRA_DIST += tangleboot.pin
DISTCLEANFILES += tangleboot.c tangleboot.h tangleboot.p tangleboot-web2c

# Bootstrapping ctangle requires making it with itself.  We use the opportunity
# to create an up-to-date ctangleboot.cin and cwebboot.[ch]in as well.
bin_PROGRAMS += ctangle
nodist_ctangle_SOURCES = ctangle.c cweb.c
$(ctangle_OBJECTS): cweb.h
# ctangle.c and cweb.[ch] are special cases, since they are needed to compile
# themselves.  We depend on ctangleboot, even though we might not use it.
ctangleboot = AM_V_P=$(AM_V_P) $(SHELL) ./ctangleboot-sh $@
ctangle.c: ctangleboot$(EXEEXT) cwebdir/common.h cwebdir/ctangle.w cwebdir/ctang-w2c.ch ctangleboot-sh
	@$(ctangleboot) ctangle ctang-w2c
cweb.c cweb.h: common-ctangle
	@$(ctangleboot) common comm-w2c cweb.c
common-ctangle: ctangleboot$(EXEEXT) cwebdir/common.w cwebdir/comm-w2c.ch ctangleboot-sh
	@$(ctangleboot) common comm-w2c cweb.c
EXTRA_DIST += cwebdir
## We install man/cweb.man, not cwebdir/cweb.1
## nodist_man_MANS += cwebdir/cweb.1
DISTCLEANFILES += ctangle.c cweb.c cweb.h common-ctangle

noinst_PROGRAMS += ctangleboot
nodist_ctangleboot_SOURCES = ctangleboot.c cwebboot.c
$(ctangleboot_OBJECTS): cwebboot.h $(ctangleboot_DEPENDENCIES)
# ctangleboot.cin and cwebboot.[ch]in are in the distribution
.cin.c:
	$(cp_silent)cp -f $< $@
.hin.h:
	$(cp_silent)cp -f $< $@
ctangleboot_DEPENDENCIES = $(default_dependencies)
EXTRA_DIST += ctangleboot.cin cwebboot.cin cwebboot.hin
DISTCLEANFILES += ctangleboot.c cwebboot.c cwebboot.h

## Tests
##
EXTRA_DIST += tangle.test

TESTS += tangle.test

DISTCLEANFILES += cftest.p