#
# See the file README for details. The impatient can try
#
# ./configure.pl && make
#
# Calling make without previous configure.pl will give
# an amazing amount of uncomprehensible error messages.
#
# all: infection html_deps
all: infection scanner html_deps

include config-$(HOSTNAME).mak

calc: $(TEVWH_OUT_XML)/calc.xml
$(TEVWH_OUT_XML)/calc.xml: etc/calc.pl 
	. ./config-$(HOSTNAME).sh && etc/calc.pl "-xml=$@"

HTML = file://$(TEVWH_PWD)/_html/index.html
DVI = file://$(TEVWH_PWD)/_dvi/$(TEVWH_DIRNAME).dvi

DSL = etc/ldp.dsl
SCANNER_BIG = '' /bin /sbin /usr/bin /usr/sbin /usr/lib
SCANNER_SMALL = _infected $(TEVWH_TMP)

# .S is assembly source code
# .asm is disassember output
.SUFFIXES: .inc .gdb .S .asm

personal:
	- rm "${HOME}/.aspell.english.pws"
	aspell create personal < etc/dict.txt 

mkdir: ; etc/mkdir.sh | xargs mkdir -p 2> /dev/null

infection: \
	mkdir \
	packages \
	magic_elf \
	evil_magic \
	readelf \
	segment_padding \
	one_step_closer \
	entry_point \
	infection_$(TEVWH_ARCH)

infection_ppc:
infection_alpha:
infection_sparc:
infection_i386: \
	additional_cs \
	doing_it_in_c  \
	stub_revisited \
	suspicious_code

scanner: \
	$(TEVWH_OUT)/scanner/dist_big \
	$(TEVWH_OUT)/scanner/entry_point_big \
	$(TEVWH_OUT)/scanner/dist_small \
	$(TEVWH_OUT)/scanner/entry_point_small

packages: \
	$(TEVWH_OUT)/packages/man-all \
	$(TEVWH_OUT)/packages/man-section \
	$(TEVWH_OUT)/packages/du \
	$(TEVWH_OUT)/packages/simple \
	packages_$(TEVWH_OS_PKG_SYS)
packages_rpm: \
	$(TEVWH_OUT)/packages/rpm/custom \
	$(TEVWH_OUT)/packages/verify \
	$(TEVWH_OUT)/packages/verify-all
packages_deb: \
	$(TEVWH_OUT)/packages/deb/avail \
	$(TEVWH_OUT)/packages/deb/perl \
	$(TEVWH_OUT)/packages/deb/hard \
	$(TEVWH_OUT)/packages/verify
packages_SunOS: \
	$(TEVWH_OUT)/packages/SunOS/version \
	$(TEVWH_OUT)/packages/verify
packages_slackware:

magic_elf: \
	$(TEVWH_OUT)/magic_elf/magic_elf \
	$(TEVWH_OUT)/magic_elf/magic_elf_static \
	$(TEVWH_OUT)/magic_elf/strings \
	$(TEVWH_OUT)/magic_elf/od \
	$(TEVWH_OUT)/magic_elf/gdb \
	$(TEVWH_OUT)/magic_elf/addr_of_main \
	$(TEVWH_OUT)/magic_elf/other_perl \
	$(TEVWH_OUT)/magic_elf/other_exe \
	$(TEVWH_OUT)/magic_elf/objdump.asm \
	magic_elf_$(TEVWH_HAVE_PATH_HEXDUMP) \
	magic_elf_$(TEVWH_HAVE_PATH_XXD) \
	magic_elf_$(TEVWH_ARCH) \
	magic_elf_$(TEVWH_UNAME)
magic_elf_:
magic_elf_hexdump: \
	$(TEVWH_OUT)/magic_elf/hexdump
magic_elf_xxd: \
	$(TEVWH_OUT)/magic_elf/xxd

magic_elf_alpha:
magic_elf_ppc:
magic_elf_sparc: 
magic_elf_i386: \
	$(TEVWH_OUT)/magic_elf/ndisasm.asm
magic_elf_SunOS:
magic_elf_FreeBSD \
magic_elf_Linux: \
	$(TEVWH_OUT)/magic_elf/other_mem

evil_magic: \
	$(TEVWH_OUT)/evil_magic/write.gdb \
	$(TEVWH_OUT)/evil_magic/ofs_entry \
	$(TEVWH_OUT)/evil_magic/static_main.gdb \
	$(TEVWH_OUT)/evil_magic/static_write.gdb \
	$(TEVWH_OUT)/evil_magic/nm \
	$(TEVWH_OUT)/evil_magic/gdb_nm \
	$(TEVWH_OUT)/evil_magic/$(TEVWH_ASM_STYLE) \
	$(TEVWH_OUT)/evil_magic/od \
	$(TEVWH_OUT)/evil_magic/e_entry \
	$(TEVWH_OUT)/evil_magic/$(TEVWH_ASM_STYLE).asm \
	$(TEVWH_OUT)/evil_magic/evil_magic.c \
	$(TEVWH_OUT)/evil_magic/cc \
	$(TEVWH_OUT)/evil_magic/self_modify

readelf: \
	$(TEVWH_OUT)/readelf/segments/objdump \
	$(TEVWH_OUT)/readelf/sections/objdump \
	readelf_$(TEVWH_HAVE_PATH_READELF) \
	readelf_$(TEVWH_HAVE_PATH_ELFDUMP) \
	$(TEVWH_OUT)/readelf/sh/segments/objdump \
	$(TEVWH_OUT)/readelf/sh/sections/objdump
readelf_:
readelf_readelf: \
	$(TEVWH_OUT)/readelf/segments/readelf \
	$(TEVWH_OUT)/readelf/sections/readelf \
	$(TEVWH_OUT)/readelf/sh/segments/readelf \
	$(TEVWH_OUT)/readelf/sh/sections/readelf
readelf_elfdump: \
	$(TEVWH_OUT)/readelf/sections/elfdump \
	$(TEVWH_OUT)/readelf/segments/elfdump

segment_padding: \
	$(TEVWH_OUT)/segment_padding/sysconf \
	$(TEVWH_OUT)/segment_padding/objdump \
	a_closer_look_$(TEVWH_HAVE_PATH_READELF) \
	$(TEVWH_OUT)/segment_padding/scan
a_closer_look_:
a_closer_look_readelf: \
	$(TEVWH_OUT)/segment_padding/readelf

entry_point: \
	$(TEVWH_OUT)/entry_point/sh.gdb \
	$(TEVWH_OUT)/entry_point/ldd \
	entry_point_$(TEVWH_ARCH)
