1# generate source files which requires extra prerequisites
2# mosh/bison/re2c
3#
4# this file used by both gen-git-build.sh and Makefile.am
5#  1) do not use special Automake constructs (including
6#   Autoconf predicates like "if DEVELOPER")
7#  2) this file uses following variable
8#    top_srcdir: Autoconf sets this variable to apropriate
9#    directory path for the user invoked configure script.
10
11#### Instruction.h
12
13src/Instruction.h: src/instruction.scm
14	mosh $(top_srcdir)/misc/scripts/gen-insn.scm $< $@
15
16src/main.cpp: src/psyntax_mosh_image.cpp src/baselib.h src/match.h
17
18src/labels.cpp: src/instruction.scm
19	mosh $(top_srcdir)/misc/scripts/gen-label.scm $< $@
20
21src/cprocedures.cpp: boot/free-vars-decl.scm
22	mosh $(top_srcdir)/misc/scripts/gen-cproc.scm $< $@
23
24src/all-tests.scm: src/test-data.scm
25	(cd $(top_srcdir) && mosh -5 misc/scripts/gen-test.scm src/test-data.scm src/all-tests.scm)
26#	echo 'run -5 misc/scripts/gen-test.scm test-data.scm all-tests.scm ' | gdb ./mosh
27
28src/Object-accessors.h: src/accessors.scm
29	(cd $(top_srcdir) && mosh misc/scripts/gen-accessors.scm) > $@
30
31src/OSConstants.h: src/os-constants.scm
32	(cd $(top_srcdir) && mosh misc/scripts/gen-os-constants.scm) > $@
33
34# READER
35
36src/Reader.tab.cpp src/Reader.tab.hpp: src/Reader.y
37	bison -d $< -o src/Reader.tab.cpp
38
39src/NumberReader.tab.cpp src/NumberReader.tab.hpp: src/NumberReader.y
40	bison -p "number_yy" -d $< -o src/NumberReader.tab.cpp
41
42src/Scanner.cpp : src/scanner.re
43	re2c -u $< > $@ # -d is debug option
44
45src/NumberScanner.cpp : src/NumberScanner.re
46	re2c -cu $< > $@ # -d is debug option
47
48## N.B. Do not use -g (optimization) option. -u causes YYCURSOR bug.
49##      for " \ " yen mark, -g causes infinite loop
50