mirror of https://github.com/openXC7/prjxray.git
76 lines
2.2 KiB
Makefile
76 lines
2.2 KiB
Makefile
TODO_N ?= 50
|
|
# Number of spcimens
|
|
ifeq ($(QUICK),Y)
|
|
N = 1
|
|
TODO_N = 3
|
|
SEGMATCH_FLAGS?=
|
|
else
|
|
# Should be at least the -m value
|
|
N ?= 20
|
|
SEGMATCH_FLAGS?=-m 15 -M 45
|
|
endif
|
|
# Iteration number (each containing N specimens)
|
|
# Driven by int_loop.sh
|
|
ITER ?= 1
|
|
MAKETODO_FLAGS ?=--pip-type pips_int --seg-type int
|
|
SPECIMENS_DEPS ?=
|
|
|
|
# See int_loop_check.py
|
|
# rempips took 35 iters once, so set 50 as a good start point
|
|
CHECK_ARGS ?= --zero-entries --timeout-iters 50
|
|
SPECIMENS := $(addprefix build/$(ITER)/specimen_,$(shell seq -f '%03.0f' $(N)))
|
|
SPECIMENS_OK := $(addsuffix /OK,$(SPECIMENS))
|
|
# Individual fuzzer directory, such as ~/prjxray/fuzzers/010-lutinit
|
|
export FUZDIR=$(shell pwd)
|
|
export ITER
|
|
|
|
all: database
|
|
|
|
SELF_DIR := $(dir $(lastword $(MAKEFILE_LIST)))
|
|
include $(SELF_DIR)/pip_list.mk
|
|
|
|
$(SPECIMENS_OK): build/todo.txt $(SPECIMENS_DEPS)
|
|
mkdir -p build/$(ITER)
|
|
+if [ -f ${FUZDIR}/generate.sh ] ; then \
|
|
bash ${FUZDIR}/generate.sh $(subst /OK,,$@) ; \
|
|
else \
|
|
bash ${XRAY_DIR}/utils/top_generate.sh $(subst /OK,,$@) ; \
|
|
fi
|
|
touch $@
|
|
|
|
# Used 1) to see if we are done 2) pips to try in generate.tcl
|
|
build/todo.txt: piplist $(XRAY_DIR)/fuzzers/int_maketodo.py build/database/seeded
|
|
XRAY_DATABASE_DIR=${FUZDIR}/build/database \
|
|
python3 $(XRAY_DIR)/fuzzers/int_maketodo.py \
|
|
$(MAKETODO_FLAGS) |sort >build/todo_all.txt
|
|
cat build/todo_all.txt | sort -R | head -n$(TODO_N) > build/todo.txt.tmp
|
|
mv build/todo.txt.tmp build/todo.txt
|
|
# Per iter files
|
|
mkdir -p build/$(ITER)
|
|
cp build/todo_all.txt build/todo.txt build/$(ITER)/
|
|
# All in one dir for easier trending
|
|
mkdir -p build/todo
|
|
cp build/todo_all.txt build/todo/$(ITER)_all.txt
|
|
|
|
# Initial copy for first todo.txt
|
|
# Subsequent are based on updated db
|
|
build/database/seeded:
|
|
mkdir -p build/database/${XRAY_DATABASE}
|
|
cp ${XRAY_DATABASE_DIR}/${XRAY_DATABASE}/segbits*.db build/database/${XRAY_DATABASE}
|
|
touch build/database/seeded
|
|
|
|
# FIXME: consider moving to script
|
|
run:
|
|
$(MAKE) clean
|
|
+$(XRAY_DIR)/fuzzers/int_loop.sh --check-args "$(CHECK_ARGS)"
|
|
touch run.ok
|
|
|
|
clean:
|
|
rm -rf build run.ok todo
|
|
|
|
# Remove iteration specific files, but keep piplist.tcl output
|
|
cleaniter:
|
|
rm -rf build/$(ITER) build/todo.txt
|
|
|
|
.PHONY: all database pushdb run clean cleaniter
|