CC = gcc CFLAGS = -Wall -Wextra -O0 -no-pie -lm -g -std=c99 -zexecstack SRC = $(wildcard *.c) TGT = $(subst .c,,$(SRC)) BUILD_DIR = build DUMP_DIR = dump pframe: curl -o pframe.tgz https://dept-info.labri.fr/~thibault/SecuLog/pframe.tgz && \ tar -xf pframe.tgz &&\ rm -rf pframe.tgz .gdbinit: configure: pframe .gdbinit $(shell echo "python import pframe" > .gdbinit) $(BUILD_DIR)/%: %.c $(shell mkdir -p $(BUILD_DIR)) $(CC) $(CFLAGS) -o $@ $< build: $(addprefix $(BUILD_DIR)/, $(TGT))) PHONY: % gdb_%: $(addprefix $(BUILD_DIR)/, $(subst gdb_,,%)) PYTHONPATH=${PWD}/pframe${PYTHONPATH:+:${PYTHONPATH}} \ gdb $< --command=$(subst gdb_,,$@).gdb PHONY: clean clean: @rm -rf $(BUILD_DIR) pframe .gdbinit