39 lines
No EOL
964 B
Makefile
39 lines
No EOL
964 B
Makefile
LUA_VERSION := 5.3
|
|
LUA = lua$(LUA_VERSION)
|
|
|
|
SRC_DIR := src
|
|
OBJ_DIR := obj
|
|
BIN_DIR := bin
|
|
|
|
EXE := $(BIN_DIR)/out
|
|
OBJ_OUT_DIRS := obj/Main obj/LuaHandler obj/Components obj/Components/Objects obj/Components/Objects/TopLevel
|
|
SRC := $(SRC_DIR)/Main/Main.cpp $(SRC_DIR)/LuaHandler/LuaHandler.cpp $(SRC_DIR)/Components/GameObject.cpp
|
|
OBJ := $(OBJ_DIR)/Main/Main.o $(OBJ_DIR)/LuaHandler/LuaHandler.o $(OBJ_DIR)/Components/GameObject.o
|
|
CC := g++
|
|
|
|
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) |