Home | History | Annotate | Download | only in libcpu
      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 ##
     27 DEFS = -D_GNU_SOURCE -DHAVE_CONFIG_H
     28 if MUDFLAP
     29 AM_CFLAGS = -fmudflap
     30 else
     31 AM_CFLAGS =
     32 endif
     33 AM_CFLAGS += -Wall -Wshadow -Wunused -Wextra -std=gnu99 -fpic \
     34 	     $($(*F)_CFLAGS) \
     35 	     $(if $($(*F)_no_Werror),,-Werror)
     36 INCLUDES = -I$(srcdir) -I$(srcdir)/../lib -I$(srcdir)/../libelf \
     37 	   -I$(srcdir)/../libebl -I$(srcdir)/../libdw -I$(srcdir)/../libasm
     38 LEXCOMPILE = $(LEX) $(LFLAGS) $(AM_LFLAGS) -P$(<F:lex.l=)
     39 LEX_OUTPUT_ROOT = lex.$(<F:lex.l=)
     40 AM_YFLAGS = -p$(<F:parse.y=)
     41 
     42 if MUDFLAP
     43 libmudflap = -lmudflap
     44 endif
     45 
     46 noinst_LIBRARIES = libcpu_i386.a libcpu_x86_64.a
     47 noinst_PROGRAMS = i386_gendis
     48 
     49 libcpu_i386_a_SOURCES = i386_disasm.c
     50 libcpu_x86_64_a_SOURCES = x86_64_disasm.c
     51 
     52 i386_gendis_SOURCES = i386_gendis.c i386_lex.l i386_parse.y
     53 
     54 i386_disasm.o: i386.mnemonics i386_dis.h
     55 x86_64_disasm.o: x86_64.mnemonics x86_64_dis.h i386_disasm.c
     56 
     57 i386_dis.h: i386_gendis $(srcdir)/defs/i386
     58 	m4 -Di386 -DDISASSEMBLER $(srcdir)/defs/i386 | ./i386_gendis - > $@
     59 x86_64_dis.h: i386_gendis $(srcdir)/defs/i386
     60 	m4 -Dx86_64 -DDISASSEMBLER $(srcdir)/defs/i386 | ./i386_gendis - > $@
     61 
     62 i386.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 
     67 i386_lex_no_Werror = yes
     68 
     69 libeu = ../lib/libeu.a
     70 
     71 i386_lex_CFLAGS = -Wno-unused-label -Wno-unused-function -Wno-sign-compare
     72 i386_parse.o: i386_parse.c i386.mnemonics
     73 i386_parse_CFLAGS = -DNMNES=$$(wc -l < i386.mnemonics)
     74 i386_lex.o: i386_parse.h
     75 i386_gendis_LDADD = $(libeu) -lm $(libmudflap)
     76 
     77 i386_parse.h: i386_parse.c ;
     78 
     79 noinst_HEADERS = memory-access.h i386_parse.h i386_data.h
     80 
     81 EXTRA_DIST = defs/i386
     82 
     83 CLEANFILES = i386.mnemonics i386_dis.h x86_64.mnemonics x86_64_dis.h
     84