entry_point_alpha:
entry_point_ppc:
entry_point_sparc: 
entry_point_i386: \
	$(TEVWH_OUT)/entry_point/nm \
	$(TEVWH_OUT)/entry_point/sh.disasm \
	$(TEVWH_OUT)/entry_point/e2.disasm \
	$(TEVWH_OUT)/entry_point/e3.disasm \
	$(TEVWH_OUT)/entry_point/entry_point \

#	$(TEVWH_PRE)/entry_point/__libc_start_main \

one_step_closer: \
	$(TEVWH_OUT)/one_step_closer/test-e1i1 \
	one_step_closer_$(TEVWH_ARCH)
one_step_closer_ppc:
one_step_closer_alpha:
one_step_closer_sparc:
one_step_closer_i386: \
	$(TEVWH_OUT)/one_step_closer/test-e2i1 \
	$(TEVWH_OUT)/one_step_closer/test-e3i1

additional_cs: \
	$(TEVWH_OUT)/additional_cs/hexdump \
	$(TEVWH_OUT)/additional_cs/test \
	$(TEVWH_OUT)/additional_cs/scan \
	$(TEVWH_OUT)/additional_cs/objdump \
	additional_cs_$(TEVWH_HAVE_PATH_READELF)
additional_cs:
additional_cs_readelf: \
	$(TEVWH_OUT)/additional_cs/readelf

doing_it_in_c: \
	$(TEVWH_OUT)/doing_it_in_c/get_relocate_ofs.disasm \
	$(TEVWH_OUT)/doing_it_in_c/i1/infection.inc \
	$(TEVWH_OUT)/doing_it_in_c/begin.disasm \
	$(TEVWH_OUT)/doing_it_in_c/addr \
	$(TEVWH_OUT)/doing_it_in_c/e3i1.disasm \
	$(TEVWH_OUT)/doing_it_in_c/e3i2.disasm \
	$(TEVWH_OUT)/doing_it_in_c/e3i3.disasm \
	$(TEVWH_OUT)/doing_it_in_c/test-e3i1 \
	$(TEVWH_OUT)/doing_it_in_c/test-e3i2 \
	$(TEVWH_OUT)/doing_it_in_c/test-e3i3

stub_revisited: \
	$(TEVWH_OUT)/stub_revisited/magic_elf.disasm \
	$(TEVWH_OUT)/stub_revisited/sh.disasm \
	$(TEVWH_OUT)/stub_revisited/sh_ret.disasm \
	$(TEVWH_OUT)/stub_revisited/$(TEVWH_NAME_SH)_infected.disasm \
	$(TEVWH_OUT)/stub_revisited/stack

#	$(TEVWH_PRE)/stub_revisited/__libc_start_main

suspicious_code: \
	$(TEVWH_OUT)/suspicious_code/disasm

clean:
	rm -rf config.xml config-* pre/ tmp/ out/ _* $(TEVWH_DIRNAME).junk
	find . -type f \
		-name '*.bak' \
		-o -name '*.orig' \
		-o -name '*~' \
		-o -name '*.fot' \
		-o -name '*infected' \
		-o -name '*.core' \
		-o -name 'core.*' \
		-o -name core \
		-o -name log \
	| xargs rm -f

$(TEVWH_OUT_XML)/ulink.xml: etc/ulink.pl etc/http.dat etc/ftp.dat
	etc/ulink.pl -PROTO=http -DIR=$(TEVWH_OUT_XML) etc/http.dat > $@
	etc/ulink.pl -PROTO=ftp -DIR=$(TEVWH_OUT_XML) etc/ftp.dat >> $@

html_deps: mkdir $(TEVWH_OUT_XML)/ulink.xml $(TEVWH_OUT_XML)/calc.xml

dsl: $(DSL) etc/patch_dsl.pl
	etc/patch_dsl.pl -dsl=$(DSL)

intro: html_deps
	etc/mkhtml.sh intro
platform: html_deps
	etc/mkhtml.sh platform
html: html_deps dsl intro platform

# target dvi is completely broken
dvi: html_deps
	- [ -d _dvi ] && rm -r _dvi
	mkdir _$@
	cd _$@; jw -f docbook -b dvi ../intro/main.xml

mozilla:
	mozilla $(HTML) &
netscape:
	netscape $(HTML) &
links:
	links $(HTML)
lynx:
	lynx $(HTML)
xdvi: dvi
	xdvi $(DVI)

fileref:
	. ./config-$(HOSTNAME).sh && \
	etc/fileref.pl `find intro platform -type f -name '*.xml'`

dist_html:
	tar -C .. -zcf $(TEVWH_DIRNAME)-`date "+%Y-%m-%d"`.html.tar.gz \
		$(TEVWH_DIRNAME)/_html --exclude-from=etc/tar-exclude
dist_out:
	tar -C .. -zcf $(TEVWH_OS_CODE)-`date "+%Y-%m-%d"`.out.tar.gz \
		$(TEVWH_DIRNAME)/$(TEVWH_OUT) \
		$(TEVWH_DIRNAME)/$(TEVWH_PRE) \
		$(TEVWH_DIRNAME)/config-$(HOSTNAME).csh \
		$(TEVWH_DIRNAME)/config-$(HOSTNAME).mak \
		$(TEVWH_DIRNAME)/config-$(HOSTNAME).sed \
		$(TEVWH_DIRNAME)/config-$(HOSTNAME).sh \
		$(TEVWH_DIRNAME)/config-$(HOSTNAME).xml \
		--exclude-from=etc/tar-exclude
dist_src: clean
	tar -C .. -zcf $(TEVWH_DIRNAME)-`date "+%Y-%m-%d"`.tar.gz \
		${TEVWH_DIRNAME} --exclude-from=etc/tar-exclude
dist: dist_html dist_out dist_src

$(TEVWH_OUT)/packages/man-all: \
	$(TEVWH_PRE)/packages/man-all/$(TEVWH_UNAME).sh
	$(TEVWH_PRE)/packages/man-all/$(TEVWH_UNAME).sh $? > $@
$(TEVWH_OUT)/packages/man-section: \
	$(TEVWH_PRE)/packages/man-section/$(TEVWH_UNAME).sh
	$(TEVWH_PRE)/packages/man-section/$(TEVWH_UNAME).sh $? > $@
$(TEVWH_OUT)/packages/du: \
	$(TEVWH_PRE)/packages/$(TEVWH_OS_PKG_SYS)/du.sh
	$? > $@ 2>&1
