forked from AceSLS/SLSsteam
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
103 lines (82 loc) · 3.03 KB
/
Copy pathMakefile
File metadata and controls
103 lines (82 loc) · 3.03 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#Thanks to https://stackoverflow.com/questions/52034997/how-to-make-makefile-recompile-when-a-header-file-is-changed for the -MMD & -MP flags
#Without them headers wouldn't trigger recompilation
#Force g++ cause clang crashes on some hooks
CXX := g++
libs := $(wildcard lib/*.a)
srcs := $(shell find src/ -type f -iname "*.cpp")
objs := $(srcs:src/%.cpp=obj/%.o)
deps := $(objs:%.o=%.d)
CXXFLAGS := -O3 -flto=auto -fPIC -m32 -std=c++20 -Wall -Wextra -Wpedantic -Wno-error=format-security -D_GLIBCXX_USE_CXX11_ABI=0
LDFLAGS := -shared -Wl,--no-undefined
LDFLAGS += $(shell pkg-config --libs "openssl")
LDFLAGS += $(shell pkg-config --libs "libcurl")
#DATE := $(shell date "+%Y%m%d%H%M%S")
DATE := $(shell cat res/version.txt)
ifeq ($(shell echo $$NATIVE),1)
CXXFLAGS += -march=native
endif
#Speed up compilation if additional dependencies are found
ifeq ($(shell type ccache &> /dev/null && echo "found"),found)
export PATH := /usr/lib/ccache/bin:$(PATH)
endif
ifeq ($(shell type mold &> /dev/null && echo "found"),found)
LDFLAGS += -fuse-ld=mold
endif
audit-libs: bin/SLSsteam.so bin/library-inject.so tools/ticket-grabber/bin/Release/net9.0/linux-x64/publish/ticket-grabber
bin/SLSsteam.so: $(objs) $(libs)
@mkdir -p bin
$(CXX) $(CXXFLAGS) $^ -o bin/SLSsteam.so $(LDFLAGS)
bin/library-inject.so: tools/library-inject/main.cpp tools/library-inject/build.sh
sh tools/library-inject/build.sh
@mkdir -p bin
cp tools/library-inject/library-inject.so bin/library-inject.so
tools/ticket-grabber/bin/Release/net9.0/linux-x64/publish/ticket-grabber:
sh tools/ticket-grabber/build.sh
-include $(deps)
obj/update.o: src/update.cpp res/version.txt
$(shell ./embed-version.sh)
@mkdir -p $(dir $@)
$(CXX) $(CXXFLAGS) -isysteminclude -MMD -MP -c $< -o $@
-include $(deps)
obj/config.o: src/config.cpp res/config.yaml
$(shell ./embed-config.sh)
@mkdir -p $(dir $@)
$(CXX) $(CXXFLAGS) -isysteminclude -MMD -MP -c $< -o $@
-include $(deps)
obj/%.o : src/%.cpp
@mkdir -p $(dir $@)
$(CXX) $(CXXFLAGS) -isysteminclude -MMD -MP -c $< -o $@
clean:
rm -rvf "obj/" "bin/" "zips/" "tools/ticket-grabber/bin"
install:
sh setup.sh
zips: rebuild
@mkdir -p zips
7z a -mx9 -m9=lzma2 \
"zips/SLSsteam $(DATE).7z" \
"bin/SLSsteam.so" \
"bin/library-inject.so" \
"setup.sh" \
"docs/LICENSE" \
"res/config.yaml" \
"tools/SLScheevo" \
"tools/ticket-grabber/bin/Release/net9.0/linux-x64/publish/ticket-grabber"
#Compatibility for Github issues
7z a -mx9 -m9=lzma \
"zips/SLSsteam $(DATE).zip" \
"bin/SLSsteam.so" \
"bin/library-inject.so" \
"setup.sh" \
"docs/LICENSE" \
"res/config.yaml" \
"tools/SLScheevo" \
"tools/ticket-grabber/bin/Release/net9.0/linux-x64/publish/ticket-grabber"
zips-config:
7z a -mx9 -m9=lzma "zips/SLSsteam - SLSConfig $(DATE).zip" "$(HOME)/.config/SLSsteam/config.yaml"
#Compatibility for Github issues
7z a -mx9 -m9=lzma2 "zips/SLSsteam - SLSConfig $(DATE).7z" "$(HOME)/.config/SLSsteam/config.yaml"
build: audit-libs
rebuild: clean build
all: clean build zips
.PHONY: all build clean rebuild zips
.NOTPARALLEL: clean rebuild zips