forked from flash/temporary-satori-hole
48 lines
1,013 B
Makefile
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
|