$(TEVWH_OUT)/packages/simple: \
	$(TEVWH_PRE)/packages/$(TEVWH_OS_PKG_SYS)/simple.sh
	$? > $@ 2>&1
$(TEVWH_OUT)/packages/verify: \
	$(TEVWH_PRE)/packages/$(TEVWH_OS_PKG_SYS)/verify.sh
	-$? > $@ 2>&1
$(TEVWH_OUT)/packages/verify-all: \
	$(TEVWH_PRE)/packages/$(TEVWH_OS_PKG_SYS)/verify-all.sh
# takes too long and produces too much output, so never call it
#	-$? > $@ 2>&1

$(TEVWH_OUT)/packages/rpm/custom: \
	$(TEVWH_PRE)/packages/rpm/custom.sh
	$? > $@
$(TEVWH_OUT)/packages/deb/simple: \
	$(TEVWH_PRE)/packages/deb/simple.sh
	$? > $@ 2>&1
$(TEVWH_OUT)/packages/deb/avail: \
	$(TEVWH_PRE)/packages/deb/avail.sh
	$? > $@ 2>&1
$(TEVWH_OUT)/packages/deb/perl: \
	$(TEVWH_PRE)/packages/deb/perl.sh
	$? > $@ 2>&1
$(TEVWH_OUT)/packages/deb/hard: \
	$(TEVWH_PRE)/packages/deb/hard.sh
	$? > $@ 2>&1
$(TEVWH_OUT)/packages/SunOS/version: \
	$(TEVWH_PRE)/packages/SunOS/version.sh
	$? > $@ 2>&1

$(TEVWH_TMP)/magic_elf/magic_elf \
$(TEVWH_OUT)/magic_elf/magic_elf: \
	$(TEVWH_PRE)/magic_elf/magic_elf.c \
	$(TEVWH_PRE)/magic_elf/cc.sh
	$(TEVWH_PRE)/magic_elf/cc.sh > $(TEVWH_OUT)/magic_elf/magic_elf
$(TEVWH_OUT)/magic_elf/magic_elf_static: \
	$(TEVWH_PRE)/magic_elf/magic_elf.c \
	$(TEVWH_PRE)/magic_elf/cc_static.sh
	$(TEVWH_PRE)/magic_elf/cc_static.sh > $@
$(TEVWH_OUT)/magic_elf/strings: \
	$(TEVWH_TMP)/magic_elf/magic_elf \
	$(TEVWH_PRE)/magic_elf/strings.sh
	$(TEVWH_PRE)/magic_elf/strings.sh > $@
$(TEVWH_OUT)/magic_elf/od: \
	$(TEVWH_OUT)/magic_elf/magic_elf \
	$(TEVWH_PRE)/magic_elf/od/$(TEVWH_UNAME).sh
	$(TEVWH_PRE)/magic_elf/od/$(TEVWH_UNAME).sh > $@
$(TEVWH_OUT)/magic_elf/hexdump: \
	$(TEVWH_OUT)/magic_elf/magic_elf \
	$(TEVWH_PRE)/magic_elf/hexdump.sh \
	$(TEVWH_PRE)/format.hex
	- $(TEVWH_PRE)/magic_elf/hexdump.sh > $@
$(TEVWH_OUT)/magic_elf/xxd: \
	$(TEVWH_OUT)/magic_elf/magic_elf \
	$(TEVWH_PRE)/magic_elf/xxd.sh
	- $(TEVWH_PRE)/magic_elf/xxd.sh > $@
$(TEVWH_TMP)/magic_elf/addr_of_main: \
	$(TEVWH_PRE)/magic_elf/addr_of_main.c
	$(TEVWH_PATH_CC) $(TEVWH_CFLAGS) -o $@ $?
$(TEVWH_OUT)/magic_elf/addr_of_main: \
	$(TEVWH_TMP)/magic_elf/addr_of_main
	$? > $@ 2>&1
$(TEVWH_OUT)/magic_elf/ndisasm.asm: \
	$(TEVWH_OUT)/magic_elf/magic_elf \
	$(TEVWH_OUT)/magic_elf/addr_of_main \
	$(TEVWH_PRE)/magic_elf/ndisasm.sh
	$(TEVWH_PRE)/magic_elf/ndisasm.sh > $@
$(TEVWH_OUT)/magic_elf/objdump.asm: \
	$(TEVWH_TMP)/magic_elf/magic_elf \
	$(TEVWH_OUT)/magic_elf/addr_of_main \
	$(TEVWH_PRE)/magic_elf/objdump.sh \
	$(TEVWH_PRE)/magic_elf/objdump_format.sh
	$(TEVWH_PRE)/magic_elf/objdump.sh > $@
$(TEVWH_OUT)/magic_elf/gdb: \
	$(TEVWH_OUT)/magic_elf/magic_elf \
	$(TEVWH_PRE)/magic_elf/gdb.sh \
	$(TEVWH_PRE)/magic_elf/gdb_core.sh \
	$(TEVWH_PRE)/magic_elf/gdb_format.sh
	$(TEVWH_PRE)/magic_elf/gdb.sh > $@
$(TEVWH_OUT)/magic_elf/other_perl: \
	$(TEVWH_PRE)/magic_elf/other_perl.pl
	$? > $@ 2>&1
$(TEVWH_OUT)/magic_elf/other_mem: \
	$(TEVWH_PRE)/magic_elf/other_mem.sh
	$? > $@ 2>&1
$(TEVWH_OUT)/magic_elf/other_exe: \
	$(TEVWH_PRE)/magic_elf/other_exe.sh
	$? > $@ 2>&1

$(TEVWH_OUT)/evil_magic/write.gdb: \
	$(TEVWH_TMP)/magic_elf/magic_elf \
	$(TEVWH_OUT)/magic_elf/gdb \
	$(TEVWH_PRE)/magic_elf/gdb.sh \
	$(TEVWH_PRE)/magic_elf/gdb_core.sh \
	$(TEVWH_PRE)/magic_elf/gdb_format.sh \
	$(TEVWH_PRE)/evil_magic/first_gdb_func.sed \
	$(TEVWH_PRE)/evil_magic/gdb_write.sh
	$(TEVWH_PRE)/evil_magic/gdb_write.sh > $@ 2>&1
$(TEVWH_OUT)/evil_magic/static_main.gdb: \
	$(TEVWH_OUT)/magic_elf/magic_elf_static \
	$(TEVWH_PRE)/magic_elf/gdb.sh \
	$(TEVWH_PRE)/magic_elf/gdb_core.sh \
	$(TEVWH_PRE)/magic_elf/gdb_format.sh
	$(TEVWH_PRE)/magic_elf/gdb.sh \
		"$(TEVWH_TMP)/magic_elf/magic_elf_static" \
	> $@ 2>&1
