# IMPORTANT: to be compatible with `python setup.py make alias`, you must make
# sure that you only put one command per line, and ALWAYS put a line return
# after an alias and before a command, eg:
#
#```
#all:
#	test
#	install
#test:
#	nosetest
#install:
#	python setup.py install
#    ```
#
# resiliency_tester.py supports a templating system: you can use the following special tags, they will be interpolated at runtime:
#   - {inputdir}: input directory. Depending on the stage, this is either the untampered files (a copy of the original files), the tampered folder, or even previous repair folders during the repair stage.
#   - {dbdir}: database directory, where the generated databases will be placed.
#   - {outputdir}: output directory, where the files generated after executing the current command will be placed in.

before_tamper: # this will be executed before files tampering. Generate your ecc/database files here.
    python header_ecc.py -i "{inputdir}" -d "{dbdir}/hecc.txt" --size 4096 --ecc_algo 3 -g -f
    python structural_adaptive_ecc.py -i "{inputdir}" -d "{dbdir}/ecc.txt" -r1 0.3 -r2 0.2 -r3 0.1 -g -f --ecc_algo 3

tamper: # parameters to tamper the files and even the database files.
    python filetamper.py -i "{inputdir}" -m "n" -p 0.005 -b "3|6"
    python filetamper.py -i "{dbdir}" -m "n" -p 0.001 -b "4|9"

after_tamper: # execute commands after tampering. Can be used to recover
    python repair_ecc.py -i "{dbdir}/hecc.txt" --index "{dbdir}/hecc.txt.idx" -o "{dbdir}/heccrep.txt" -t 0.4 -f
    python repair_ecc.py -i "{dbdir}/ecc.txt" --index "{dbdir}/ecc.txt.idx" -o "{dbdir}/eccrep.txt" -t 0.4 -f

repair:
    python header_ecc.py -i "{inputdir}" -d "{dbdir}/heccrep.txt" -o "{outputdir}" -c --size 4096 --no_fast_check --ecc_algo 3
    python structural_adaptive_ecc.py -i "{inputdir}" -d "{dbdir}/eccrep.txt" -o "{outputdir}" -c -r1 0.3 -r2 0.2 -r3 0.1 -f --ecc_algo 3

none:
	# used for unit testing
