Files
my-website-base/Makefile
2025-11-26 17:24:20 +02:00

51 lines
1.1 KiB
Makefile

# Generated by mklua
MKLUA ?= mklua
CC ?= cc
OUTPUT ?= website
BINDIR := bin
LIBDIR := lib
SRCDIR := src
OUTPUT := $(BINDIR)/$(OUTPUT)
SOURCES := $(wildcard $(LIBDIR)/*.c)
OBJECTS := $(SOURCES:%.c=$(BINDIR)/%.o)
MKLUA_FLAGS += --path "$(SRCDIR)/?.lua;$(SRCDIR)/?/init.lua" --cpath ""
MKLUA_FLAGS += --entry
MKLUA_ENTRY ?= website-main
MKLUA_OUT := $(OUTPUT).c
LIBS := $(shell $(MKLUA) $(MKLUA_FLAGS) $(MKLUA_ENTRY) --libs)
DEPS := $(shell $(MKLUA) $(MKLUA_FLAGS) $(MKLUA_ENTRY) --deps)
CCARGS_LUA ?= $(shell pkg-config --cflags lua5.4)
LDARGS_LUA ?= $(shell pkg-config --libs lua5.4)
CCARGS += $(CCARGS_LUA) $(foreach x,$(LIBS),-I"$(dir $x)")
LDARGS += $(LDARGS_LUA)
ifeq ($(DEBUG), yes)
CCARGS += -g
MKLUA_FLAGS += -g
endif
.PHONY: all clean
all: $(OUTPUT)
clean:
rm -fr $(BINDIR) $(MKLUA_OUT) deps/luv
compile_flags.txt:
printf -- '$(foreach v,$(CCARGS) $(LDARGS),\n$v)' > compile_flags.txt
$(OUTPUT): $(LIBS) $(MKLUA_OUT) $(SOURCES) | $(dir $(OUTPUT))
$(CC) $(CCARGS) $(LDARGS) $^ -o $@
$(MKLUA_OUT): $(DEPS) | $(dir $(MKLUA_OUT))
$(MKLUA) $(MKLUA_FLAGS) $(MKLUA_ENTRY) -o $@
%/:
mkdir -p $@