enby/Makefile

52 lines
1.1 KiB
Makefile
Raw Normal View History

.DEFAULT_GOAL := all
include config.mk
# === BUILD ENVIRONMENT ===
BIN := bin
BUILD := build
LIB := lib
# === MACRO DEFINITIONS ===
define objpath
$(addprefix $(BUILD)/,
$(addsuffix .o,
$(basename $(1))))
endef
define mkobj
$(foreach DEP, $?,
mkdir -p $(dir $(call objpath, $(DEP)))
$(CC) $(CFLAGS) $1 -o $(call objpath, $(DEP)) -c $(DEP))
$(LD) -r $(LDFLAGS) -o $@ $(call objpath, $?)
endef
# === BUILD TARGETS ===
all:
.PHONY: tests
tests: $(BIN) $(BIN)/test-imgui-sdl3glfw3 $(BIN)/test-custom
$(BIN)/test-imgui-sdl3glfw3:
$(CXX) -o $@ sandbox/$(notdir $@).cpp -Ideps -Ideps/imgui -Ldeps -limgui -lSDL3 -lGL -lm
$(BIN)/test-custom:
$(CXX) -o $@ sandbox/$(notdir $@).cpp -Ideps -Ideps/imgui -Ldeps -limgui -lSDL3 -lGL -lm
$(BUILD) $(BIN):
mkdir -p $@
# === DEVELOPMENT TARGETS ===
# .PHONY: debug run test
# debug:
# $(MAKE) all \
# CFLAGS="$(CFLAGS) $(CFLAGS_DBG)" \
# CLDFLAGS="$(CLDFLAGS) $(CLDFLAGS_DBG)"
# run: debug
# - command $(BIN)/pw-test
# test: clean run
# === UTILITY TARGETS ===
.PHONY: clean
clean:
- rm -rf $(BUILD) $(BIN) vgcore.* &>/dev/null logs/