-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
executable file
·31 lines (22 loc) · 1.33 KB
/
Makefile
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
# get the mod name from main.cpp
#MOD_NAME := $(shell grep -Po '(?<=#define MOD_NAME ")[^"]*' main.cpp)
MOD_NAME := $(shell grep -Po 'name\s*:\s*"[^"]*' info.json5 | grep -Po '(?<=")[^"]*')
# configure mingw as the compiler
CC=x86_64-w64-mingw32-g++
# 4dm.h will spam your compiler output otherwise
# HIDE_SOME_WARNINGS=-Wno-return-type -Wno-conversion-null
HIDE_SOME_WARNINGS=-Wno-return-type -Wno-conversion-null -Wno-return-local-addr
CFLAGS=-std=c++20 -mwindows $(HIDE_SOME_WARNINGS) -s -O3 -flto=auto
INCLUDE=-I 4dm.h/ -I 4dm.h/networking/include/
# ./4dm.h/networking/lib/*;./4dm.h/soil/SOIL.lib;opengl32.lib;glew32.lib;glfw3.lib
NETLIBS=$(shell find 4dm.h/networking/lib/*.lib -not -name steamwebrtc.lib -not -name webrtc-lite.lib)
CLIBS=-L. $(patsubst %.lib,-l %,$(NETLIBS)) -L. -l opengl32 -Wl,-Bdynamic -l glew32 -l glfw3 -Wl,-Bstatic
# CLIBS=-L. $(patsubst %.lib,-l %,$(wildcard 4dm.h/networking/lib/*.lib)) -L 4dm.h/soil -l SOIL -L. -l opengl32 -Wl,-Bdynamic -l glew32 -l glfw3 -Wl,-Bstatic
default: compile
compile:
$(CC) $(CFLAGS) $(INCLUDE) main.cpp -shared -static $(CLIBS) -o "$(MOD_NAME).dll"
install:
cd ~/.steamapps/4D\ Miner/4D\ Miner\ 0.2.1.4/mods/ && mkdir -p "$(MOD_NAME)"
cp "$(MOD_NAME).dll" info.json5 icon.png ~/.steamapps/4D\ Miner/4D\ Miner\ 0.2.1.4/mods/"$(MOD_NAME)"/ ;true
clean:
rm "$(MOD_NAME).dll"