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 22TESTS = $(check_PROGRAMS) options.cn 23 24# The script testwrapper.sh will run most tests as is. A couple tests 25# in the suite end in .reject, .table and the like so that we can pass 26# different arguments to the test runner. We list those extensions so 27# automake knows how to distinguish between the various kinds of tests 28# we have. 29 30TEST_EXTENSIONS = .reject .table .direct .cn .i3 .pthread .one .opt .ser .ver 31 32LOG_COMPILER = $(srcdir)/testwrapper.sh 33AM_LOG_FLAGS = -d $(srcdir) -r 34 35REJECT_LOG_COMPILER = $(srcdir)/testwrapper.sh 36AM_REJECT_LOG_FLAGS = -d $(srcdir) -i reject.txt -r 37 38TABLE_LOG_COMPILER = $(srcdir)/testwrapper.sh 39AM_TABLE_LOG_FLAGS = -d $(builddir) -i $(srcdir)/reject.txt -t 40 41DIRECT_LOG_COMPILER=$(srcdir)/testwrapper.sh 42AM_DIRECT_LOG_FLAGS = -d $(srcdir) 43 44CN_LOG_COMPILER=$(srcdir)/options.cn 45AM_CN_LOG_FLAGS=$(FLEX) 46 47I3_LOG_COMPILER=$(srcdir)/testwrapper.sh 48AM_I3_LOG_FLAGS=-i $(srcdir)/cxx_yywrap.txt -i $(srcdir)/cxx_yywrap.txt -i $(srcdir)/cxx_yywrap.txt 49 50PTHREAD_LOG_COMPILER=$(srcdir)/testwrapper.sh 51AM_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 52 53ONE_LOG_COMPILER = $(srcdir)/testwrapper.sh 54AM_ONE_LOG_FLAGS = -1 -d $(srcdir) 55 56AM_YFLAGS = -d -p test 57 58check_PROGRAMS = $(simple_tests) $(reject_tests) $(TABLE_TESTS) $(DIRECT_TESTS) $(I3_TESTS) $(PTHREAD_TESTS) $(ONE_TESTS) $(TABLEOPTS_TESTS) 59 60simple_tests = \ 61 alloc_extra \ 62 array_nr \ 63 array_r \ 64 basic_nr \ 65 basic_r \ 66 bison_nr \ 67 bison_yylloc \ 68 bison_yylval \ 69 c_cxx_nr \ 70 c_cxx_r \ 71 ccl \ 72 cxx_basic \ 73 cxx_multiple_scanners \ 74 debug_nr \ 75 debug_r \ 76 extended \ 77 header_nr \ 78 header_r \ 79 mem_nr \ 80 mem_r \ 81 multiple_scanners_nr \ 82 multiple_scanners_r \ 83 noansi_nr \ 84 noansi_r \ 85 posix \ 86 posixly_correct \ 87 prefix_nr \ 88 prefix_r \ 89 quotes \ 90 string_nr \ 91 string_r \ 92 top \ 93 yyextra 94 95reject_tests = \ 96 reject_nr.reject \ 97 reject_r.reject 98 99TABLE_TESTS = \ 100 reject_ver.table \ 101 reject_ser.table 102 103DIRECT_TESTS = \ 104 include_by_buffer.direct \ 105 include_by_push.direct \ 106 include_by_reentrant.direct \ 107 rescan_nr.direct \ 108 rescan_r.direct 109 110I3_TESTS = \ 111 cxx_yywrap.i3 112 113if want_pthread 114PTHREAD_TESTS = \ 115 pthread.pthread 116endif 117 118ONE_TESTS = \ 119 lineno_nr.one \ 120 lineno_r.one \ 121 lineno_trailing.one 122 123alloc_extra_SOURCES = alloc_extra.l 124array_nr_SOURCES = array_nr.l 125array_r_SOURCES = array_r.l 126basic_nr_SOURCES = basic_nr.l 127basic_r_SOURCES = basic_r.l 128bison_nr_SOURCES = bison_nr_scanner.l bison_nr_parser.y bison_nr_main.c 129bison_yylloc_SOURCES = bison_yylloc_scanner.l bison_yylloc_parser.y bison_yylloc_main.c 130bison_yylval_SOURCES = bison_yylval_scanner.l bison_yylval_parser.y bison_yylval_main.c 131c_cxx_nr_SOURCES = c_cxx_nr.lll 132c_cxx_r_SOURCES = c_cxx_r.lll 133ccl_SOURCES = ccl.l 134cxx_basic_SOURCES = cxx_basic.ll 135cxx_multiple_scanners_SOURCES = cxx_multiple_scanners_main.cc cxx_multiple_scanners_1.ll cxx_multiple_scanners_2.ll 136cxx_yywrap_i3_SOURCES = cxx_yywrap.ll 137debug_nr_SOURCES = debug_nr.l 138debug_r_SOURCES = debug_r.l 139extended_SOURCES = extended.l 140header_nr_SOURCES = header_nr_scanner.l header_nr_main.c 141header_r_SOURCES = header_r_scanner.l header_r_main.c 142include_by_buffer_direct_SOURCES = include_by_buffer.direct.l 143include_by_push_direct_SOURCES = include_by_push.direct.l 144include_by_reentrant_direct_SOURCES = include_by_reentrant.direct.l 145lineno_nr_one_SOURCES = lineno_nr.l 146lineno_r_one_SOURCES = lineno_r.l 147lineno_trailing_one_SOURCES = lineno_trailing.l 148mem_nr_SOURCES = mem_nr.l 149mem_r_SOURCES = mem_r.l 150multiple_scanners_nr_SOURCES = multiple_scanners_nr_main.c multiple_scanners_nr_1.l multiple_scanners_nr_2.l 151multiple_scanners_r_SOURCES = multiple_scanners_r_main.c multiple_scanners_r_1.l multiple_scanners_r_2.l 152noansi_nr_SOURCES = noansi_nr.l 153noansi_r_SOURCES = noansi_r.l 154posix_SOURCES = posix.l 155posixly_correct_SOURCES = posixly_correct.l 156prefix_nr_SOURCES = prefix_nr.l 157prefix_r_SOURCES = prefix_r.l 158pthread_pthread_SOURCES = pthread.l 159quotes_SOURCES = quotes.l 160reject_nr_reject_SOURCES = reject.l4 161reject_r_reject_SOURCES = reject.l4 162reject_ver_table_SOURCES = reject.l4 163reject_ser_table_SOURCES = reject.l4 164rescan_nr_direct_SOURCES = rescan_nr.direct.l 165rescan_r_direct_SOURCES = rescan_r.direct.l 166string_nr_SOURCES = string_nr.l 167string_r_SOURCES = string_r.l 168top_SOURCES = top.l top_main.c 169yyextra_SOURCES = yyextra.l 170 171BUILT_SOURCES = \ 172 bison_nr_parser.h \ 173 bison_nr_scanner.h \ 174 bison_yylloc_parser.h \ 175 bison_yylloc_scanner.h \ 176 bison_yylval_parser.h \ 177 bison_yylval_scanner.h \ 178 header_nr_scanner.h \ 179 header_r_scanner.h \ 180 multiple_scanners_nr_1.h \ 181 multiple_scanners_nr_2.h \ 182 multiple_scanners_r_1.h \ 183 multiple_scanners_r_2.h \ 184 top.h 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 array_nr.c \ 197 array_r.c \ 198 basic_nr.c \ 199 basic_r.c \ 200 bison_nr_parser.c \ 201 bison_nr_parser.h \ 202 bison_nr_scanner.c \ 203 bison_nr_scanner.h \ 204 bison_yylloc_parser.c \ 205 bison_yylloc_parser.h \ 206 bison_yylloc_scanner.c \ 207 bison_yylloc_scanner.h \ 208 bison_yylval_parser.c \ 209 bison_yylval_parser.h \ 210 bison_yylval_scanner.c \ 211 bison_yylval_scanner.h \ 212 c_cxx_nr.cc \ 213 c_cxx_r.cc \ 214 ccl.c \ 215 cxx_basic.cc \ 216 cxx_multiple_scanners_1.cc \ 217 cxx_multiple_scanners_2.cc \ 218 cxx_yywrap.cc \ 219 debug_nr.c \ 220 debug_r.c \ 221 extended.c \ 222 header_nr_scanner.c \ 223 header_nr_scanner.h \ 224 header_r_scanner.c \ 225 header_r_scanner.h \ 226 include_by_buffer.direct.c \ 227 include_by_push.direct.c \ 228 include_by_reentrant.direct.c \ 229 lineno_nr.c \ 230 lineno_r.c \ 231 lineno_trailing.c \ 232 mem_nr.c \ 233 mem_r.c \ 234 multiple_scanners_nr_1.c \ 235 multiple_scanners_nr_1.h \ 236 multiple_scanners_nr_2.c \ 237 multiple_scanners_nr_2.h \ 238 multiple_scanners_r_1.c \ 239 multiple_scanners_r_1.h \ 240 multiple_scanners_r_2.c \ 241 multiple_scanners_r_2.h \ 242 noansi_nr.c \ 243 noansi_r.c \ 244 posix.c \ 245 posixly_correct.c \ 246 prefix_nr.c \ 247 prefix_r.c \ 248 pthread.c \ 249 quotes.c \ 250 reject_nr.reject.c \ 251 reject_r.reject.c \ 252 reject_ser.table.c \ 253 reject_ser.table.tables \ 254 reject_ver.table.c \ 255 reject_ver.table.tables \ 256 rescan_nr.direct.c \ 257 rescan_r.direct.c \ 258 string_nr.c \ 259 string_r.c \ 260 top.c \ 261 top.h \ 262 yyextra.c \ 263alloc_extra.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_yywrap.txt \ 288 debug_nr.txt \ 289 debug_r.txt \ 290 extended.txt \ 291 header_nr.txt \ 292 header_r.txt \ 293 include_by_buffer.direct.txt \ 294 include_by_buffer.direct_2.txt \ 295 include_by_buffer.direct_3.txt \ 296 include_by_push.direct.txt \ 297 include_by_push.direct_2.txt \ 298 include_by_push.direct_3.txt \ 299 include_by_reentrant.direct.txt \ 300 include_by_reentrant.direct_2.txt \ 301 include_by_reentrant.direct_3.txt \ 302 lineno_nr.one.txt \ 303 lineno_r.one.txt \ 304 lineno_trailing.one.txt \ 305 mem_nr.txt \ 306 mem_r.txt \ 307 noansi_nr.txt \ 308 noansi_r.txt \ 309 prefix_nr.txt \ 310 prefix_r.txt \ 311 pthread_1.txt \ 312 pthread_2.txt \ 313 pthread_3.txt \ 314 pthread_4.txt \ 315 pthread_5.txt \ 316 reject.txt \ 317 rescan_nr.direct.txt \ 318 rescan_r.direct.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.sh 330 331pthread_pthread_LDADD = -lpthread 332 333# specify how to process .l files in order to test the flex built by make all 334 335FLEX = $(top_builddir)/src/flex 336 337.l.c: $(FLEX) 338 $(FLEX) -o $@ $< 339 340.ll.cc: $(FLEX) 341 $(FLEX) -+ -o $@ $< 342 343bison_nr_main.($OBJEXT): bison_nr_parser.h bison_nr_scanner.h 344bison_nr_scanner.h: bison_nr_scanner.c 345 346bison_yylloc_main.$(OBJEXT): bison_yylloc_parser.h bison_yylloc_scanner.h 347bison_yylloc_scanner.h: bison_yylloc_scanner.c 348 349bison_yylval_main.$(OBJEXT): bison_yylval_parser.h bison_yylval_scanner.h 350bison_yylval_scanner.h: bison_yylval_scanner.c 351 352# automake does not support compiling flex scanners output in C as C++ 353# so we explicitly sayhow, using the .lll suffix for the lex input file 354 355.lll.cc: $(FLEX) 356 $(FLEX) -o $@ $< 357 358header_nr_main.$(OBJEXT): header_nr_scanner.h 359header_nr_scanner.h: header_nr_scanner.c 360 361header_r_main.$(OBJEXT): header_r_scanner.h 362header_r_scanner.h: header_r_scanner.c 363 364include_by_buffer.direct$(EXE): include_by_buffer.direct.txt include_by_buffer.direct_2.txt include_by_buffer.direct_3.txt 365 366include_by_push.direct$(EXE): include_by_push.direct.txt include_by_push.direct_2.txt include_by_push.direct_3.txt 367 368include_by_reentrant.direct$(EXE): include_by_reentrant.direct.txt include_by_reentrant.direct_2.txt include_by_reentrant.direct_3.txt 369 370multiple_scanners_nr_main.$(OBJEXT): multiple_scanners_nr_1.h multiple_scanners_nr_2.h 371multiple_scanners_nr_1.h: multiple_scanners_nr_1.c 372multiple_scanners_nr_2.h: multiple_scanners_nr_2.c 373 374multiple_scanners_r_main.$(OBJEXT): multiple_scanners_r_1.h multiple_scanners_r_2.h 375multiple_scanners_r_1.h: multiple_scanners_r_1.c 376multiple_scanners_r_2.h: multiple_scanners_r_2.c 377 378posixly_correct.c: posixly_correct.l $(FLEX) 379 POSIXLY_CORRECT=1 $(FLEX) -o $@ $< 380 381reject_nr.reject.c: reject.l4 $(FLEX) 382 $(FLEX) -o $@ $< 383 384reject_nr.reject$(EXEEXT): reject_nr.reject.$(OBJEXT) 385 $(LINK) $^ 386 387reject_r.reject.c: reject.l4 $(FLEX) 388 $(FLEX) --reentrant -o $@ $< 389 390reject_r.reject.$(OBJEXT): reject_r.reject.c 391 $(COMPILE) -DTEST_IS_REENTRANT -c -o $@ $< 392 393reject_r.reject$(EXEEXT): reject_r.reject.$(OBJEXT) 394 $(LINK) $^ 395 396reject_ver.table.c: reject.l4 $(FLEX) 397 $(FLEX) -o $@ --tables-verify --tables-file=$(basename $@).tables $< 398 399reject_ver.table.$(OBJEXT): reject_ver.table.c 400 $(COMPILE) -DTEST_HAS_TABLES_EXTERNAL -c -o $@ $< 401 402reject_ver.table$(EXEEXT): reject_ver.table.$(OBJEXT) 403 $(LINK) $^ 404 405reject_ser.table.c: reject.l4 $(FLEX) 406 $(FLEX) -o $@ --tables-file=$(basename $@).tables $< 407 408reject_ser.table.$(OBJEXT): reject_ser.table.c 409 $(COMPILE) -DTEST_HAS_TABLES_EXTERNAL -c -o $@ $< 410 411reject_ser.table$(EXEEXT): reject_ser.table.$(OBJEXT) 412 $(LINK) $^ 413 414top_main.$(OBJEXT): top.h 415top.h: top.c 416 417# We separate out the tableopts _SOURCES variables and the linking 418# rules for those programs because automake has no way to specify such 419# things with a loop in a variable (even though make can do such 420# things) and the resultant list is both long an unenlightening. And 421# it can be / is generated by a shell script, tableopts.sh. 422 423tableopts.am: tableopts.sh 424 $(srcdir)/tableopts.sh > $(srcdir)/tableopts.am 425 426include $(srcdir)/tableopts.am 427 428tableopts := -Ca -Ce -Cf -CF -Cm -Cem -Cae -Caef -CaeF -Cam -Caem 429tableopts_opt_tests := $(foreach opt,$(tableopts), tableopts_opt_nr$(opt) tableopts_opt_r$(opt)) 430tableopts_sertests := $(foreach opt,$(tableopts), tableopts_ser_nr$(opt) tableopts_ser_r$(opt)) 431tableopts_vertests := $(foreach opt,$(tableopts), tableopts_ver_nr$(opt) tableopts_ver_r$(opt)) 432tableopts_tests := $(tableopts_opttests) $(tableopts_vertests) $(tableopts_sertests) 433 434tableopts_c := $(addsuffix .c,$(tableopts_tests)) 435 436OPT_LOG_COMPILER = $(srcdir)/testwrapper.sh 437AM_OPT_LOG_FLAGS = -d $(srcdir) -i tableopts.txt -r 438 439tableopts_opt_nr%.c: tableopts.l4 $(FLEX) 440 $(FLEX) -P $(subst -,_,$(basename $(*F))) $* -o $@ $< 441 442tableopts_opt_nr%.$(OBJEXT): tableopts_opt_nr%.c 443 $(COMPILE) -c -o $@ $< 444 445tableopts_opt_r%.c: tableopts.l4 $(FLEX) 446 $(FLEX) -P $(subst -,_,$(basename $(*F))) --reentrant $* -o $@ $< 447 448tableopts_opt_r%.$(OBJEXT): tableopts_opt_r%.c 449 $(COMPILE) -DTEST_IS_REENTRANT -c -o $@ $< 450 451SER_LOG_COMPILER = $(srcdir)/testwrapper.sh 452AM_SER_LOG_FLAGS = -d $(builddir) -i $(srcdir)/tableopts.txt -r -t 453 454tableopts_ser_nr%.c: tableopts.l4 $(FLEX) 455 $(FLEX) -P $(subst -,_,$(basename $(*F))) --tables-file="tableopts_ser_nr$*.ser.tables" $* -o $@ $< 456 457tableopts_ser_nr%.$(OBJEXT): tableopts_ser_nr%.c 458 $(COMPILE) -DTEST_HAS_TABLES_EXTERNAL -c -o $@ $< 459 460tableopts_ser_r%.c: tableopts.l4 $(FLEX) 461 $(FLEX) -P $(subst -,_,$(basename $(*F))) -R --tables-file="tableopts_ser_r$*.ser.tables" $* -o $@ $< 462 463tableopts_ser_r%.$(OBJEXT): tableopts_ser_r%.c 464 $(COMPILE) -DTEST_HAS_TABLES_EXTERNAL -DTEST_IS_REENTRANT -c -o $@ $< 465 466VER_LOG_COMPILER = $(srcdir)/testwrapper.sh 467AM_VER_LOG_FLAGS = -d $(builddir) -i $(srcdir)/tableopts.txt -r -t 468 469tableopts_ver_nr%.c: tableopts.l4 $(FLEX) 470 $(FLEX) -P $(subst -,_,$(basename $(*F))) --tables-file="tableopts_ver_nr$*.ver.tables" --tables-verify $* -o $@ $< 471 472tableopts_ver_nr%.$(OBJEXT): tableopts_ver_nr%.c 473 $(COMPILE) -DTEST_HAS_TABLES_EXTERNAL -c -o $@ $< 474 475tableopts_ver_nr%.ver$(EXEEXT): tableopts_ver_nr%.$(OBJEXT) 476 $(LINK) -o $@ $^ 477 478tableopts_ver_r%.c: tableopts.l4 $(FLEX) 479 $(FLEX) -P $(subst -,_,$(basename $(*F))) -R --tables-file="tableopts_ver_r$*.ver.tables" --tables-verify $* -o $@ $< 480 481tableopts_ver_r%.$(OBJEXT): tableopts_ver_r%.c 482 $(COMPILE) -DTEST_HAS_TABLES_EXTERNAL -DTEST_IS_REENTRANT -c -o $@ $< 483