raven/Makefile
2023-04-13 00:27:08 +03:00

39 lines
740 B
Makefile

CC?=cc
CFLAGS_LIBS:=`pkg-config --cflags --libs xcb cairo pangocairo` -lm
CFLAGS:=$(CFLAGS) -pipe -Wall -Wextra -Wshadow -std=c99 -pedantic $(CFLAGS_LIBS)
BUILD=build
OBJ=$(BUILD)
BINDIR=$(BUILD)
SRC=src
BIN=$(BINDIR)/main
SRCS=$(wildcard $(SRC)/*.c)
OBJS=$(patsubst $(SRC)/%.c, $(OBJ)/%.o, $(SRCS))
DEPS=$(OBJS:%.o=%.d)
all: CFLAGS+=-fsanitize=address -Og -ggdb
all: $(BUILD) $(BIN)
release: CFLAGS+=-O2 -flto=auto -DNDEBUG
release: clean $(BUILD) $(BIN)
$(BIN): $(OBJS)
$(CC) $(CFLAGS) $(OBJS) -o $@
-include $(DEPS)
$(OBJ)/%.o: $(SRC)/%.c
$(CC) $(CFLAGS) -MMD -c $< -o $@
$(BUILD):
mkdir -p $(BUILD)
clean:
$(RM) $(BUILD)/*
compile_flags.txt:
echo "$(CFLAGS)" | tr " " "\n" > compile_flags.txt
.PHONY: all release clean