-
Notifications
You must be signed in to change notification settings - Fork 172
Expand file tree
/
Copy pathMakefile
More file actions
154 lines (133 loc) · 3.2 KB
/
Copy pathMakefile
File metadata and controls
154 lines (133 loc) · 3.2 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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
CC=gcc
WR=windres
ifdef ComSpec
RM = cmd.exe /C del /Q
else
RM = rm -f
endif
# Common Warnings
WARNINGS=-Wall -pedantic -Wno-unused-function
WARNINGS+= \
-Wformat-security \
-Wformat=2 \
-Wsign-compare \
-Wuninitialized \
-Wno-multichar \
-Wno-unused-function \
-Wshadow \
-Wcast-align \
-Wredundant-decls $(EXTRA_WARNINGS)
# GCC8+
# -Wimplicit-fallthrough \
# -Wc++-compat \
#
# -Wformat-signedness \
# -Wstrict-overflow \
# -Warray-bounds=2 \
# -Woverflow \
# -Wclobbered \
# -Wempty-body \
# -Wduplicated-cond \
# -Wduplicated-branches \
# -Wnull-dereference \
# -Wwrite-strings
#
# -Wno-attributes \
# -Wignored-qualifiers \
# -Woverride-init \
# -Wlogical-op \
# -Wtype-limits \
#
# -Wsuggest-attribute=pure \
# -Wsuggest-attribute=const \
# -Wsuggest-attribute=noreturn \
#
# -Wstack-usage=4096 \
# -Wframe-larger-than=4096 \
# -Werror=vla \
# -Walloca \
#
# -Wstringop-overflow=4 \
# -Wold-style-declaration \
# -Wjump-misses-init \
#
# GCC 10+
#WARNINGS += -Warith-conversion
# GCC 13+
#WARNINGS += -Wuse-after-free=3
# -Wcast-qual
# -Wsign-conversion
# -Wconversion
# -Wcast-qual
# -Wunsafe-loop-optimizations
# -Wpadded
# -Wstrict-overflow=5
# -Wtrivial-auto-var-init -ftrivial-auto-var-init=pattern \
# -Wunused-parameter
# -Wtraditional-conversion
# -fira-region=one/mixed
# -Wstack-usage=2048
# -finput-charset=UTF-8
# -Wc++-compat
# -D__USE_MINGW_ANSI_STDIO=0 ## useless now
# -fanalyzer
# -mshstk
######
# Determines the platform
EXTRA_TARGET_CFLAGS=-m32 -march=i386 -mtune=i686 \
-mpreferred-stack-boundary=2 \
-momit-leaf-frame-pointer \
-mno-stack-arg-probe
WR_FLAGS=-Fpe-i386
# end
#####
CFLAGS=-Os -std=c99 \
$(EXTRA_TARGET_CFLAGS) \
$(EXTRA_CFLAGS) \
-finput-charset=UTF-8 \
-DUNICODE -D_UNICODE \
-fshort-wchar \
-fno-stack-check \
-fno-ident \
-fomit-frame-pointer \
-fshort-enums \
-fno-exceptions \
-fno-asynchronous-unwind-tables \
-fmerge-all-constants \
-fgcse-sm \
-DSTRICT \
-Wp,-D_FORTIFY_SOURCE=2 \
$(WARNINGS) \
LDFLAGS=-nostdlib \
-lmsvcrt \
-lkernel32 \
-luser32 \
-lgdi32 \
-ladvapi32 \
-s \
-Wl,-s,-dynamicbase \
-Wl,-nxcompat \
-Wl,--no-seh \
-Wl,--relax \
-Wl,--disable-runtime-pseudo-reloc \
-Wl,--enable-auto-import \
-Wl,--disable-stdcall-fixup \
# -Wl,--stack=1048576
EXELD = $(LDFLAGS) \
-Wl,--tsaware \
-lcomctl32 \
-ladvapi32 \
-lshell32 \
$(EXTRA_EXE_LDFLAGS)
# -Wl,--disable-reloc-section
default: AltSnap.exe hooks.dll
hooks.dll : hooks.c hooks.h hooksr.o unfuck.h nanolibc.h zones.c snap.c
$(CC) -o hooks.dll hooks.c hooksr.o $(CFLAGS) $(LDFLAGS) -mdll -fpic -e_DllMain@12 -Wl,--kill-at
AltSnap.exe : altsnapr.o altsnap.c hooks.h tray.c config.c languages.h languages.c unfuck.h nanolibc.h
$(CC) -o AltSnap.exe altsnap.c altsnapr.o $(CFLAGS) $(EXELD) -mwindows -e_unfuckWinMain@0
altsnapr.o : altsnap.rc window.rc resource.h AltSnap.exe.manifest media/find.cur media/find.ico media/icon.ico media/tray-disabled.ico media/tray-enabled.ico
$(WR) altsnap.rc altsnapr.o $(WR_FLAGS)
hooksr.o: hooks.rc resource.h
$(WR) hooks.rc hooksr.o $(WR_FLAGS)
clean :
$(RM) altsnapr.o AltSnap.exe hooksr.o hooks.dll