cutils/makefile

38 lines
713 B
Makefile
Raw Permalink Normal View History

2023-02-11 14:17:02 +01:00
CC := gcc
2023-04-30 13:41:00 +02:00
CFLAGS := -Wall -Wextra -Werror=implicit -Wconversion -Wdouble-promotion -pedantic -g3 -fsanitize=address -fsanitize=undefined -Ilib/inc
2023-04-27 09:26:54 +02:00
CLIBS := -lm
2023-02-11 14:17:02 +01:00
SRCFILES := $(wildcard lib/*.c)
SRCFILES += $(wildcard test/*.c)
OBJFILES := $(SRCFILES:%.c=obj/%.o)
DEPFILES := $(SRCFILES:%.c=obj/%.dep)
DEPFLAGS = -M -MT $@ -MMD -MP -MF $(@:.o=.dep)
TARGET := bin/cutils-test
all: $(TARGET)
clean:
rm -rf bin/ obj/
test: $(TARGET)
./$(TARGET)
.PHONY: all clean test
$(TARGET): mkdir $(OBJFILES)
2023-04-27 09:26:54 +02:00
$(CC) $(CFLAGS) $(CLIBS) $(OBJFILES) -o $(TARGET)
2023-02-11 14:17:02 +01:00
obj/%.o: %.c
@$(CC) $(CFLAGS) $(DEPFLAGS) $<
$(CC) $(CFLAGS) -c $< -o $@
mkdir:
@mkdir -p bin/ obj/lib/ obj/test/
$(DEPFILES): mkdir
include $(DEPFILES)