File: Makefile

package info (click to toggle)
cwebx 3.52-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, sid
  • size: 1,280 kB
  • sloc: ansic: 1,622; pascal: 228; makefile: 123; sh: 1
file content (145 lines) | stat: -rw-r--r-- 4,045 bytes parent folder | download
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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
# This file is part of CWEB, version x3.51 (or newer)

#
# Read the README file, then edit this file to reflect local conditions
#

# In whose 'bin/' subdirectory the 'install' target will put the binaries
# If you cannot write to /usr/local, replace it by your home directory
# And make sure $(prefix)/bin is in your PATH
prefix = debian/cwebx/usr

# The C compiler should be ANSI compatible. If you change this to another
# brand then gcc, make sure you also change the -ansi flag in CFLAGS below to
# one that tells your compiler to expect only strict ANSI/ISO C source code.
# If you don't, then your compiler might squirm about identifiers that it
# predeclares without us having asked it to, and which conflict with the
# identifiers actually used in the CWEBx source, which then fails to compile.
# CC = gcc

# Command line flags for CTANGLE and CWEAVE while building CWEB
# We let CWEAVE report syntax errors by setting +d.
# The flag +m makes the TeX output slightly more compact.

CTFLAGS =
CWFLAGS = +md

# The -ansi flag (for gcc) should guard against spurious #include files
# We keep debugging info around to enable the `+d' option of cweave
CFLAGS += -ansi -DSTAT

# RM and CP are used below in case rm and cp are aliased

RM= /bin/rm -f
CP= /bin/cp -p
RENAME= /bin/mv


# Set CCHANGES to common-foo.ch if you need changes to common.w in another
# file than common.ch

CCHANGES=

# Set TCHANGES to ctangle-foo.ch if you need changes to ctangle.w in another
# file than ctangle.ch

TCHANGES=

# Set WCHANGES to cweave-foo.ch if you need changes to cweave.w in another
# file than cweave.ch

WCHANGES=

##########  You shouldn't have to change anything after this point #######

CWEAVE = ./cweavex $(CWFLAGS)
CTANGLE = ./ctanglex $(CTFLAGS)
PDFTEX = pdftex

%.tex: %.w cweavex
	$(CWEAVE) $*

%.pdf: %.tex
	$(PDFTEX) $*.tex

%.c: %.w ctanglex
	$(CTANGLE) $*

%.o: %.c
	$(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@

.PHONY: all cweb manual doc listings cautiously
all: cweb doc listings
cweb: ctanglex cweavex
manual doc: manual.pdf
listings: common.pdf ctangle.pdf cweave.pdf

cautiously: common.c ctangle.c cweave.c
	$(RENAME) ctanglex SAVEctangle # save version in case things mess up
	$(MAKE) ctanglex
	$(RENAME) common.c SAVEcommon.c
	./ctanglex common $(CCHANGES)
	diff common.c SAVEcommon.c
	$(RENAME) SAVEcommon.c common.c # restore date
	$(RENAME) ctangle.c SAVEctangle.c
	./ctanglex ctangle $(TCHANGES)
	diff ctangle.c SAVEctangle.c
	$(RENAME) SAVEctangle.c ctangle.c # restore date
	$(RENAME) cweave.c SAVEcweave.c
	./ctanglex cweave $(WCHANGES)
	diff cweave.c SAVEcweave.c
	$(RENAME) SAVEcweave.c cweave.c # restore date
	$(RM) SAVEctangle # succeeded, use new binary from now on

SAVEctangle.c:
	$(CP) ctangle.c SAVEctangle.c

SAVEcommon.c:
	$(CP) common.c SAVEcommon.c

common.c: common.w $(CCHANGES) common.inc ctanglex
	$(CTANGLE) common $(CCHANGES)
common.h: common.w $(CCHANGES) ctanglex
	$(CTANGLE) common $(CCHANGES)

common.tex: common.w common.inc cweavex
	$(CWEAVE) common $(CCHANGES)

ctanglex: ctangle.o common.o
	$(CC) $(CFLAGS) $(LDFLAGS) -o ctanglex ctangle.o common.o

ctangle.c: ctangle.w $(TCHANGES) common.inc common.h ctanglex
	$(CTANGLE) ctangle $(TCHANGES)

ctangle.tex:  ctangle.w $(TCHANGES) common.inc intro.inc cweavex
	$(CWEAVE) ctangle $(TCHANGES)

cweavex: cweave.o common.o
	$(CC) $(CFLAGS) $(LDFLAGS) -o cweavex cweave.o common.o

cweave.c: cweave.w $(WCHANGES) common.inc common.h parser.w rules.w ctanglex
	$(CTANGLE) cweave $(WCHANGES)

cweave.tex:  cweave.w $(WCHANGES) parser.w rules.w common.inc intro.inc cweavex
	$(CWEAVE) cweave $(WCHANGES)

manual.pdf: compare.tex

.PHONY:	mostlyclean clean install check

mostlyclean:
	$(RM) *~ *.o *.log *.toc
	$(RM) common.tex ctangle.tex cweave.c cweave.tex

clean:	mostlyclean
	$(RM) *.pdf ctanglex cweavex

MACRODIR=$(prefix)/share/texmf/tex/plain/litprog

install: ctanglex cweavex
	test -d $(prefix)/bin || mkdir $(prefix)/bin
	$(CP) ctanglex cweavex $(prefix)/bin
	cp cweb?mac.tex $(MACRODIR)

check:
	@echo 'Did you expect a check from me?'