Imported Upstream version 0.153
[platform/upstream/elfutils.git] / libcpu / Makefile.am
1 ## Process this file with automake to create Makefile.in
2 ##
3 ## Copyright (C) 2002-2011 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 ##
27 include $(top_srcdir)/config/eu.am
28 INCLUDES += -I$(srcdir)/../libelf -I$(srcdir)/../libebl \
29             -I$(srcdir)/../libdw -I$(srcdir)/../libasm
30 AM_CFLAGS += -fpic -fdollars-in-identifiers
31 LEXCOMPILE = $(LEX) $(LFLAGS) $(AM_LFLAGS) -P$(<F:lex.l=)
32 LEX_OUTPUT_ROOT = lex.$(<F:lex.l=)
33 AM_YFLAGS = -p$(<F:parse.y=)
34
35 noinst_LIBRARIES = libcpu_i386.a libcpu_x86_64.a
36
37 libcpu_i386_a_SOURCES = i386_disasm.c i386_dis.h
38 libcpu_x86_64_a_SOURCES = x86_64_disasm.c x86_64_dis.h
39
40 i386_gendis_SOURCES = i386_gendis.c i386_lex.l i386_parse.y
41
42 i386_disasm.o: i386.mnemonics $(srcdir)/i386_dis.h
43 x86_64_disasm.o: x86_64.mnemonics $(srcdir)/x86_64_dis.h
44
45 %_defs: $(srcdir)/defs/i386
46         m4 -D$* -DDISASSEMBLER $< > $@
47
48 if MAINTAINER_MODE
49 noinst_HEADERS = memory-access.h i386_parse.h i386_data.h
50
51 noinst_PROGRAMS = i386_gendis
52
53 $(srcdir)/%_dis.h: %_defs i386_gendis
54         ./i386_gendis $< > $@
55 endif
56
57 %.mnemonics: %_defs
58         sed '1,/^%%/d;/^#/d;/^[[:space:]]*$$/d;s/[^:]*:\([^[:space:]]*\).*/MNE(\1)/;s/{[^}]*}//g;/INVALID/d' \
59           $< | sort -u > $@
60
61 i386_lex_no_Werror = yes
62
63 libeu = ../lib/libeu.a
64
65 i386_lex_CFLAGS = -Wno-unused-label -Wno-unused-function -Wno-sign-compare
66 i386_parse.o: i386_parse.c i386.mnemonics
67 i386_parse_CFLAGS = -DNMNES="`wc -l < i386.mnemonics`"
68 i386_lex.o: i386_parse.h
69 i386_gendis_LDADD = $(libeu) -lm $(libmudflap)
70
71 i386_parse.h: i386_parse.c ;
72
73 EXTRA_DIST = defs/i386
74
75 CLEANFILES += $(foreach P,i386 x86_64,$P_defs $P.mnemonics $P_dis.h)