CC = gcc CFLAGS = -std=c17 -Wall -Wextra -Wpedantic -Wconversion -g LFLAGS = -lm -g TARGET= bf C_FILES = $(shell find src/ -name *.c) HEADER_FILES = $(shell find src/ -name *.h) OBJECT_FILES = $(patsubst %.c, %.o, $(C_FILES)) all: compile_flags.txt $(TARGET) disasm: $(TARGET) objdump -dwrC -Mintel bf > dump.asm profile: $(TARGET) $(RM) perf.data profile.perf perf record --call-graph dwarf -F 10000 ./$(TARGET) < bench.bf perf script -F +pid > profile.perf $(TARGET): $(OBJECT_FILES) $(CC) -o $@ $(LFLAGS) $^ %.o: %.c $(HEADER_FILES) $(CC) -c -o $@ $(CFLAGS) $< compile_flags.txt: echo -xc $(CFLAGS) | sed 's/\s\+/\n/g' > compile_flags.txt clean: $(RM) $(OBJECT_FILES) $(TARGET) dump.asm gmon.out perf.data profile.perf