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
2021-04-24 13:37:57 +03:00

39 lines
No EOL
746 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
SRC := $(SRC_DIR)/Main/Main.cpp
OBJ := $(OBJ_DIR)/Main/Main.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)