1 ## Process this file with automake to create Makefile.in
3 ## Copyright (C) 2002-2012 Red Hat, Inc.
4 ## This file is part of elfutils.
6 ## This file is free software; you can redistribute it and/or modify
7 ## it under the terms of either
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
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
19 ## or both in parallel, as here.
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.
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/>.
30 include $(top_srcdir)/config/eu.am
31 AM_CPPFLAGS += -I$(srcdir)/../libelf -I$(srcdir)/../libebl \
32 -I$(srcdir)/../libdw -I$(srcdir)/../libasm
34 AM_CFLAGS += $(fpic_CFLAGS)
36 AM_CFLAGS += -fdollars-in-identifiers
37 LEXCOMPILE = $(LEX) $(LFLAGS) $(AM_LFLAGS) -P$(<F:lex.l=)
38 LEX_OUTPUT_ROOT = lex.$(<F:lex.l=)
39 AM_YFLAGS = -p$(<F:parse.y=)
41 noinst_LIBRARIES = libcpu.a libcpu_pic.a
43 noinst_HEADERS = i386_dis.h x86_64_dis.h
45 libcpu_a_SOURCES = i386_disasm.c x86_64_disasm.c bpf_disasm.c riscv_disasm.c
47 libcpu_pic_a_SOURCES =
48 am_libcpu_pic_a_OBJECTS = $(libcpu_a_SOURCES:.c=.os)
50 i386_gendis_SOURCES = i386_gendis.c i386_lex.l i386_parse.y
52 i386_disasm.o: i386.mnemonics $(srcdir)/i386_dis.h
53 x86_64_disasm.o: x86_64.mnemonics $(srcdir)/x86_64_dis.h
55 %_defs: $(srcdir)/defs/i386
56 $(AM_V_GEN)m4 -D$* -DDISASSEMBLER $< > $@T
57 $(AM_V_at)mv -f $@T $@
60 noinst_HEADERS += memory-access.h i386_parse.h i386_data.h
62 noinst_PROGRAMS = i386_gendis$(EXEEXT)
64 # i386_gendis doesn't clean up, ignore leaks.
65 # It is just a build tool to generate source in maintainer mode.
66 if USE_ADDRESS_SANITIZER
67 GENDIS_ENV=env ASAN_OPTIONS=detect_leaks=0
72 $(srcdir)/%_dis.h: %_defs i386_gendis$(EXEEXT)
73 $(AM_V_GEN) $(GENDIS_ENV) ./i386_gendis$(EXEEXT) $< > $@T
74 $(AM_V_at)mv -f $@T $@
79 @echo '*** missing $@; configure with --enable-maintainer-mode'
85 $(AM_V_GEN)sed '1,/^%%/d;/^#/d;/^[[:space:]]*$$/d;s/[^:]*:\([^[:space:]]*\).*/MNE(\1)/;s/{[^}]*}//g;/INVALID/d' \
88 i386_lex_no_Werror = yes
90 libeu = ../lib/libeu.a
92 i386_lex_CFLAGS = -Wno-unused-label -Wno-unused-function -Wno-sign-compare \
93 -Wno-implicit-fallthrough
94 i386_parse.o: i386_parse.c i386.mnemonics
95 i386_parse_CFLAGS = -DNMNES="`wc -l < i386.mnemonics`"
96 i386_lex.o: i386_parse.h
97 i386_gendis_LDADD = $(libeu) -lm $(obstack_LIBS)
99 i386_parse.h: i386_parse.c ;
101 bpf_disasm_CFLAGS = -Wno-format-nonliteral
103 EXTRA_DIST = defs/i386
105 MOSTLYCLEANFILES = $(am_libcpu_pic_a_OBJECTS)
106 CLEANFILES += $(foreach P,i386 x86_64,$P_defs $P.mnemonics)
107 MAINTAINERCLEANFILES = $(foreach P,i386 x86_64, $P_dis.h)