fastbf/Makefile
SimonFJ20 40d386b274 init
2023-03-22 17:03:03 +01:00

35 lines
714 B
Makefile

CC = gcc
CFLAGS = -std=c17 -Wall -Wextra -Wpedantic -Wconversion -g -pg
LFLAGS = -lm -g -pg
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 -g -F max ./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