2024-09-09 16:41:49 +00:00
|
|
|
|
|
|
|
# needed cflags
|
2024-09-10 22:23:46 +00:00
|
|
|
CFLAGS += -std=gnu2x
|
2024-09-09 16:41:49 +00:00
|
|
|
|
|
|
|
# add include directory
|
2024-10-04 23:41:10 +00:00
|
|
|
CFLAGS += -isystem ../include -DPREFIX=$(PREFIX)
|
2024-09-09 16:41:49 +00:00
|
|
|
INCLUDE += ../include
|
|
|
|
|
|
|
|
# add lib directory
|
|
|
|
SRC += ../lib
|
|
|
|
|
|
|
|
H_SRC = $(shell find $(SRC) $(INCLUDE) -type f -name "*.h")
|
|
|
|
C_SRC = $(shell find $(SRC) -type f -name "*.c")
|
|
|
|
C_OBJ = $(patsubst %.c,$(BIN)/%.o,$(C_SRC))
|
|
|
|
|
2024-10-04 23:41:10 +00:00
|
|
|
.PHONY: clean build run fuzz
|
2024-09-09 16:41:49 +00:00
|
|
|
|
|
|
|
build: $(BIN)/$(OUT)
|
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -fr $(BIN)
|
2024-09-21 01:16:07 +00:00
|
|
|
rm -fr ../bin/lib
|
2024-09-09 16:41:49 +00:00
|
|
|
|
|
|
|
run: build
|
|
|
|
$(BIN)/$(OUT)
|
|
|
|
|
2024-10-04 23:41:10 +00:00
|
|
|
fuzz: clean
|
|
|
|
make -C . build CC=afl-cc LD=afl-cc
|
2024-09-21 00:46:37 +00:00
|
|
|
mkdir -p ../fuzz
|
2024-09-22 20:02:42 +00:00
|
|
|
rm -fr ../fuzz/$(OUT)
|
|
|
|
afl-fuzz -i ../test/$(OUT) -o ../fuzz -M $(OUT) -- $(BIN)/$(OUT) @@
|
2024-09-21 00:46:37 +00:00
|
|
|
|
2024-09-09 16:41:49 +00:00
|
|
|
$(C_OBJ): $(BIN)/%.o : %.c
|
|
|
|
@mkdir -p $(@D)
|
|
|
|
$(CC) -c $(CFLAGS) -o $@ $<
|
|
|
|
|
|
|
|
$(BIN)/$(OUT): $(C_OBJ) $(H_SRC)
|
|
|
|
@mkdir -p $(@D)
|
|
|
|
$(LD) $(LDFLAGS) -o $(BIN)/$(OUT) $(C_OBJ)
|