$(TEVWH_OUT)/evil_magic/static_write.gdb: \
	$(TEVWH_TMP)/magic_elf/magic_elf_static \
	$(TEVWH_OUT)/magic_elf/gdb \
	$(TEVWH_PRE)/magic_elf/gdb.sh \
	$(TEVWH_PRE)/magic_elf/gdb_core.sh \
	$(TEVWH_PRE)/magic_elf/gdb_format.sh \
	$(TEVWH_PRE)/evil_magic/first_gdb_func.sed \
	$(TEVWH_PRE)/evil_magic/static_write.sh
	$(TEVWH_PRE)/evil_magic/static_write.sh > $@
$(TEVWH_OUT)/evil_magic/nm: \
	$(TEVWH_PRE)/evil_magic/nm.sh \
	$(TEVWH_TMP)/magic_elf/magic_elf_static
	$(TEVWH_PRE)/evil_magic/nm.sh > $@
$(TEVWH_OUT)/evil_magic/gdb_nm: \
	$(TEVWH_PRE)/evil_magic/gdb_nm.sh \
	$(TEVWH_TMP)/magic_elf/magic_elf_static \
	$(TEVWH_PRE)/magic_elf/gdb_core.sh \
	$(TEVWH_PRE)/magic_elf/gdb_format.sh
	$(TEVWH_PRE)/evil_magic/gdb_nm.sh \
		$(TEVWH_TMP)/magic_elf/magic_elf_static > $@
$(TEVWH_TMP)/evil_magic/$(TEVWH_ASM_STYLE) \
$(TEVWH_OUT)/evil_magic/$(TEVWH_ASM_STYLE): \
	src/evil_magic/$(TEVWH_ARCH)_$(TEVWH_UNAME).S \
	$(TEVWH_PRE)/evil_magic/$(TEVWH_ASM_STYLE).sh
	$(TEVWH_PRE)/evil_magic/$(TEVWH_ASM_STYLE).sh \
		> $(TEVWH_OUT)/evil_magic/$(TEVWH_ASM_STYLE)
$(TEVWH_OUT)/evil_magic/od: \
	$(TEVWH_OUT)/evil_magic/$(TEVWH_ASM_STYLE) \
	$(TEVWH_PRE)/evil_magic/od.sh
	$(TEVWH_PRE)/evil_magic/od.sh > $@
$(TEVWH_TMP)/evil_magic/e_entry: \
	$(TEVWH_PRE)/evil_magic/e_entry.c
	$(TEVWH_PATH_CC) $(TEVWH_CFLAGS) -o $@ $? 
$(TEVWH_OUT)/evil_magic/e_entry: \
	$(TEVWH_TMP)/evil_magic/$(TEVWH_ASM_STYLE) \
	$(TEVWH_TMP)/evil_magic/e_entry \
	$(TEVWH_PRE)/evil_magic/e_entry.sh
	$(TEVWH_PRE)/evil_magic/e_entry.sh > $@
$(TEVWH_TMP)/evil_magic/ofs_entry: \
	$(TEVWH_PRE)/evil_magic/ofs_entry.c
	$(TEVWH_PATH_CC) $(TEVWH_CFLAGS) -o $@ $?
$(TEVWH_OUT)/evil_magic/ofs_entry: \
	$(TEVWH_TMP)/evil_magic/ofs_entry
	$? > $@
$(TEVWH_OUT)/evil_magic/att.asm: \
	$(TEVWH_TMP)/evil_magic/$(TEVWH_ASM_STYLE) \
	$(TEVWH_PRE)/evil_magic/objdump.sh
	$(TEVWH_PRE)/evil_magic/objdump.sh > $@
$(TEVWH_OUT)/evil_magic/intel.asm: \
	$(TEVWH_TMP)/evil_magic/$(TEVWH_ASM_STYLE) \
	$(TEVWH_PRE)/evil_magic/ndisasm.sh
	$(TEVWH_PRE)/evil_magic/ndisasm.sh > $@
$(TEVWH_OUT)/evil_magic/evil_magic.c: \
	$(TEVWH_OUT)/evil_magic/$(TEVWH_ASM_STYLE).asm \
	src/platform/disasm.pl
	src/platform/disasm.pl \
		< $(TEVWH_OUT)/evil_magic/$(TEVWH_ASM_STYLE).asm \
		> $@
$(TEVWH_OUT)/evil_magic/cc: \
	$(TEVWH_OUT)/evil_magic/evil_magic.c \
	$(TEVWH_PRE)/evil_magic/cc.sh
	$(TEVWH_PRE)/evil_magic/cc.sh > $@ 2>&1
$(TEVWH_TMP)/evil_magic/att_func.o: \
	$(TEVWH_PRE)/evil_magic/func_$(TEVWH_ARCH)_$(TEVWH_UNAME).S
	$(TEVWH_PATH_CC) -c -o $@ $?
$(TEVWH_OUT)/evil_magic/att_func.asm: \
	$(TEVWH_PRE)/magic_elf/objdump_format.sh \
	$(TEVWH_TMP)/evil_magic/att_func.o
	$(TEVWH_PATH_OBJDUMP) -d $(TEVWH_TMP)/evil_magic/att_func.o \
		| $(TEVWH_PRE)/magic_elf/objdump_format.sh > $@
$(TEVWH_TMP)/evil_magic/intel_func: \
	$(TEVWH_PRE)/evil_magic/func_$(TEVWH_ARCH)_$(TEVWH_UNAME).S
	$(TEVWH_PATH_NASM) -f bin -o $@ $?
$(TEVWH_OUT)/evil_magic/intel_func.asm: \
	$(TEVWH_TMP)/evil_magic/intel_func
	$(TEVWH_PATH_NDISASM) -U $? > $@
$(TEVWH_OUT)/evil_magic/func.inc: \
	$(TEVWH_OUT)/evil_magic/$(TEVWH_ASM_STYLE)_func.asm \
	src/platform/disasm.pl
	src/platform/disasm.pl -identfier=in_code \
		$(TEVWH_OUT)/evil_magic/$(TEVWH_ASM_STYLE)_func.asm > $@
$(TEVWH_OUT)/evil_magic/self_modify: \
	$(TEVWH_TMP)/evil_magic/self_modify
