Makefile.am revision 1.1.1.5
1# This file is part of flex.
2
3# Redistribution and use in source and binary forms, with or without
4# modification, are permitted provided that the following conditions
5# are met:
6
7# 1. Redistributions of source code must retain the above copyright
8#    notice, this list of conditions and the following disclaimer.
9# 2. Redistributions in binary form must reproduce the above copyright
10#    notice, this list of conditions and the following disclaimer in the
11#    documentation and/or other materials provided with the distribution.
12
13# Neither the name of the University nor the names of its contributors
14# may be used to endorse or promote products derived from this software
15# without specific prior written permission.
16
17# THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
18# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
19# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
20# PURPOSE.
21
22AM_CFLAGS = $(WARNINGFLAGS)
23
24TESTS = $(check_PROGRAMS) options.cn
25
26# The script testwrapper.sh will run most tests as is. A couple tests
27# in the suite end in .reject, .table and the like so that we can pass
28# different arguments to the test runner. We list those extensions so
29# automake knows how to distinguish between the various kinds of tests
30# we have.
31
32TEST_EXTENSIONS = .reject .table .direct .cn .i3 .pthread .one .opt .ser .ver
33
34LOG_COMPILER = $(SHELL) $(srcdir)/testwrapper.sh
35AM_LOG_FLAGS = -d $(srcdir) -r
36
37REJECT_LOG_COMPILER = $(SHELL) $(srcdir)/testwrapper.sh
38AM_REJECT_LOG_FLAGS = -d $(srcdir) -i $(srcdir)/reject.txt -r
39
40TABLE_LOG_COMPILER = $(SHELL) $(srcdir)/testwrapper.sh
41AM_TABLE_LOG_FLAGS = -d $(builddir) -i $(srcdir)/reject.txt -t
42
43DIRECT_LOG_COMPILER = $(SHELL) $(srcdir)/testwrapper-direct.sh
44AM_DIRECT_LOG_FLAGS = -b $(abs_builddir) -s $(srcdir)
45
46CN_LOG_COMPILER = $(SHELL) $(srcdir)/options.cn
47AM_CN_LOG_FLAGS = $(FLEX)
48
49I3_LOG_COMPILER = $(SHELL) $(srcdir)/testwrapper.sh
50AM_I3_LOG_FLAGS = -i $(srcdir)/cxx_yywrap.txt -i $(srcdir)/cxx_yywrap.txt -i $(srcdir)/cxx_yywrap.txt
51
52PTHREAD_LOG_COMPILER = $(SHELL) $(srcdir)/testwrapper.sh
53AM_PTHREAD_LOG_FLAGS = -i $(srcdir)/pthread_1.txt -i $(srcdir)/pthread_2.txt -i $(srcdir)/pthread_3.txt -i $(srcdir)/pthread_4.txt -i $(srcdir)/pthread_5.txt
54
55ONE_LOG_COMPILER = $(SHELL) $(srcdir)/testwrapper.sh
56AM_ONE_LOG_FLAGS = -1 -d $(srcdir)
57
58AM_YFLAGS = -d -p test
59AM_CPPFLAGS = -I$(top_builddir)/src -I$(top_srcdir)/src
60
61check_PROGRAMS = $(simple_tests) $(reject_tests) $(TABLE_TESTS) $(DIRECT_TESTS) $(I3_TESTS) $(PTHREAD_TESTS) $(ONE_TESTS) $(TABLEOPTS_TESTS)
62
63simple_tests = \
64	alloc_extra \
65	array_nr \
66	array_r \
67	basic_nr \
68	basic_r \
69	bison_nr \
70	bison_yylloc \
71	bison_yylval \
72	c_cxx_nr \
73	c_cxx_r \
74	ccl \
75	cxx_basic \
76	cxx_multiple_scanners \
77	cxx_restart \
78	debug_nr \
79	debug_r \
80	extended \
81	header_nr \
82	header_r \
83	mem_nr \
84	mem_r \
85	multiple_scanners_nr \
86	multiple_scanners_r \
87	posix \
88	posixly_correct \
89	prefix_nr \
90	prefix_r \
91	quote_in_comment \
92	quotes \
93	string_nr \
94	string_r \
95	top \
96	yyextra
97
98reject_tests = \
99	reject_nr.reject \
100	reject_r.reject
101
102TABLE_TESTS = \
103	reject_ver.table \
104	reject_ser.table
105
106DIRECT_TESTS = \
107	include_by_buffer.direct \
108	include_by_push.direct \
109	include_by_reentrant.direct \
110	rescan_nr.direct \
111	rescan_r.direct
112
113I3_TESTS = \
114	cxx_yywrap.i3
115
116PTHREAD_TESTS = \
117	pthread.pthread
118
119ONE_TESTS = \
120	lineno_nr.one \
121	lineno_r.one \
122	lineno_trailing.one
123
124quote_in_comment_SOURCES = quote_in_comment.l
125alloc_extra_SOURCES = alloc_extra.l
126array_nr_SOURCES = array_nr.l
127array_r_SOURCES = array_r.l
128basic_nr_SOURCES = basic_nr.l
129basic_r_SOURCES = basic_r.l
130if HAVE_BISON
131bison_nr_SOURCES = bison_nr_scanner.l bison_nr_parser.y bison_nr_main.c
132nodist_bison_nr_SOURCES = bison_nr_parser.h bison_nr_scanner.h
133bison_yylloc_SOURCES = bison_yylloc_scanner.l bison_yylloc_parser.y bison_yylloc_main.c
134nodist_bison_yylloc_SOURCES = bison_yylloc_parser.h bison_yylloc_scanner.h
135bison_yylval_SOURCES = bison_yylval_scanner.l bison_yylval_parser.y bison_yylval_main.c
136nodist_bison_yylval_SOURCES = bison_yylval_parser.h bison_yylval_scanner.h
137else
138bison_nr_SOURCES = no_bison_stub.c
139bison_yylloc_SOURCES = no_bison_stub.c
140bison_yylval_SOURCES = no_bison_stub.c
141endif
142c_cxx_nr_SOURCES = c_cxx_nr.lll
143c_cxx_r_SOURCES = c_cxx_r.lll
144ccl_SOURCES = ccl.l
145cxx_basic_SOURCES = cxx_basic.ll
146cxx_restart_SOURCES = cxx_restart.ll
147cxx_multiple_scanners_SOURCES = cxx_multiple_scanners_main.cc cxx_multiple_scanners_1.ll cxx_multiple_scanners_2.ll
148cxx_yywrap_i3_SOURCES = cxx_yywrap.ll
149debug_nr_SOURCES = debug_nr.l
150debug_r_SOURCES = debug_r.l
151extended_SOURCES = extended.l
152header_nr_SOURCES = header_nr_scanner.l header_nr_main.c
153nodist_header_nr_SOURCES = header_nr_scanner.h
154header_r_SOURCES = header_r_scanner.l header_r_main.c
155nodist_header_r_SOURCES = header_r_scanner.h
156include_by_buffer_direct_SOURCES = include_by_buffer.direct.l
157include_by_push_direct_SOURCES = include_by_push.direct.l
158include_by_reentrant_direct_SOURCES = include_by_reentrant.direct.l
159lineno_nr_one_SOURCES = lineno_nr.l
160lineno_r_one_SOURCES = lineno_r.l
161lineno_trailing_one_SOURCES = lineno_trailing.l
162mem_nr_SOURCES = mem_nr.l
163mem_r_SOURCES = mem_r.l
164multiple_scanners_nr_SOURCES = multiple_scanners_nr_main.c multiple_scanners_nr_1.l multiple_scanners_nr_2.l
165nodist_multiple_scanners_nr_SOURCES = multiple_scanners_nr_1.h multiple_scanners_nr_2.h
166multiple_scanners_r_SOURCES = multiple_scanners_r_main.c multiple_scanners_r_1.l multiple_scanners_r_2.l
167nodist_multiple_scanners_r_SOURCES = multiple_scanners_nr_1.h multiple_scanners_nr_2.h
168posix_SOURCES = posix.l
169posixly_correct_SOURCES = posixly_correct.l
170prefix_nr_SOURCES = prefix_nr.l
171prefix_r_SOURCES = prefix_r.l
172pthread_pthread_SOURCES = pthread.l
173quotes_SOURCES = quotes.l
174reject_nr_reject_SOURCES = reject.l4
175reject_r_reject_SOURCES = reject.l4
176reject_ver_table_SOURCES = reject.l4
177reject_ser_table_SOURCES = reject.l4
178rescan_nr_direct_SOURCES = rescan_nr.direct.l
179rescan_r_direct_SOURCES = rescan_r.direct.l
180string_nr_SOURCES = string_nr.l
181string_r_SOURCES = string_r.l
182top_SOURCES = top.l top_main.c
183nodist_top_SOURCES = top.h
184yyextra_SOURCES = yyextra.l
185
186# Normally, automake would distribute files built by flex. Since the
187# point of the test suite is to test the files that flex builds, and
188# since anyone who has the flex distribution can build a flex binary
189# without having a flex binary, we want to not distribute the files
190# built by flex in the test suite. The dist-hook target accomplishes
191# this goal. It's also handy to have the list of files to clean since
192# automake doesn't know about the whacky ways in which we're abusing
193# it.
194
195CLEANFILES = \
196	alloc_extra.c \
197	array_nr.c \
198	array_r.c \
199	basic_nr.c \
200	basic_r.c \
201	bison_nr_parser.c \
202	bison_nr_parser.h \
203	bison_nr_scanner.c \
204	bison_nr_scanner.h \
205	bison_yylloc_parser.c \
206	bison_yylloc_parser.h \
207	bison_yylloc_scanner.c \
208	bison_yylloc_scanner.h \
209	bison_yylval_parser.c \
210	bison_yylval_parser.h \
211	bison_yylval_scanner.c \
212	bison_yylval_scanner.h \
213	c_cxx_nr.cc \
214	c_cxx_r.cc \
215	ccl.c \
216	cxx_basic.cc \
217	cxx_multiple_scanners_1.cc \
218	cxx_multiple_scanners_2.cc \
219	cxx_restart.cc \
220	cxx_yywrap.cc \
221	debug_nr.c \
222	debug_r.c \
223	extended.c \
224	header_nr_scanner.c \
225	header_nr_scanner.h \
226	header_r_scanner.c \
227	header_r_scanner.h \
228	include_by_buffer.direct.c \
229	include_by_push.direct.c \
230	include_by_reentrant.direct.c \
231	lineno_nr.c \
232	lineno_r.c \
233	lineno_trailing.c \
234	mem_nr.c \
235	mem_r.c \
236	multiple_scanners_nr_1.c \
237	multiple_scanners_nr_1.h \
238	multiple_scanners_nr_2.c \
239	multiple_scanners_nr_2.h \
240	multiple_scanners_r_1.c \
241	multiple_scanners_r_1.h \
242	multiple_scanners_r_2.c \
243	multiple_scanners_r_2.h \
244	posix.c \
245	posixly_correct.c \
246	prefix_nr.c \
247	prefix_r.c \
248	pthread.c \
249	quote_in_comment.c \
250	quotes.c \
251	reject_nr.reject.c \
252	reject_r.reject.c \
253	reject_ser.table.c \
254	reject_ser.table.tables \
255	reject_ver.table.c \
256	reject_ver.table.tables \
257	rescan_nr.direct.c \
258	rescan_r.direct.c \
259	string_nr.c \
260	string_r.c \
261	top.c \
262	top.h  \
263	yyextra.c \
264	$(tableopts_c) \
265	$(tableopts_tables)
266
267dist-hook:
268	for file in $(CLEANFILES) ; do \
269	rm -f $(distdir)/$$file \
270	; done
271
272EXTRA_DIST = \
273	README \
274	alloc_extra.txt \
275	array_nr.txt \
276	array_r.txt \
277	basic_nr.txt \
278	basic_r.txt \
279	bison_nr.txt \
280	bison_yylloc.txt \
281	bison_yylval.txt \
282	c_cxx_nr.txt \
283	c_cxx_r.txt \
284	ccl.txt \
285	cxx_basic.txt \
286	cxx_multiple_scanners.txt \
287	cxx_restart.txt \
288	cxx_yywrap.txt \
289	debug_nr.txt \
290	debug_r.txt \
291	extended.txt \
292	header_nr.txt \
293	header_r.txt \
294	include_by_buffer.direct.txt \
295	include_by_buffer.direct_2.txt \
296	include_by_buffer.direct_3.txt \
297	include_by_push.direct.txt \
298	include_by_push.direct_2.txt \
299	include_by_push.direct_3.txt \
300	include_by_reentrant.direct.txt \
301	include_by_reentrant.direct_2.txt \
302	include_by_reentrant.direct_3.txt \
303	lineno_nr.one.txt \
304	lineno_r.one.txt \
305	lineno_trailing.one.txt \
306	mem_nr.txt \
307	mem_r.txt \
308	prefix_nr.txt \
309	prefix_r.txt \
310	pthread_1.txt \
311	pthread_2.txt \
312	pthread_3.txt \
313	pthread_4.txt \
314	pthread_5.txt \
315	reject.txt \
316	rescan_nr.direct.txt \
317	rescan_r.direct.txt \
318	quote_in_comment.txt \
319	quotes.txt \
320	top.txt \
321	yyextra.txt \
322	tableopts.txt
323
324dist_noinst_SCRIPTS = \
325	tableopts.sh
326
327dist_check_SCRIPTS = \
328	options.cn \
329	testwrapper-direct.sh \
330	testwrapper.sh
331
332pthread_pthread_LDADD = @LIBPTHREAD@
333
334# specify how to process .l files in order to test the flex built by make all
335
336FLEX = $(top_builddir)/src/flex
337
338.l.c: $(FLEX)
339	$(AM_V_LEX)$(FLEX) -o $@ $<
340
341.ll.cc: $(FLEX)
342	$(AM_V_LEX)$(FLEX) -+ -o $@ $<
343
344bison_nr_main.$(OBJEXT): bison_nr_parser.h bison_nr_scanner.h
345bison_nr_scanner.$(OBJEXT): bison_nr_parser.h
346
347bison_nr_scanner.h: bison_nr_scanner.c
348	@if test ! -f $@; then rm -f $<; else :; fi
349	@if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) $<; else :; fi
350
351bison_yylloc_main.$(OBJEXT): bison_yylloc_parser.h bison_yylloc_scanner.h
352bison_yylloc_scanner.$(OBJEXT): bison_yylloc_parser.h
353
354bison_yylloc_scanner.h: bison_yylloc_scanner.c
355	@if test ! -f $@; then rm -f $<; else :; fi
356	@if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) $<; else :; fi
357
358bison_yylval_main.$(OBJEXT): bison_yylval_parser.h bison_yylval_scanner.h
359bison_yylval_scanner.$(OBJEXT): bison_yylval_parser.h
360
361bison_yylval_scanner.h: bison_yylval_scanner.c
362	@if test ! -f $@; then rm -f $<; else :; fi
363	@if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) $<; else :; fi
364
365# automake does not support compiling flex scanners output in C as C++
366# so we explicitly sayhow, using the .lll suffix for the lex input file
367
368.lll.cc: $(FLEX)
369	$(AM_V_LEX)$(FLEX) -o $@ $<
370
371header_nr_main.$(OBJEXT): header_nr_scanner.h
372
373header_nr_scanner.h: header_nr_scanner.c
374	@if test ! -f $@; then rm -f $<; else :; fi
375	@if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) $<; else :; fi
376
377header_r_main.$(OBJEXT): header_r_scanner.h
378
379header_r_scanner.h: header_r_scanner.c
380	@if test ! -f $@; then rm -f $<; else :; fi
381	@if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) $<; else :; fi
382
383multiple_scanners_nr_main.$(OBJEXT): multiple_scanners_nr_1.h multiple_scanners_nr_2.h
384
385multiple_scanners_nr_1.h: multiple_scanners_nr_1.c
386	@if test ! -f $@; then rm -f $<; else :; fi
387	@if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) $<; else :; fi
388
389multiple_scanners_nr_2.h: multiple_scanners_nr_2.c
390	@if test ! -f $@; then rm -f $<; else :; fi
391	@if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) $<; else :; fi
392
393multiple_scanners_r_main.$(OBJEXT): multiple_scanners_r_1.h multiple_scanners_r_2.h
394
395multiple_scanners_r_1.h: multiple_scanners_r_1.c
396	@if test ! -f $@; then rm -f $<; else :; fi
397	@if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) $<; else :; fi
398
399multiple_scanners_r_2.h: multiple_scanners_r_2.c
400	@if test ! -f $@; then rm -f $<; else :; fi
401	@if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) $<; else :; fi
402
403posixly_correct.c: posixly_correct.l $(FLEX)
404	$(AM_V_LEX)POSIXLY_CORRECT=1 $(FLEX) -o $@ $<
405
406reject_nr.reject.c: reject.l4 $(FLEX)
407	$(AM_V_LEX)$(FLEX) --unsafe-no-m4-sect3-escape -o $@ $<
408
409reject_nr.reject$(EXEEXT): reject_nr.reject.$(OBJEXT)
410	$(AM_V_CCLD)$(LINK) $^
411
412reject_r.reject.c: reject.l4 $(FLEX)
413	$(AM_V_LEX)$(FLEX) --unsafe-no-m4-sect3-escape --reentrant -o $@ $<
414
415reject_r.reject.$(OBJEXT): reject_r.reject.c
416	$(AM_V_CC)$(COMPILE) -DTEST_IS_REENTRANT -c -o $@ $<
417
418reject_r.reject$(EXEEXT): reject_r.reject.$(OBJEXT)
419	$(AM_V_CCLD)$(LINK) $^
420
421reject_ver.table.c: reject.l4 $(FLEX)
422	$(AM_V_LEX)$(FLEX) --unsafe-no-m4-sect3-escape -o $@ --tables-verify --tables-file=$(basename $@).tables $<
423
424reject_ver.table.$(OBJEXT): reject_ver.table.c
425	$(AM_V_CC)$(COMPILE) -DTEST_HAS_TABLES_EXTERNAL -c -o $@ $<
426
427reject_ver.table$(EXEEXT): reject_ver.table.$(OBJEXT)
428	$(AM_V_CCLD)$(LINK) $^
429
430reject_ser.table.c: reject.l4 $(FLEX)
431	$(AM_V_LEX)$(FLEX) -o $@ --unsafe-no-m4-sect3-escape --tables-file=$(basename $@).tables $<
432
433reject_ser.table.$(OBJEXT): reject_ser.table.c
434	$(AM_V_CC)$(COMPILE) -DTEST_HAS_TABLES_EXTERNAL -c -o $@ $<
435
436reject_ser.table$(EXEEXT): reject_ser.table.$(OBJEXT)
437	$(AM_V_CCLD)$(LINK) $^
438
439top_main.$(OBJEXT): top.h
440top.h: top.c
441
442# We separate out the tableopts _SOURCES variables and the linking
443# rules for those programs because automake has no way to specify such
444# things with a loop in a variable (even though make can do such
445# things) and the resultant list is both long an unenlightening. And
446# it can be / is generated by a shell script, tableopts.sh.
447
448tableopts.am: tableopts.sh
449	$(SHELL) $(srcdir)/tableopts.sh > $(srcdir)/tableopts.am
450
451include $(srcdir)/tableopts.am
452
453tableopts   := -Ca -Ce -Cf -CF -Cm -Cem -Cae -Caef -CaeF -Cam -Caem
454tableopts_opt_tests :=  $(foreach opt,$(tableopts), tableopts_opt_nr$(opt) tableopts_opt_r$(opt))
455tableopts_sertests :=  $(foreach opt,$(tableopts), tableopts_ser_nr$(opt) tableopts_ser_r$(opt))
456tableopts_vertests :=  $(foreach opt,$(tableopts), tableopts_ver_nr$(opt) tableopts_ver_r$(opt))
457tableopts_tests  := $(tableopts_opttests) $(tableopts_vertests) $(tableopts_sertests)
458
459tableopts_c := $(addsuffix .c,$(tableopts_tests))
460
461OPT_LOG_COMPILER = $(SHELL) $(srcdir)/testwrapper.sh
462AM_OPT_LOG_FLAGS = -d $(srcdir) -i $(srcdir)/tableopts.txt -r
463
464tableopts_opt_nr%.c: tableopts.l4 $(FLEX)
465	$(AM_V_LEX)$(FLEX) --unsafe-no-m4-sect3-escape -P $(subst -,_,$(basename $(*F))) $* -o $@ $<
466
467tableopts_opt_nr%.$(OBJEXT): tableopts_opt_nr%.c 
468	$(AM_V_CC)$(COMPILE) -c -o $@ $<
469
470tableopts_opt_r%.c: tableopts.l4 $(FLEX)
471	$(AM_V_LEX)$(FLEX) --unsafe-no-m4-sect3-escape -P $(subst -,_,$(basename $(*F))) --reentrant $*  -o $@ $<
472
473tableopts_opt_r%.$(OBJEXT):  tableopts_opt_r%.c 
474	$(AM_V_CC)$(COMPILE) -DTEST_IS_REENTRANT -c -o $@ $<
475
476SER_LOG_COMPILER = $(SHELL) $(srcdir)/testwrapper.sh
477AM_SER_LOG_FLAGS = -d $(builddir) -i $(srcdir)/tableopts.txt -r -t
478
479tableopts_ser_nr%.c: tableopts.l4 $(FLEX)
480	$(AM_V_LEX)$(FLEX) --unsafe-no-m4-sect3-escape -P $(subst -,_,$(basename $(*F))) --tables-file="tableopts_ser_nr$*.ser.tables"  $* -o $@ $<
481
482tableopts_ser_nr%.$(OBJEXT): tableopts_ser_nr%.c 
483	$(AM_V_CC)$(COMPILE) -DTEST_HAS_TABLES_EXTERNAL -c -o $@ $<
484
485tableopts_ser_r%.c: tableopts.l4 $(FLEX)
486	$(AM_V_LEX)$(FLEX) --unsafe-no-m4-sect3-escape -P $(subst -,_,$(basename $(*F))) -R --tables-file="tableopts_ser_r$*.ser.tables" $*  -o $@ $<
487
488tableopts_ser_r%.$(OBJEXT):  tableopts_ser_r%.c
489	$(AM_V_CC)$(COMPILE) -DTEST_HAS_TABLES_EXTERNAL -DTEST_IS_REENTRANT -c -o $@ $<
490
491VER_LOG_COMPILER = $(SHELL) $(srcdir)/testwrapper.sh
492AM_VER_LOG_FLAGS = -d $(builddir) -i $(srcdir)/tableopts.txt -r -t
493
494tableopts_ver_nr%.c: tableopts.l4 $(FLEX)
495	$(AM_V_LEX)$(FLEX) --unsafe-no-m4-sect3-escape -P $(subst -,_,$(basename $(*F))) --tables-file="tableopts_ver_nr$*.ver.tables" --tables-verify $* -o $@ $<
496
497tableopts_ver_nr%.$(OBJEXT): tableopts_ver_nr%.c 
498	$(AM_V_CC)$(COMPILE) -DTEST_HAS_TABLES_EXTERNAL -c -o $@ $<
499
500tableopts_ver_nr%.ver$(EXEEXT): tableopts_ver_nr%.$(OBJEXT)
501	$(AM_V_CCLD)$(LINK) -o $@ $^
502
503tableopts_ver_r%.c: tableopts.l4 $(FLEX)
504	$(AM_V_LEX)$(FLEX) --unsafe-no-m4-sect3-escape -P $(subst -,_,$(basename $(*F))) -R --tables-file="tableopts_ver_r$*.ver.tables" --tables-verify $*  -o $@ $<
505
506tableopts_ver_r%.$(OBJEXT):  tableopts_ver_r%.c  
507	$(AM_V_CC)$(COMPILE) -DTEST_HAS_TABLES_EXTERNAL -DTEST_IS_REENTRANT -c -o $@ $<
508