1## Process this file with automake to create Makefile.in
2##
3## Copyright (C) 2002-2012 Red Hat, Inc.
4## This file is part of elfutils.
5##
6## This file is free software; you can redistribute it and/or modify
7## it under the terms of either
8##
9##   * the GNU Lesser General Public License as published by the Free
10##     Software Foundation; either version 3 of the License, or (at
11##     your option) any later version
12##
13## or
14##
15##   * the GNU General Public License as published by the Free
16##     Software Foundation; either version 2 of the License, or (at
17##     your option) any later version
18##
19## or both in parallel, as here.
20##
21## elfutils is distributed in the hope that it will be useful, but
22## WITHOUT ANY WARRANTY; without even the implied warranty of
23## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
24## General Public License for more details.
25##
26## You should have received copies of the GNU General Public License and
27## the GNU Lesser General Public License along with this program.  If
28## not, see <http://www.gnu.org/licenses/>.
29##
30include $(top_srcdir)/config/eu.am
31AM_CPPFLAGS += -I$(srcdir)/../libelf -I$(srcdir)/../libebl \
32	    -I$(srcdir)/../libdw -I$(srcdir)/../libasm
33if BUILD_STATIC
34AM_CFLAGS += $(fpic_CFLAGS)
35endif
36AM_CFLAGS += -fdollars-in-identifiers
37LEXCOMPILE = $(LEX) $(LFLAGS) $(AM_LFLAGS) -P$(<F:lex.l=)
38LEX_OUTPUT_ROOT = lex.$(<F:lex.l=)
39AM_YFLAGS = -p$(<F:parse.y=)
40
41noinst_LIBRARIES = libcpu.a libcpu_pic.a
42
43noinst_HEADERS = i386_dis.h x86_64_dis.h
44
45libcpu_a_SOURCES = i386_disasm.c x86_64_disasm.c bpf_disasm.c riscv_disasm.c
46
47libcpu_pic_a_SOURCES =
48am_libcpu_pic_a_OBJECTS = $(libcpu_a_SOURCES:.c=.os)
49
50i386_gendis_SOURCES = i386_gendis.c i386_lex.l i386_parse.y
51
52i386_disasm.o: i386.mnemonics $(srcdir)/i386_dis.h
53x86_64_disasm.o: x86_64.mnemonics $(srcdir)/x86_64_dis.h
54
55%_defs: $(srcdir)/defs/i386
56	$(AM_V_GEN)m4 -D$* -DDISASSEMBLER $< > $@T
57	$(AM_V_at)mv -f $@T $@
58
59if MAINTAINER_MODE
60noinst_HEADERS += memory-access.h i386_parse.h i386_data.h
61
62noinst_PROGRAMS = i386_gendis$(EXEEXT)
63
64$(srcdir)/%_dis.h: %_defs i386_gendis$(EXEEXT)
65	$(AM_V_GEN)./i386_gendis$(EXEEXT) $< > $@T
66	$(AM_V_at)mv -f $@T $@
67
68else
69
70$(srcdir)/%_dis.h:
71	@echo '*** missing $@; configure with --enable-maintainer-mode'
72	@false
73
74endif
75
76%.mnemonics: %_defs
77	$(AM_V_GEN)sed '1,/^%%/d;/^#/d;/^[[:space:]]*$$/d;s/[^:]*:\([^[:space:]]*\).*/MNE(\1)/;s/{[^}]*}//g;/INVALID/d' \
78	  $< | sort -u > $@
79
80i386_lex_no_Werror = yes
81
82libeu = ../lib/libeu.a
83
84i386_lex_CFLAGS = -Wno-unused-label -Wno-unused-function -Wno-sign-compare \
85		  -Wno-implicit-fallthrough
86i386_parse.o: i386_parse.c i386.mnemonics
87i386_parse_CFLAGS = -DNMNES="`wc -l < i386.mnemonics`"
88i386_lex.o: i386_parse.h
89i386_gendis_LDADD = $(libeu) -lm $(obstack_LIBS)
90
91i386_parse.h: i386_parse.c ;
92
93bpf_disasm_CFLAGS = -Wno-format-nonliteral
94
95EXTRA_DIST = defs/i386
96
97MOSTLYCLEANFILES = $(am_libcpu_pic_a_OBJECTS)
98CLEANFILES += $(foreach P,i386 x86_64,$P_defs $P.mnemonics)
99MAINTAINERCLEANFILES = $(foreach P,i386 x86_64, $P_dis.h)
100