39 lines
822 B
Makefile
39 lines
822 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
|
||
|
SRC := $(SRC_DIR)/Main/Main.cpp $(SRC_DIR)/LuaHandler/LuaHandler.cpp
|
||
|
OBJ := $(OBJ_DIR)/Main/Main.o $(OBJ_DIR)/LuaHandler/LuaHandler.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)
|