blob: 616b2af16ed5023d63431c900aff99127677b937 (
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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
|
# This file is part of the c2cweb package Version 1.5 (10-Nov-1996)
# GNU Makefile for c2cweb
# you should use the CWEAVE program of this package
.PHONY: default all debug documentation clean \
do_all cweb
.CAUTIOUS: c2cweb.c
default:
@echo " say "
@echo ". "
@echo " make <TARGET> OS=<SYSTEM> "
@echo ". "
@echo " SYSTEM can be one of the following:"
@echo ". "
@echo " unix (gcc) "
@echo " os2 bound (emx) "
@echo " dos (djgpp) "
@echo ". "
@echo " TARGET can be one of the following:"
@echo ". "
@echo " all debug "
@echo " documentation "
@echo " clean "
ifdef OS
ifeq ($(OS),unix)
CC = gcc -Wall -O
O = .o
LIB =
EXE =
CP = cp
RM = rm -f
endif
ifeq ($(OS),os2)
CC = gcc -Wall -Zomf -Zmtd -O
O = .obj
LIB = c2cweb.def
EXE = .exe
CP = copy
RM = del
endif
ifeq ($(OS),dos)
CC = gcc -Wall -O
O = .o
LIB =
EXE = .exe
CP = copy
RM = del
endif
ifeq ($(OS),bound)
CC = gcc -Wall -O
O = .o
LIB =
EXE = .exe
CP = copy
RM = del
endif
ifeq ($(OS),unix)
define sub_make
cd cweb; make $@
endef
else
define sub_make
cd cweb
make $@
cd ..
endef
endif
OBJ = c2cweb$O
OUR_CWEAVE = cweb/cweave
%$O: %.c
$(CC) $(CFLAGS) -c -o $@ $<
%.c: %.w %.ch
$(CTANGLE) $^ $@
%.c: %.w
$(CTANGLE) $<
%.tex: %.w %.ch
$(OUR_CWEAVE) +ai $^ $@
%.tex: %.w
$(OUR_CWEAVE) +ai $<
all:
$(MAKE) do_all CFLAGS=-s
debug:
$(MAKE) do_all CFLAGS=-g
# this builds a .dvi-file
# for .dvi files of cweave etc. please get the original CWEB package
documentation: c2cweb.dvi
# remove the unnecessary files.
clean:
$(sub_make)
-$(RM) *$O
-$(RM) *.tex
-$(RM) *.scn
-$(RM) *.toc
-$(RM) *.idx
-$(RM) *.log
do_all: cweb c2cweb$(EXE)
cweb:
$(sub_make)
c2cweb$(EXE): $(OBJ)
ifeq ($(OS),dos)
$(CC) $(CFLAGS) -o $(basename $@) $^
strip $(basename $@)
coff2exe $(basename $@)
-$(RM) $(basename $@)
else
$(CC) $(CFLAGS) -o $@ $^ $(LIB)
endif
c2cweb.dvi: c2cweb.tex cweb/cwebmaca.tex
-$(RM) cwebmaca.tex
$(CP) cweb/cwebmaca.tex .
$(TEX) c2cweb
else # ifdef OS
all debug documentation clean: default
endif
# end of Makefile
|