$(TEVWH_TMP)/evil_magic/self_modify: \
	$(TEVWH_OUT)/evil_magic/func.inc \
	$(TEVWH_PRE)/evil_magic/self_modify.c
	$(TEVWH_PATH_CC) $(TEVWH_CFLAGS) -I $(TEVWH_OUT)/evil_magic -o $@ \
		$(TEVWH_PRE)/evil_magic/self_modify.c
$(TEVWH_OUT)/evil_magic/self_modify: \
	$(TEVWH_TMP)/evil_magic/self_modify
	$? > $@

$(TEVWH_OUT)/readelf/segments/objdump: \
	$(TEVWH_TMP)/evil_magic \
	$(TEVWH_PRE)/readelf/segments/objdump.sh
	$(TEVWH_PRE)/readelf/segments/objdump.sh > $@
$(TEVWH_OUT)/readelf/segments/readelf: \
	$(TEVWH_TMP)/evil_magic \
	$(TEVWH_PRE)/readelf/segments/readelf.sh
	$(TEVWH_PRE)/readelf/segments/readelf.sh > $@
$(TEVWH_OUT)/readelf/segments/elfdump: \
	$(TEVWH_TMP)/evil_magic \
	$(TEVWH_PRE)/readelf/segments/elfdump.sh
	$(TEVWH_PRE)/readelf/segments/elfdump.sh > $@
$(TEVWH_OUT)/readelf/sections/objdump: \
	$(TEVWH_TMP)/evil_magic \
	$(TEVWH_PRE)/readelf/sections/objdump.sh
	$(TEVWH_PRE)/readelf/sections/objdump.sh > $@
$(TEVWH_OUT)/readelf/sections/readelf: \
	$(TEVWH_TMP)/evil_magic \
	$(TEVWH_PRE)/readelf/sections/readelf.sh
	$(TEVWH_PRE)/readelf/sections/readelf.sh > $@
$(TEVWH_OUT)/readelf/sections/elfdump: \
	$(TEVWH_TMP)/evil_magic \
	$(TEVWH_PRE)/readelf/sections/elfdump.sh
	$(TEVWH_PRE)/readelf/sections/elfdump.sh > $@
$(TEVWH_OUT)/readelf/sh/segments/objdump: \
	$(TEVWH_PRE)/readelf/sh/segments/objdump.sh
	$(TEVWH_PRE)/readelf/sh/segments/objdump.sh > $@
$(TEVWH_OUT)/readelf/sh/segments/readelf: \
	$(TEVWH_PRE)/readelf/sh/segments/readelf.sh
	$(TEVWH_PRE)/readelf/sh/segments/readelf.sh > $@
$(TEVWH_OUT)/readelf/sh/sections/objdump: \
	$(TEVWH_PRE)/readelf/sh/sections/objdump.sh
	$(TEVWH_PRE)/readelf/sh/sections/objdump.sh > $@
$(TEVWH_OUT)/readelf/sh/sections/readelf: \
	$(TEVWH_PRE)/readelf/sh/sections/readelf.sh
	$(TEVWH_PRE)/readelf/sh/sections/readelf.sh > $@

$(TEVWH_TMP)/segment_padding/sysconf: \
	src/segment_padding/sysconf.c
	$(TEVWH_PATH_CC) $(TEVWH_CFLAGS) -o $@ $?
$(TEVWH_OUT)/segment_padding/sysconf: \
	$(TEVWH_TMP)/segment_padding/sysconf
	$? > $@
$(TEVWH_OUT)/segment_padding/objdump: \
	$(TEVWH_TMP)/one_step_closer/e1i1/$(TEVWH_NAME_SH)_infected \
	$(TEVWH_PRE)/segment_padding/objdump.sh
	$(TEVWH_PRE)/segment_padding/objdump.sh > $@ 2>&1
$(TEVWH_OUT)/segment_padding/readelf: \
	$(TEVWH_TMP)/one_step_closer/e1i1/$(TEVWH_NAME_SH)_infected \
	$(TEVWH_PRE)/segment_padding/readelf.sh
	$(TEVWH_PRE)/segment_padding/readelf.sh > $@ 2>&1
$(TEVWH_OUT)/segment_padding/scan: \
	$(TEVWH_TMP)/one_step_closer/e1i1/$(TEVWH_NAME_SH)_infected \
	$(TEVWH_PRE)/segment_padding/scan_dist.sh
	$(TEVWH_PRE)/segment_padding/scan_dist.sh > $@ 2>&1

$(TEVWH_OUT)/scanner/dist_big: \
	$(TEVWH_PRE)/scanner/driver.sh \
	$(TEVWH_PRE)/scanner/dist.pl
	nice $(TEVWH_PRE)/scanner/driver.sh \
		$@ $(TEVWH_PRE)/scanner/dist.pl $(SCANNER_BIG)
$(TEVWH_OUT)/scanner/entry_point_big: \
	$(TEVWH_PRE)/scanner/driver.sh \
	$(TEVWH_PRE)/scanner/entry_point.pl
	nice $(TEVWH_PRE)/scanner/driver.sh \
		$@ $(TEVWH_PRE)/scanner/entry_point.pl $(SCANNER_BIG)
$(TEVWH_OUT)/scanner/dist_small: \
	$(TEVWH_PRE)/scanner/driver.sh \
	$(TEVWH_PRE)/scanner/dist.pl
	nice $(TEVWH_PRE)/scanner/driver.sh \
		$@ $(TEVWH_PRE)/scanner/dist.pl $(SCANNER_SMALL)
$(TEVWH_OUT)/scanner/entry_point_small: \
	$(TEVWH_PRE)/scanner/driver.sh \
	$(TEVWH_PRE)/scanner/entry_point.pl
	nice $(TEVWH_PRE)/scanner/driver.sh \
		$@ $(TEVWH_PRE)/scanner/entry_point.pl $(SCANNER_SMALL)

$(TEVWH_OUT)/one_step_closer/i1/infection.inc: \
	$(TEVWH_PRE)/one_step_closer/i1/$(TEVWH_ARCH)-$(TEVWH_UNAME).S \
	src/platform/disasm.pl \
	$(TEVWH_PRE)/one_step_closer/$(TEVWH_ASM_STYLE).sh
	$(TEVWH_PRE)/one_step_closer/$(TEVWH_ASM_STYLE).sh $@
$(TEVWH_TMP)/one_step_closer/e1i1/$(TEVWH_NAME_SH)_infected: \
	$(TEVWH_PRE)/one_step_closer/cc.sh \
	$(TEVWH_OUT)/one_step_closer/i1/infection.inc \
	src/one_step_closer/one_step_closer.c
	$(TEVWH_PRE)/one_step_closer/cc.sh one_step_closer e1 i1 \
		src/one_step_closer/one_step_closer.c \
	> $(TEVWH_OUT)/one_step_closer/e1i1/cc 2>&1

