1## Process this file with automake to produce Makefile.in
2## Copyright (c) 2001-2003 Philip Kendall
3## Copyright (c) 2015-2016 Sergio Baldoví
4
5## This program is free software; you can redistribute it and/or modify
6## it under the terms of the GNU General Public License as published by
7## the Free Software Foundation; either version 2 of the License, or
8## (at your option) any later version.
9##
10## This program is distributed in the hope that it will be useful,
11## but WITHOUT ANY WARRANTY; without even the implied warranty of
12## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13## GNU General Public License for more details.
14##
15## You should have received a copy of the GNU General Public License along
16## with this program; if not, write to the Free Software Foundation, Inc.,
17## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18##
19## Author contact information:
20##
21## E-mail: philip-fuse@shadowmagic.org.uk
22
23fuse_SOURCES += \
24                z80/z80.c \
25                z80/z80_debugger_variables.c \
26                z80/z80_ops.c
27
28BUILT_SOURCES += \
29                 z80/opcodes_base.c \
30                 z80/z80_cb.c \
31                 z80/z80_ddfd.c \
32                 z80/z80_ddfdcb.c \
33                 z80/z80_ed.c
34
35z80/opcodes_base.c: $(srcdir)/z80/z80.pl $(srcdir)/z80/opcodes_base.dat
36	@$(MKDIR_P) z80
37	$(AM_V_GEN)$(PERL) -I$(srcdir)/perl $(srcdir)/z80/z80.pl $(srcdir)/z80/opcodes_base.dat > $@.tmp && mv $@.tmp $@
38
39z80/z80_cb.c: $(srcdir)/z80/z80.pl $(srcdir)/z80/opcodes_cb.dat
40	@$(MKDIR_P) z80
41	$(AM_V_GEN)$(PERL) -I$(srcdir)/perl $(srcdir)/z80/z80.pl $(srcdir)/z80/opcodes_cb.dat > $@.tmp && mv $@.tmp $@
42
43z80/z80_ddfd.c: $(srcdir)/z80/z80.pl $(srcdir)/z80/opcodes_ddfd.dat
44	@$(MKDIR_P) z80
45	$(AM_V_GEN)$(PERL) -I$(srcdir)/perl $(srcdir)/z80/z80.pl $(srcdir)/z80/opcodes_ddfd.dat > $@.tmp && mv $@.tmp $@
46
47z80/z80_ddfdcb.c: $(srcdir)/z80/z80.pl $(srcdir)/z80/opcodes_ddfd.dat
48	@$(MKDIR_P) z80
49	$(AM_V_GEN)$(PERL) -I$(srcdir)/perl $(srcdir)/z80/z80.pl $(srcdir)/z80/opcodes_ddfdcb.dat > $@.tmp && mv $@.tmp $@
50
51z80/z80_ed.c: $(srcdir)/z80/z80.pl $(srcdir)/z80/opcodes_ed.dat
52	@$(MKDIR_P) z80
53	$(AM_V_GEN)$(PERL) -I$(srcdir)/perl $(srcdir)/z80/z80.pl $(srcdir)/z80/opcodes_ed.dat > $@.tmp && mv $@.tmp $@
54
55noinst_HEADERS += \
56                  z80/z80.h \
57                  z80/z80_checks.h \
58                  z80/z80_internals.h \
59                  z80/z80_macros.h
60
61EXTRA_DIST += \
62              z80/tests/README \
63              z80/tests/tests.expected \
64              z80/tests/tests.in \
65              z80/opcodes_base.c \
66              z80/opcodes_base.dat \
67              z80/opcodes_cb.dat \
68              z80/opcodes_ddfd.dat \
69              z80/opcodes_ddfdcb.dat \
70              z80/opcodes_ed.dat \
71              z80/z80.pl \
72              z80/z80_cb.c \
73              z80/z80_ddfd.c \
74              z80/z80_ddfdcb.c \
75              z80/z80_ed.c
76
77## The core tester
78
79noinst_PROGRAMS += z80/coretest
80
81z80_coretest_SOURCES = z80/coretest.c z80/z80.c
82z80_coretest_LDADD = z80/z80_coretest.o $(GLIB_LIBS) $(LIBSPECTRUM_LIBS)
83z80_coretest_CPPFLAGS = $(GLIB_CFLAGS) $(LIBSPECTRUM_CFLAGS) -DCORETEST
84
85z80/coretest.o: $(srcdir)/z80/coretest.c
86	$(AM_V_CC)$(COMPILE) -DCORETEST -c $(srcdir)/z80/coretest.c -o $@
87
88z80/z80_coretest.o: z80/z80_ops.c
89	$(AM_V_CC)$(COMPILE) -DCORETEST -c $(srcdir)/z80/z80_ops.c -o $@
90
91test: z80/coretest
92	z80/coretest $(srcdir)/z80/tests/tests.in > z80/tests.actual
93	cmp z80/tests.actual $(srcdir)/z80/tests/tests.expected
94
95CLEANFILES += \
96              z80/opcodes_base.c \
97              z80/tests.actual \
98              z80/z80_cb.c \
99              z80/z80_coretest.o \
100              z80/z80_ddfd.c \
101              z80/z80_ddfdcb.c \
102              z80/z80_ed.c
103