This repository has been archived on 2021-04-24. You can view files and clone it, but cannot push or open issues or pull requests.
game/Makefile

39 lines
968 B
Makefile
Raw Normal View History

LUA_VERSION := 5.3
LUA = lua$(LUA_VERSION)
SRC_DIR := src
OBJ_DIR := obj
BIN_DIR := bin
EXE := $(BIN_DIR)/out
2021-02-25 23:13:05 +02:00
OBJ_OUT_DIRS := obj/Main obj/Components obj/Components obj/Components/TopLevel
SRC := $(SRC_DIR)/Main/Main.cpp $(SRC_DIR)/Components/TopLevel/GameObject.cpp $(SRC_DIR)/Components/TopLevel/Game.cpp
OBJ := $(OBJ_DIR)/Main/Main.o $(OBJ_DIR)/Components/TopLevel/GameObject.o $(OBJ_DIR)/Components/TopLevel/Game.o
CC := g++ -std=c++17
CPPFLAGS := -I/usr/include/$(LUA) -Iinclude -MMD -MP
CFLAGS := -Wall
LDFLAGS :=
LDLIBS := -l$(LUA) -ldl
.PHONY: all clean run
all: $(EXE)
run: $(EXE)
@echo -e "\033[1m---> \033[1;35mRunning binary from $(EXE)\033[0m"
@./$(EXE)
$(EXE): $(OBJ) | $(BIN_DIR)
$(CC) $(LDFLAGS) $^ $(LDLIBS) -o $@
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.cpp | $(OBJ_DIR) $(OBJ_OUT_DIRS)
$(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@
$(BIN_DIR) $(OBJ_DIR) $(OBJ_OUT_DIRS):
mkdir -p $@
clean:
@$(RM) -rv $(BIN_DIR) $(OBJ_DIR)
-include $(OBJ:.o=.d)