From 7fa2dc35ccd305da5a4896a4de8086c0f4db4fca Mon Sep 17 00:00:00 2001 From: Cyrille Bagard Date: Sat, 11 Oct 2014 22:08:17 +0000 Subject: Modified and rebuilt targets only when needed. git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@412 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a --- ChangeLog | 6 ++++++ src/arch/arm/v7/opdefs/Makefile.am | 14 +++++++++++--- tools/d2c.mk | 11 ++++++++++- 3 files changed, 27 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index a75ba6b..b8eabf4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +14-10-12 Cyrille Bagard + + * src/arch/arm/v7/opdefs/Makefile.am: + * tools/d2c.mk: + Modify and rebuild targets only when needed. + 14-10-11 Cyrille Bagard * src/analysis/disass/fetch.c: diff --git a/src/arch/arm/v7/opdefs/Makefile.am b/src/arch/arm/v7/opdefs/Makefile.am index 8a799b1..f2c5a35 100644 --- a/src/arch/arm/v7/opdefs/Makefile.am +++ b/src/arch/arm/v7/opdefs/Makefile.am @@ -27,11 +27,19 @@ ARMV7_DEFS = \ all: $(ARMV7_DEFS:.d=.g) untabify_disass fix_includes_in_c finish_disass fix_includes_in_c: - find ../opcodes -name '*c' -exec sed -i 's/##INCLUDES##/\n#include "..\/instruction.h"\n#include "..\/..\/instruction.h"\n#include "..\/helpers.h"\n#include "..\/..\/..\/..\/common\/bconst.h"\n\n/' {} \; + @for f in `find ../opcodes -name '*c'`; do \ + if grep -q '##INCLUDES##' $$f; then \ + $(fix_verbose)sed -i 's/##INCLUDES##/\n#include "..\/instruction.h"\n#include "..\/..\/instruction.h"\n#include "..\/helpers.h"\n#include "..\/..\/..\/..\/common\/bconst.h"\n\n/' $$f; \ + fi; \ + done finish_disass: $(D2C_OUTDIR)/opcodes/opcodes.h - sed -i 's/##INCLUDES##/#include\ \n\n#include "..\/..\/..\/instruction.h"/' $< - if ! grep -q 'endif' $<; then echo -en "\n\n#endif /* _ARCH_ARM_V7_OPCODES_OPCODES_H */\n" >> $< ; fi + @if grep -q '##INCLUDES##' $<; then \ + $(fix2_verbose)sed -i 's/##INCLUDES##/#include\ \n\n#include "..\/..\/..\/instruction.h"/' $< ; \ + fi + @if ! grep -q 'endif' $<; then \ + $(fix2_verbose)echo -en "\n\n#endif /* _ARCH_ARM_V7_OPCODES_OPCODES_H */\n" >> $< ; \ + fi clean: rm -f $(ARMV7_DEFS:.d=.g) $(D2C_OUTDIR)/opcodes/*c $(D2C_OUTDIR)/opcodes/opcodes.h diff --git a/tools/d2c.mk b/tools/d2c.mk index 78cc374..25596cf 100644 --- a/tools/d2c.mk +++ b/tools/d2c.mk @@ -5,6 +5,14 @@ d2c_verbose = $(d2c_verbose_@AM_V@) d2c_verbose_ = $(d2c_verbose_@AM_DEFAULT_V@) d2c_verbose_0 = @echo " D2C " $<; +fix_verbose = $(fix_verbose_@AM_V@) +fix_verbose_ = $(fix_verbose_@AM_DEFAULT_V@) +fix_verbose_0 = echo " FIX " `basename $$f`; + +fix2_verbose = $(fix2_verbose_@AM_V@) +fix2_verbose_ = $(fix2_verbose_@AM_DEFAULT_V@) +fix2_verbose_0 = echo " FIX " `basename $<`; + # D2C_BIN = # D2C_OUTDIR = # D2C_ARCH = @@ -18,5 +26,6 @@ SUFFIXES = .g $(d2c_verbose)$(D2C_BIN) -d $(D2C_OUTDIR) -a $(D2C_ARCH) -H $(D2C_HEADER) $(D2C_ENCODINGS) $(D2C_MACROS) < $< @touch $@ +# Merci http://www.commandlinefu.com/commands/view/10276/grep-tab-t untabify_disass: - find $(D2C_OUTDIR)/opcodes -name '*c' -exec sed -i 's/\t/ /g' {} \; + find $(D2C_OUTDIR)/opcodes -name '*c' -exec grep -q $$'\t' {} \; -exec sed -i 's/\t/ /g' {} \; -- cgit v0.11.2-87-g4458