This repository has been archived on 2024-05-21. You can view files and clone it, but cannot push or open issues or pull requests.
temporary-satori-hole/Makefile
2023-12-27 01:35:22 +01:00

48 lines
1,013 B
Makefile

TARGET ?= satori
SRCDIR := ./src
INCDIR := ./include
BINDIR := ./bin
DATE = $(shell date +%Y%m%d)
C_SRC := $(wildcard $(SRCDIR)/*.c) $(wildcard $(SRCDIR)/**/*.c)
CXX_SRC := $(wildcard $(SRCDIR)/*.cxx) $(wildcard $(SRCDIR)/**/*.cxx)
OBJ := $(C_SRC:.c=.o) $(CXX_SRC:.cxx=.o)
OUT := $(BINDIR)/$(TARGET)
LIBNAMES := libcurl openssl lua54 json-c $(LIBNAMES)
CFLAGS := -Wall -Wextra -g -O2 --std=c11 -DSATORI_VERSION=\"$(DATE)\" -D_POSIX_C_SOURCE=200112L $(CFLAGS)
CXXFLAGS := $(CXXFLAGS)
CPPFLAGS := -I$(INCDIR) $(shell pkg-config --cflags $(LIBNAMES)) $(CPPFLAGS)
LDFLAGS := $(LDFLAGS)
LDLIBS := $(shell pkg-config --libs $(LIBNAMES)) $(LDLIBS)
all: $(OUT)
$(OUT): $(OBJ)
mkdir -p $(BINDIR)
$(CC) $(LDFLAGS) $(CPPFLAGS) -o $@ $^ $(LDLIBS)
.cxx.o:
@echo "CXX> " $@
$(CC) $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $<
.c.o:
@echo "C> " $@
$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
clean:
rm -f $(OBJ) $(OUT)
rebuild: clean all
run: all
$(OUT)
gdb: all
gdb $(OUT)
.PHONY: all clean rebuild
.SUFFIXES: .c .cxx