$(TEVWH_OUT)/one_step_closer/test-e1i1.sh: \
	$(TEVWH_PRE)/one_step_closer/mktest.sh \
	src/one_step_closer/test.sh
	$(TEVWH_PRE)/one_step_closer/mktest.sh $@ \
		< src/one_step_closer/test.sh
$(TEVWH_OUT)/one_step_closer/test-e1i1: \
	$(TEVWH_TMP)/one_step_closer/e1i1/$(TEVWH_NAME_SH)_infected \
	$(TEVWH_OUT)/one_step_closer/test-e1i1.sh
	-$(TEVWH_OUT)/one_step_closer/test-e1i1.sh > $@ 2>&1
$(TEVWH_TMP)/one_step_closer/e2i1/$(TEVWH_NAME_SH)_infected: \
	$(TEVWH_PRE)/one_step_closer/cc.sh \
	$(TEVWH_OUT)/one_step_closer/i1/infection.inc \
	src/one_step_closer/one_step_closer.c
	$(TEVWH_PRE)/one_step_closer/cc.sh one_step_closer e2 i1 \
		src/one_step_closer/one_step_closer.c \
	> $(TEVWH_OUT)/one_step_closer/e2i1/cc 2>&1
$(TEVWH_OUT)/one_step_closer/test-e2i1.sh: \
	$(TEVWH_PRE)/one_step_closer/mktest.sh \
	src/one_step_closer/test.sh
	$(TEVWH_PRE)/one_step_closer/mktest.sh $@ \
		< src/one_step_closer/test.sh
$(TEVWH_OUT)/one_step_closer/test-e3i1.sh: \
	$(TEVWH_PRE)/one_step_closer/mktest.sh \
	src/one_step_closer/test.sh
	$(TEVWH_PRE)/one_step_closer/mktest.sh $@ \
		< src/one_step_closer/test.sh
$(TEVWH_OUT)/one_step_closer/test-e2i1: \
	$(TEVWH_TMP)/one_step_closer/e2i1/$(TEVWH_NAME_SH)_infected \
	$(TEVWH_OUT)/one_step_closer/test-e2i1.sh
	-$(TEVWH_OUT)/one_step_closer/test-e2i1.sh > $@ 2>&1
$(TEVWH_TMP)/one_step_closer/e3i1/$(TEVWH_NAME_SH)_infected: \
	$(TEVWH_PRE)/one_step_closer/cc.sh \
	$(TEVWH_OUT)/one_step_closer/i1/infection.inc \
	src/one_step_closer/one_step_closer.c
	$(TEVWH_PRE)/one_step_closer/cc.sh one_step_closer e3 i1 \
		src/one_step_closer/one_step_closer.c \
	> $(TEVWH_OUT)/one_step_closer/e3i1/cc 2>&1
$(TEVWH_OUT)/one_step_closer/test-e3i1: \
	$(TEVWH_TMP)/one_step_closer/e3i1/$(TEVWH_NAME_SH)_infected \
	$(TEVWH_OUT)/one_step_closer/test-e3i1.sh
	-$(TEVWH_OUT)/one_step_closer/test-e3i1.sh > $@ 2>&1

$(TEVWH_OUT)/entry_point/sh.gdb: \
	$(TEVWH_PRE)/entry_point/gdb_core.sh \
	$(TEVWH_PRE)/magic_elf/gdb_format.sh
	$(TEVWH_PRE)/entry_point/gdb_core.sh \
	| $(TEVWH_PRE)/magic_elf/gdb_format.sh > $@
$(TEVWH_OUT)/entry_point/sh.disasm: \
	$(TEVWH_PRE)/entry_point/$(TEVWH_ASM_STYLE).sh \
	${TEVWH_TMP}/evil_magic/e_entry \
	$(TEVWH_PRE)/magic_elf/objdump_format.sh
	$(TEVWH_PRE)/entry_point/$(TEVWH_ASM_STYLE).sh > $@ 2>&1
$(TEVWH_OUT)/entry_point/entry_point: \
	$(TEVWH_PRE)/entry_point/entry_point.sh \
	$(TEVWH_TMP)/one_step_closer/e1i1/$(TEVWH_NAME_SH)_infected \
	$(TEVWH_TMP)/one_step_closer/e2i1/$(TEVWH_NAME_SH)_infected
	$(TEVWH_PRE)/entry_point/entry_point.sh > $@ 2>&1
$(TEVWH_OUT)/entry_point/e2.disasm: \
	$(TEVWH_PRE)/entry_point/$(TEVWH_ASM_STYLE).sh \
	$(TEVWH_TMP)/one_step_closer/e2i1/$(TEVWH_NAME_SH)_infected
	$(TEVWH_PRE)/entry_point/$(TEVWH_ASM_STYLE).sh \
	$(TEVWH_TMP)/one_step_closer/e2i1/$(TEVWH_NAME_SH)_infected \
	> $@ 2>&1
$(TEVWH_OUT)/entry_point/ldd: \
	$(TEVWH_PRE)/entry_point/ldd.sh
	$?  > $@ 2>&1
$(TEVWH_OUT)/entry_point/nm: \
	$(TEVWH_PRE)/entry_point/nm.sh
	$?  > $@ 2>&1
#$(TEVWH_PRE)/entry_point/__libc_start_main: \
#	$(TEVWH_OUT)/entry_point/nm \
#	$(TEVWH_PRE)/entry_point/get_libc_start_main.sh
#	$(TEVWH_PRE)/entry_point/get_libc_start_main.sh $@
$(TEVWH_OUT)/entry_point/e3.disasm: \
	$(TEVWH_PRE)/entry_point/$(TEVWH_ASM_STYLE).sh \
	$(TEVWH_TMP)/one_step_closer/e3i1/$(TEVWH_NAME_SH)_infected
	$(TEVWH_PRE)/entry_point/$(TEVWH_ASM_STYLE).sh \
	$(TEVWH_TMP)/one_step_closer/e3i1/$(TEVWH_NAME_SH)_infected \
	> $@ 2>&1

$(TEVWH_OUT)/additional_cs/hexdump: \
	$(TEVWH_PRE)/additional_cs/hexdump.sh \
	$(TEVWH_PRE)/format.hex
	$(TEVWH_PRE)/additional_cs/hexdump.sh > $@ 2>&1
