2023-04-15 21:29:10 +03:00
|
|
|
CC?=cc
|
|
|
|
LIBS:=`pkg-config --libs xcb xcb-xkb cairo pangocairo xkbcommon xkbcommon-x11` -lm
|
|
|
|
CFLAGS:=$(CFLAGS) -pipe -Wall -Wextra -Wshadow -std=gnu99 -pedantic `pkg-config --cflags xcb xcb-xkb cairo pangocairo xkbcommon xkbcommon-x11`
|
2023-04-13 00:27:08 +03:00
|
|
|
|
|
|
|
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)
|
|
|
|
|
|
|
|
|
2023-04-25 17:50:44 +03:00
|
|
|
all: CFLAGS+=-Og -ggdb -DNDEBUG
|
2023-04-13 00:27:08 +03:00
|
|
|
all: $(BUILD) $(BIN)
|
|
|
|
|
|
|
|
release: CFLAGS+=-O2 -flto=auto -DNDEBUG
|
|
|
|
release: clean $(BUILD) $(BIN)
|
|
|
|
|
|
|
|
$(BIN): $(OBJS)
|
2023-04-13 03:47:38 +03:00
|
|
|
$(CC) $(CFLAGS) $(LIBS) $(OBJS) -o $@
|
2023-04-13 00:27:08 +03:00
|
|
|
|
|
|
|
-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
|