diff options
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | src/arch/arm/v7/opdefs/Makefile.am | 14 | ||||
-rw-r--r-- | tools/d2c.mk | 11 |
3 files changed, 27 insertions, 4 deletions
@@ -1,3 +1,9 @@ +14-10-12 Cyrille Bagard <nocbos@gmail.com> + + * src/arch/arm/v7/opdefs/Makefile.am: + * tools/d2c.mk: + Modify and rebuild targets only when needed. + 14-10-11 Cyrille Bagard <nocbos@gmail.com> * 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\ <stdint.h>\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\ <stdint.h>\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' {} \; |