$(TEVWH_OUT)/additional_cs/i1: \
	$(TEVWH_OUT)/one_step_closer/i1/infection.inc
	-ln -s ../one_step_closer/i1 $@
$(TEVWH_TMP)/additional_cs/e3i1/$(TEVWH_NAME_SH)_infected: \
	$(TEVWH_PRE)/one_step_closer/cc.sh \
	$(TEVWH_OUT)/additional_cs/i1 \
	src/one_step_closer/one_step_closer.c
	$(TEVWH_PRE)/one_step_closer/cc.sh additional_cs e3 i1 \
		src/one_step_closer/one_step_closer.c \
	> $(TEVWH_OUT)/additional_cs/cc 2>&1
$(TEVWH_OUT)/additional_cs/test-e3i1.sh: \
	$(TEVWH_PRE)/one_step_closer/mktest.sh \
	src/one_step_closer/test.sh
	$(TEVWH_PRE)/one_step_closer/mktest.sh $@ \
		< src/one_step_closer/test.sh
$(TEVWH_OUT)/additional_cs/test: \
	$(TEVWH_TMP)/additional_cs/e3i1/$(TEVWH_NAME_SH)_infected \
	$(TEVWH_OUT)/additional_cs/test-e3i1.sh
	-$(TEVWH_OUT)/additional_cs/test-e3i1.sh > $@ 2>&1
$(TEVWH_OUT)/additional_cs/objdump: \
	$(TEVWH_TMP)/additional_cs/e3i1/$(TEVWH_NAME_SH)_infected
	(  $(TEVWH_PATH_LS) -l $?; $(TEVWH_PATH_OBJDUMP) -fp $? ) > $@
$(TEVWH_OUT)/additional_cs/readelf: \
	$(TEVWH_TMP)/additional_cs/e3i1/$(TEVWH_NAME_SH)_infected
	(  $(TEVWH_PATH_LS) -l $?; $(TEVWH_PATH_READELF) -l $? ) > $@
$(TEVWH_OUT)/additional_cs/scan: \
	$(TEVWH_TMP)/additional_cs/e3i1/$(TEVWH_NAME_SH)_infected \
	$(TEVWH_PRE)/additional_cs/scan_dist.sh
	$(TEVWH_PRE)/additional_cs/scan_dist.sh > $@ 2>&1

$(TEVWH_OUT)/doing_it_in_c/i1/infection.inc: \
	$(TEVWH_PRE)/doing_it_in_c/i1/$(TEVWH_ARCH)-$(TEVWH_UNAME).S \
	$(TEVWH_PRE)/one_step_closer/$(TEVWH_ASM_STYLE).sh
	$(TEVWH_PRE)/one_step_closer/$(TEVWH_ASM_STYLE).sh $@ 2>&1
$(TEVWH_TMP)/doing_it_in_c/e3i1/$(TEVWH_NAME_SH)_infected: \
	$(TEVWH_PRE)/one_step_closer/cc.sh \
	$(TEVWH_OUT)/doing_it_in_c/i1/infection.inc \
	src/doing_it_in_c/doing_it_in_c.c
	$(TEVWH_PRE)/one_step_closer/cc.sh doing_it_in_c e3 i1 \
		src/doing_it_in_c/doing_it_in_c.c \
	> $(TEVWH_OUT)/doing_it_in_c/e3i1/cc 2>&1
$(TEVWH_OUT)/doing_it_in_c/test-e3i1.sh: \
	$(TEVWH_PRE)/one_step_closer/mktest.sh \
	src/one_step_closer/test.sh
	$(TEVWH_PRE)/one_step_closer/mktest.sh $@ \
		< src/one_step_closer/test.sh
$(TEVWH_OUT)/doing_it_in_c/test-e3i1: \
	$(TEVWH_TMP)/doing_it_in_c/e3i1/$(TEVWH_NAME_SH)_infected \
	$(TEVWH_OUT)/doing_it_in_c/test-e3i1.sh
	-$(TEVWH_OUT)/doing_it_in_c/test-e3i1.sh > $@ 2>&1

$(TEVWH_OUT)/doing_it_in_c/i2/infection.inc: \
	$(TEVWH_PRE)/doing_it_in_c/i2/$(TEVWH_ARCH)-$(TEVWH_UNAME).S \
	$(TEVWH_PRE)/one_step_closer/$(TEVWH_ASM_STYLE).sh
	$(TEVWH_PRE)/one_step_closer/$(TEVWH_ASM_STYLE).sh $@ 2>&1
$(TEVWH_TMP)/doing_it_in_c/e3i2/$(TEVWH_NAME_SH)_infected: \
	$(TEVWH_PRE)/one_step_closer/cc.sh \
	$(TEVWH_OUT)/doing_it_in_c/i2/infection.inc \
	src/doing_it_in_c/doing_it_in_c.c
	$(TEVWH_PRE)/one_step_closer/cc.sh doing_it_in_c e3 i2 \
		src/doing_it_in_c/doing_it_in_c.c \
	> $(TEVWH_OUT)/doing_it_in_c/e3i2/cc 2>&1
$(TEVWH_OUT)/doing_it_in_c/test-e3i2.sh: \
	$(TEVWH_PRE)/one_step_closer/mktest.sh \
	src/one_step_closer/test.sh
	$(TEVWH_PRE)/one_step_closer/mktest.sh $@ \
		< src/one_step_closer/test.sh
$(TEVWH_OUT)/doing_it_in_c/test-e3i2: \
	$(TEVWH_TMP)/doing_it_in_c/e3i2/$(TEVWH_NAME_SH)_infected \
	$(TEVWH_OUT)/doing_it_in_c/test-e3i2.sh
	-$(TEVWH_OUT)/doing_it_in_c/test-e3i2.sh > $@ 2>&1

$(TEVWH_OUT)/doing_it_in_c/i3/infection.inc: \
	src/doing_it_in_c/i3/$(TEVWH_ARCH)-$(TEVWH_UNAME).S \
	$(TEVWH_PRE)/one_step_closer/$(TEVWH_ASM_STYLE).sh
	$(TEVWH_PRE)/one_step_closer/$(TEVWH_ASM_STYLE).sh $@ 2>&1
$(TEVWH_TMP)/doing_it_in_c/e3i3/$(TEVWH_NAME_SH)_infected: \
	$(TEVWH_PRE)/one_step_closer/cc.sh \
	$(TEVWH_OUT)/doing_it_in_c/i3/infection.inc \
	src/doing_it_in_c/doing_it_in_c.c
	$(TEVWH_PRE)/one_step_closer/cc.sh doing_it_in_c e3 i3 \
		src/doing_it_in_c/doing_it_in_c.c \
	> $(TEVWH_OUT)/doing_it_in_c/e3i3/cc 2>&1
