39 lines
No EOL
746 B
Makefile
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) |