forked from rosemash/sky-cotl-research
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
76 lines (57 loc) · 1.97 KB
/
Makefile
File metadata and controls
76 lines (57 loc) · 1.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
MAKEFLAGS += -s -j
DIST_DIR = ./dist
SRC_DIR = ./src
SRC_DIRS = $(SRC_DIR) $(wildcard $(SRC_DIR)/*/)
C_SRC = $(wildcard $(SRC_DIR)/*.c $(SRC_DIR)/*/*.c)
CPP_SRC = $(wildcard $(SRC_DIR)/*.cpp $(SRC_DIR)/*/*.cpp)
C_OBJ = $(addprefix $(DIST_DIR)/, $(notdir $(C_SRC:.c=.o)))
CPP_OBJ = $(addprefix $(DIST_DIR)/, $(notdir $(CPP_SRC:.cpp=.o)))
VERSION_SCRIPT = $(SRC_DIR)/exports.txt
TARGET = sky-lua.dll
BIN_TARGET = $(DIST_DIR)/$(TARGET)
# Compiler paths.
CC = gcc
CXX = g++
# Params.
CFLAGS = -Wall -Wformat -O3 -ffunction-sections -fdata-sections -static -flto=auto -s -Wno-unused-function -Wno-unused-variable
CFLAGS += -I./src
# Include ImGui.
CFLAGS += -I./libraries/htmodloader/includes/imgui-1.92.2b -I./libraries/htmodloader/includes/imgui-1.92.2b/backends
# Include HTML.
CFLAGS += -I./libraries/htmodloader/includes/htmodloader
# Include Lua.
CFLAGS += -I./libraries/lua-5.2.0/src
# Include TextEditor.
CFLAGS += -I./libraries/ImGuiColorTextEdit
LFLAGS = -Wl,--gc-sections,-O3,--as-needed,--version-script=$(VERSION_SCRIPT)
LFLAGS += -lgdi32 -ldwmapi -ld3dcompiler -lstdc++
LFLAGS += -L./libraries/htmodloader/lib -lhtmodloader
LFLAGS += -L./libraries/lua-5.2.0/src -llua
LFLAGS += -L./libraries/ImGuiColorTextEdit -lTextEditor
vpath %.c $(SRC_DIRS)
vpath %.cpp $(SRC_DIRS)
.PHONY: all clean libs clean_libs clean_all
$(BIN_TARGET): $(C_OBJ) $(CPP_OBJ)
@echo Linking ...
@$(CXX) $(CFLAGS) $^ -shared -o $@ $(LFLAGS)
@echo Done.
$(DIST_DIR)/%.o: %.c
@echo Compiling file "$<" ...
@$(CC) $(CFLAGS) -c $< -o $@
$(DIST_DIR)/%.o: %.cpp
@echo Compiling file "$<" ...
@$(CXX) $(CFLAGS) -c $< -o $@
clean_all: clean_libs clean
clean:
-@del .\dist\*.o
-@del .\dist\*.dll
all: libs
-@$(MAKE) $(BIN_TARGET)
libs:
@echo Compiling libraries ...
-@$(MAKE) -s -C ./libraries/MinHook libMinHook.a
-@$(MAKE) -s -C ./libraries/lua-5.2.0 mingw
-@$(MAKE) -s -C ./libraries/ImGuiColorTextEdit
clean_libs:
-@$(MAKE) -s -C ./libraries/MinHook clean
-@$(MAKE) -s -C ./libraries/ImGuiColorTextEdit clean