$(TEVWH_OUT)/doing_it_in_c/test-e3i3.sh: \
	$(TEVWH_PRE)/one_step_closer/mktest.sh \
	src/one_step_closer/test.sh
	$(TEVWH_PRE)/one_step_closer/mktest.sh $@ \
		< src/one_step_closer/test.sh
$(TEVWH_OUT)/doing_it_in_c/test-e3i3: \
	$(TEVWH_TMP)/doing_it_in_c/e3i3/$(TEVWH_NAME_SH)_infected \
	$(TEVWH_OUT)/doing_it_in_c/test-e3i3.sh
	-$(TEVWH_OUT)/doing_it_in_c/test-e3i3.sh > $@ 2>&1

$(TEVWH_OUT)/doing_it_in_c/get_relocate_ofs.disasm: \
	$(TEVWH_PRE)/doing_it_in_c/$(TEVWH_ASM_STYLE).sh \
	$(TEVWH_TMP)/doing_it_in_c/e3i1/$(TEVWH_NAME_SH)_infected
	$(TEVWH_PRE)/doing_it_in_c/$(TEVWH_ASM_STYLE).sh > $@ 2>&1
$(TEVWH_OUT)/doing_it_in_c/begin.disasm: \
	$(TEVWH_PRE)/doing_it_in_c/$(TEVWH_ASM_STYLE).sh \
	$(TEVWH_TMP)/doing_it_in_c/e3i1/$(TEVWH_NAME_SH)_infected
	$(TEVWH_PRE)/doing_it_in_c/$(TEVWH_ASM_STYLE).sh \
	$(TEVWH_TMP)/doing_it_in_c/e3i1/infector "begin" > $@ 2>&1
$(TEVWH_OUT)/doing_it_in_c/addr: \
	$(TEVWH_PRE)/doing_it_in_c/addr.c
	$(TEVWH_PATH_CC) $(TEVWH_CFLAGS) -o $(TEVWH_TMP)/doing_it_in_c/addr \
		$? > $@ 2>&1 \
	&& $(TEVWH_TMP)/doing_it_in_c/addr >> $@ 2>&1
$(TEVWH_OUT)/doing_it_in_c/e3i1.disasm: \
	$(TEVWH_PRE)/doing_it_in_c/$(TEVWH_ASM_STYLE).sh \
	$(TEVWH_TMP)/doing_it_in_c/e3i1/$(TEVWH_NAME_SH)_infected
	$(TEVWH_PRE)/doing_it_in_c/$(TEVWH_ASM_STYLE).sh \
	$(TEVWH_TMP)/doing_it_in_c/e3i1/infector infection 4 > $@ 2>&1
$(TEVWH_OUT)/doing_it_in_c/e3i2.disasm: \
	$(TEVWH_PRE)/doing_it_in_c/$(TEVWH_ASM_STYLE).sh \
	$(TEVWH_TMP)/doing_it_in_c/e3i2/$(TEVWH_NAME_SH)_infected
	$(TEVWH_PRE)/doing_it_in_c/$(TEVWH_ASM_STYLE).sh \
	$(TEVWH_TMP)/doing_it_in_c/e3i2/infector infection 1 > $@ 2>&1
$(TEVWH_OUT)/doing_it_in_c/e3i3.disasm: \
	$(TEVWH_PRE)/doing_it_in_c/$(TEVWH_ASM_STYLE).sh \
	$(TEVWH_TMP)/doing_it_in_c/e3i3/$(TEVWH_NAME_SH)_infected
	$(TEVWH_PRE)/doing_it_in_c/$(TEVWH_ASM_STYLE).sh \
	$(TEVWH_TMP)/doing_it_in_c/e3i3/infector infection 2 > $@ 2>&1

$(TEVWH_OUT)/stub_revisited/sh.disasm: \
	$(TEVWH_PRE)/stub_revisited/$(TEVWH_ASM_STYLE).sh
	( $? 2>&1 ) | head > $@
$(TEVWH_OUT)/stub_revisited/sh_ret.disasm: \
	$(TEVWH_PRE)/stub_revisited/$(TEVWH_ASM_STYLE).sh \
	$(TEVWH_PRE)/stub_revisited/$(TEVWH_ASM_STYLE)_ret.sh
	$(TEVWH_PRE)/stub_revisited/$(TEVWH_ASM_STYLE)_ret.sh > $@ 2>&1
$(TEVWH_OUT)/stub_revisited/magic_elf.disasm: \
	$(TEVWH_PRE)/stub_revisited/$(TEVWH_ASM_STYLE).sh \
	$(TEVWH_TMP)/magic_elf/magic_elf
	( $(TEVWH_PRE)/stub_revisited/$(TEVWH_ASM_STYLE).sh $(TEVWH_TMP)/magic_elf/magic_elf 2>&1 ) \
	| head \
	> $@
$(TEVWH_OUT)/stub_revisited/$(TEVWH_NAME_SH)_infected.disasm: \
	$(TEVWH_PRE)/stub_revisited/$(TEVWH_ASM_STYLE).sh \
	$(TEVWH_TMP)/doing_it_in_c/e3i1/$(TEVWH_NAME_SH)_infected
	( $(TEVWH_PRE)/stub_revisited/$(TEVWH_ASM_STYLE).sh \
		$(TEVWH_TMP)/doing_it_in_c/e3i1/$(TEVWH_NAME_SH)_infected 2>&1 ) \
	| head \
	> $@
$(TEVWH_OUT)/stub_revisited/stack: \
	$(TEVWH_PRE)/stub_revisited/stack.sh \
	$(TEVWH_TMP)/magic_elf/magic_elf
	$(TEVWH_PRE)/stub_revisited/stack.sh > $@ 2>&1
#$(TEVWH_PRE)/stub_revisited/__libc_start_main: \
#	$(TEVWH_OUT)/stub_revisited/stack \
#	$(TEVWH_PRE)/stub_revisited/get_libc_start_main.sh
#	$(TEVWH_PRE)/stub_revisited/get_libc_start_main.sh \
#		$@ $(TEVWH_OUT)/stub_revisited/stack

$(TEVWH_OUT)/suspicious_code/disasm: \
	src/suspicious_code/dumpsection.pl \
	$(TEVWH_PRE)/suspicious_code/$(TEVWH_ASM_STYLE).sh
	$(TEVWH_PRE)/suspicious_code/$(TEVWH_ASM_STYLE).sh > $@ 2>&1
