1## Process this file with automake to create Makefile.in
2##
3## Copyright (C) 2002, 2004, 2005, 2007, 2008 Red Hat, Inc.
4## This file is part of Red Hat elfutils.
5##
6## Red Hat elfutils is free software; you can redistribute it and/or modify
7## it under the terms of the GNU General Public License as published by the
8## Free Software Foundation; version 2 of the License.
9##
10## Red Hat elfutils is distributed in the hope that it will be useful, but
11## WITHOUT ANY WARRANTY; without even the implied warranty of
12## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13## General Public License for more details.
14##
15## You should have received a copy of the GNU General Public License along
16## with Red Hat elfutils; if not, write to the Free Software Foundation,
17## Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
18##
19## Red Hat elfutils is an included package of the Open Invention Network.
20## An included package of the Open Invention Network is a package for which
21## Open Invention Network licensees cross-license their patents.  No patent
22## license is granted, either expressly or impliedly, by designation as an
23## included package.  Should you wish to participate in the Open Invention
24## Network licensing program, please visit www.openinventionnetwork.com
25## <http://www.openinventionnetwork.com>.
26##
27DEFS = -D_GNU_SOURCE -DHAVE_CONFIG_H
28if MUDFLAP
29AM_CFLAGS = -fmudflap
30else
31AM_CFLAGS =
32endif
33AM_CFLAGS += -Wall -Wshadow -Wunused -Wextra -std=gnu99 -fpic \
34	     $($(*F)_CFLAGS) \
35	     $(if $($(*F)_no_Werror),,-Werror)
36INCLUDES = -I$(srcdir) -I$(srcdir)/../lib -I$(srcdir)/../libelf \
37	   -I$(srcdir)/../libebl -I$(srcdir)/../libdw -I$(srcdir)/../libasm
38LEXCOMPILE = $(LEX) $(LFLAGS) $(AM_LFLAGS) -P$(<F:lex.l=)
39LEX_OUTPUT_ROOT = lex.$(<F:lex.l=)
40AM_YFLAGS = -p$(<F:parse.y=)
41
42if MUDFLAP
43libmudflap = -lmudflap
44endif
45
46noinst_LIBRARIES = libcpu_i386.a libcpu_x86_64.a
47noinst_PROGRAMS = i386_gendis
48
49libcpu_i386_a_SOURCES = i386_disasm.c
50libcpu_x86_64_a_SOURCES = x86_64_disasm.c
51
52i386_gendis_SOURCES = i386_gendis.c i386_lex.l i386_parse.y
53
54i386_disasm.o: i386.mnemonics i386_dis.h
55x86_64_disasm.o: x86_64.mnemonics x86_64_dis.h i386_disasm.c
56
57i386_dis.h: i386_gendis $(srcdir)/defs/i386
58	m4 -Di386 -DDISASSEMBLER $(srcdir)/defs/i386 | ./i386_gendis - > $@
59x86_64_dis.h: i386_gendis $(srcdir)/defs/i386
60	m4 -Dx86_64 -DDISASSEMBLER $(srcdir)/defs/i386 | ./i386_gendis - > $@
61
62i386.mnemonics x86_64.mnemonics: %.mnemonics: $(srcdir)/defs/i386
63	m4 -D$(@:.mnemonics=) -DDISASSEMBLER $^ \
64	| sed '1,/^%%/d;/^#/d;/^[[:space:]]*$$/d;s/[^:]*:\([^[:space:]]*\).*/MNE(\1)/;s/{[^}]*}//g;/INVALID/d' \
65	| sort -u > $@
66
67i386_lex_no_Werror = yes
68
69libeu = ../lib/libeu.a
70
71i386_lex_CFLAGS = -Wno-unused-label -Wno-unused-function -Wno-sign-compare
72i386_parse.o: i386_parse.c i386.mnemonics
73i386_parse_CFLAGS = -DNMNES=$$(wc -l < i386.mnemonics)
74i386_lex.o: i386_parse.h
75i386_gendis_LDADD = $(libeu) -lm $(libmudflap)
76
77i386_parse.h: i386_parse.c ;
78
79noinst_HEADERS = memory-access.h i386_parse.h i386_data.h
80
81EXTRA_DIST = defs/i386
82
83CLEANFILES = i386.mnemonics i386_dis.h x86_64.mnemonics x86_64_dis.h
84