-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.in
253 lines (201 loc) · 8.51 KB
/
Makefile.in
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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
### ====================================================================
### This section gets transformed by the configure script into Makefile
prefix = @prefix@
BINDIR = $(prefix)/bin
CC = @CC@
CFLAGS = @CFLAGS@
CPP = @CPP@
MANDIR = $(prefix)/man/man$(MANEXT)
MANEXT = 1
LIBS = @LIBS@
SHELL = /bin/sh
YACC = @YACC@
### ====================================================================
# include rexp/Makefile
### ====================================================================
OBJDIR := build
REXP_OBJDIR := build/rexp
### ====================================================================
### The remainder of this file is copied verbatim into Makefile
### Some systems and libraries print -nan, while others print nan or
### NaN: the sign of NaN is undefined, so this filter eliminates that
### difference. Similarly, the lettercase of Inf may vary. On SGI
### IRIX, NaN prints as nan0x10000000, so we also have to filter out
### the payload
FPE_FILTER = sed \
-e 's/[Nn][Aa][Nn]/nan/' \
-e 's/-nan/nan/' \
-e 's/nan0x[0-9a-fA-Z][0-9a-fA-Z]*/nan/' \
-e 's/[Ii][Nn][Ff]/inf/' \
-e 's/[Ii][Nn][Ff][Ii][Nn][Ii][Yy]/inf/'
O := \
array.o \
bi_funct.o \
bi_vars.o \
types_cast.o \
code.o \
code_jmp.o \
da.o \
error.o \
execute.o \
fcall.o \
field.o \
files.o \
fin.o \
table.o \
xxhash.o \
init.o \
types_int.o \
table_kw.o \
main.o \
types_string.o \
parse.o \
print.o \
printf.o \
re_cmpl.o \
scan.o \
scancode.o \
split.o \
version.o \
zmalloc.o
REXP_O := \
rexp.o \
rexp0.o \
rexp1.o \
rexp2.o \
rexp3.o \
rexpdb.o \
wait.o
REXP_OBJS := $(addprefix $(REXP_OBJDIR)/,$(REXP_O))
OBJS := $(addprefix $(OBJDIR)/,$(O))
STATUS = check.status
EXCLUDEFLAGS = --exclude=$$$$b/Makefile \
--exclude=RCS \
--exclude=autom4te.cache \
--exclude=config.h \
--exclude=config.log \
--exclude=config.status \
--exclude='*~'
### ====================================================================
.SUFFIXES: .i
.c.i:
$(CPP) $(CFLAGS) $< > $*.i
### ====================================================================
all : mawk
check: check_begin mawk_test fpe_test check_end
check_begin:
-@rm -f $(STATUS)
check_end:
@echo ; \
npass=`grep -c '^PASS' $(STATUS) || true` ; \
nfail=`grep -c '^FAIL' $(STATUS) || true` ; \
test $$npass -eq 2 && echo SUCCESS: TEST PASSED || \
( cat $(STATUS) ; echo ; echo FAILURE: $$nfail of `expr $$npass + $$nfail` tests failed )
@for f in mawktest.err mawktest.out ; \
do \
cmp -s test/okay/$$f test/$$f || (echo ; echo Differences in $$f ; diff test/okay/$$f test/$$f ) ; \
done
# mkrexp :
# cd rexp ;\
# $(MAKE) CC="$(CC)" CFLAGS="$(CFLAGS) -DMAWK -I.." ;
# $(REXP_O) :
# cd rexp ;\
# $(MAKE) CC="$(CC)" CFLAGS="$(CFLAGS) -DMAWK -I.." ;
mawk_test : mawk # test that we have a sane mawk
@echo ; echo testing mawk
-cd test ; time ./mawktest > mawktest.out 2> mawktest.err
@( cmp -s test/okay/mawktest.err test/mawktest.err && echo PASS: mawktest.err || echo FAIL: mawktest.err ) >> $(STATUS)
@( cmp -s test/okay/mawktest.out test/mawktest.out && echo PASS: mawktest.out || echo FAIL: mawktest.out ) >> $(STATUS)
fpe_test : mawk # test FPEs are handled OK
@echo ; echo testing floating point exception handling
-cd test ; time ./fpe_test
parse.c parse.h : parse.y
@echo expect 6 shift/reduce conflicts
$(YACC) -d parse.y
mv y.tab.c parse.c
mv y.tab.h parse.h
array.c : array.w
notangle -R'"array.c"' array.w | cpif array.c
array.h : array.w
notangle -R'"array.h"' array.w | cpif array.h
printf.c : printf.w
notangle -R'"printf.c"' printf.w | cpif printf.c
printf.h : printf.w
notangle -R'"printf.h"' printf.w | cpif printf.h
scancode.c : scancode.src.c scan.h
$(CC) -o scancode.src.exe scancode.src.c
rm -f scancode.c
./scancode.src.exe > scancode.c
rm scancode.src.exe
mawk : $(REXP_OBJS) $(OBJS)
$(CC) $(CFLAGS) -o $@ $^ $(LIBS) -I./ -Irexp $(LDFLAGS)
MAWKMAN = $(MANDIR)/mawk.$(MANEXT)
install : mawk
cp mawk $(BINDIR)
chmod 0755 $(BINDIR)/mawk
cp man/mawk.1 $(MAWKMAN)
chmod 0644 $(MAWKMAN)
clean :
-rm -fdR *.i *.o build rexp/*.o rexp/build test/mawk mawk $(STATUS)
dist :
-d=`pwd` ; \
b=`basename $$d` ; \
$(MAKE) clean ; \
(cd ..; env GZIP=-9 tar -c -z ${EXCLUDEFLAGS} -f $$b.tar.gz $$b 2> /dev/null || true) ; \
(cd ..; env BZIP2=-9 tar -c -j ${EXCLUDEFLAGS} -f $$b.tar.bz2 $$b 2> /dev/null || true) ; \
(cd ..; env XZ=-9 tar -c -J ${EXCLUDEFLAGS} -f $$b.tar.xz $$b 2> /dev/null || true) ; \
ls -l ../$$b.tar.*
distclean : clean
-rm -f config.h Makefile \
config.status config.user config.log config.cache
-rm -rf autom4te.cache
configure config.hin : configure.ac
autoconf
autoheader
doc :
cd cdoc ; $(MAKE)
### ====================================================================
# dependencies computed by compiling with -MMD and makedeps *.d
$(OBJDIR)/array.o: array.c mawk.h types.h types_int.h table.h array.h types_string.h zmalloc.h split.h field.h bi_vars.h
$(OBJDIR)/bi_funct.o: bi_funct.c mawk.h types.h bi_funct.h table.h array.h bi_vars.h types_string.h zmalloc.h init.h types_int.h files.h fin.h field.h regexp.h repl.h
$(OBJDIR)/bi_vars.o: bi_vars.c mawk.h types.h table.h array.h bi_vars.h field.h init.h types_string.h zmalloc.h
$(OBJDIR)/types_cast.o: types_cast.c mawk.h types.h field.h types_string.h zmalloc.h scan.h table.h array.h parse.h repl.h types_int.h
$(OBJDIR)/code.o: code.c mawk.h types.h code.h types_string.h zmalloc.h init.h table.h array.h field.h
$(OBJDIR)/da.o: da.c mawk.h types.h code.h types_string.h zmalloc.h bi_funct.h table.h array.h repl.h field.h printf.h files.h
$(OBJDIR)/error.o: error.c mawk.h types.h scan.h table.h array.h parse.h bi_vars.h
$(OBJDIR)/execute.o: execute.c mawk.h types.h code.h types_string.h zmalloc.h table.h array.h types_int.h field.h bi_funct.h bi_vars.h regexp.h repl.h fin.h
$(OBJDIR)/fcall.o: fcall.c mawk.h types.h table.h array.h code.h types_string.h zmalloc.h
$(OBJDIR)/field.o: field.c mawk.h types.h types_int.h split.h field.h init.h table.h array.h types_string.h zmalloc.h scan.h parse.h bi_vars.h repl.h regexp.h
$(OBJDIR)/files.o: files.c mawk.h types.h files.h types_string.h zmalloc.h fin.h
$(OBJDIR)/fin.o: fin.c mawk.h types.h fin.h types_string.h zmalloc.h bi_vars.h field.h table.h array.h scan.h parse.h
$(OBJDIR)/table.o: table.c mawk.h types.h types_string.h zmalloc.h table.h array.h
$(OBJDIR)/init.o: init.c mawk.h types.h code.h types_string.h zmalloc.h table.h array.h init.h bi_vars.h field.h
$(OBJDIR)/types_int.o: types_int.c types_int.h
$(OBJDIR)/code_jmp.o: code_jmp.c mawk.h types.h table.h array.h code.h types_string.h zmalloc.h init.h
$(OBJDIR)/table_kw.o: table_kw.c mawk.h types.h table.h array.h parse.h init.h
$(OBJDIR)/main.o: main.c mawk.h types.h init.h table.h array.h code.h types_string.h zmalloc.h files.h
$(OBJDIR)/memory.o: types_string.c mawk.h types.h types_string.h zmalloc.h
$(OBJDIR)/parse.o: parse.c mawk.h types.h table.h array.h code.h types_string.h zmalloc.h bi_funct.h bi_vars.h field.h files.h printf.h
$(OBJDIR)/print.o: print.c mawk.h types.h bi_vars.h bi_funct.h table.h array.h types_string.h zmalloc.h field.h scan.h parse.h files.h types_int.h printf.h
$(OBJDIR)/printf.o: printf.c mawk.h types.h scan.h table.h array.h parse.h printf.h types_string.h zmalloc.h files.h types_int.h
$(OBJDIR)/re_cmpl.o: re_cmpl.c mawk.h types.h types_string.h zmalloc.h scan.h table.h array.h parse.h regexp.h repl.h split.h
$(OBJDIR)/scan.o: scan.c mawk.h types.h scan.h table.h array.h parse.h types_string.h zmalloc.h field.h init.h types_int.h fin.h repl.h code.h files.h
$(OBJDIR)/scancode.o: scancode.c scan.h
$(OBJDIR)/split.o: split.c mawk.h types.h split.h table.h array.h bi_vars.h bi_funct.h types_string.h zmalloc.h scan.h parse.h regexp.h repl.h field.h
$(OBJDIR)/version.o: version.c mawk.h types.h
$(OBJDIR)/zmalloc.o: zmalloc.c mawk.h types.h zmalloc.h
### ====================================================================
# make the directory an order-only prerequisite on all the targets: Now the rule to create the objdir directory will be run, if needed, before any ‘.o’ is built, but no ‘.o’ will be built because the objdir directory timestamp changed.
$(REXP_OBJDIR): | $(OBJDIR)
mkdir -p $(REXP_OBJDIR)
$(OBJS): | $(OBJDIR)
$(OBJDIR):
mkdir -p $(OBJDIR)
$(REXP_OBJS): rexp/rexp.h rexp/wait.h | $(OBJDIR) $(REXP_OBJDIR)
define build-obj =
$(CC) $(CFLAGS) -o $@ -DMAWK -I./ -Irexp -c $(filter %.c,$^) $(LIBS) $(LDFLAGS)
endef
$(REXP_OBJDIR)/%.o : rexp/%.c
$(build-obj)
$(OBJDIR)/%.o : %.c | $(OBJDIR) $(REXP_OBJDIR)
$(build-obj)