-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
92 lines (76 loc) · 2.13 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
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
CC = gcc
LIBS :=-lgdi32 -lm -lwinmm -ggdb -lopengl32
EXT = .exe
STATIC =
WARNINGS = -Wall -Werror -Wextra
OS_DIR = \\
ifneq (,$(filter $(CC),winegcc x86_64-w64-mingw32-gcc i686-w64-mingw32-gcc))
STATIC = --static
detected_OS := WindowsCross
OS_DIR = /
ifeq ($(CC),x86_64-w64-mingw32-gcc)
CC = x86_64-w64-mingw32-gcc
else
CC = i686-w64-mingw32-gcc
endif
else
ifeq '$(findstring ;,$(PATH))' ';'
detected_OS := Windows
else
detected_OS := $(shell uname 2>/dev/null || echo Unknown)
detected_OS := $(patsubst CYGWIN%,Cygwin,$(detected_OS))
detected_OS := $(patsubst MSYS%,MSYS,$(detected_OS))
detected_OS := $(patsubst MINGW%,MSYS,$(detected_OS))
endif
endif
ifeq ($(detected_OS),Windows)
LIBS := -ggdb -ldwmapi -lshell32 -lwinmm -lgdi32 -lopengl32 $(STATIC)
EXT = .exe
OS_DIR = \\
endif
ifeq ($(detected_OS),Darwin) # Mac OS X
LIBS := -lm -framework Foundation -framework AppKit -framework OpenGL -framework CoreVideo$(STATIC) -framework AudioToolbox
EXT =
OS_DIR = /
endif
ifeq ($(detected_OS),Linux)
LIBS := -lXrandr -lX11 -lm -ldl -lGL -lpthread $(STATIC)
EXT =
OS_DIR = /
endif
ifneq (,$(filter $(CC),cl))
OS_DIR = \\
endif
ifneq (,$(filter $(CC),/opt/msvc/bin/x64/cl.exe /opt/msvc/bin/x86/cl.exe))
OS_DIR = /
endif
ifneq (,$(filter $(CC),cl /opt/msvc/bin/x64/cl.exe /opt/msvc/bin/x86/cl.exe))
WARNINGS =
STATIC = /static
LIBS = $(STATIC)
EXT = .exe
endif
LINK_GL1 =
LINK_GL3 =
LINK_GL2 =
ifneq (,$(filter $(CC),emcc))
LINK_GL1 = -s LEGACY_GL_EMULATION -D LEGACY_GL_EMULATION -sGL_UNSAFE_OPTS=0
LINK_GL3 = -s FULL_ES3
LINK_GL2 = -s FULL_ES2
EXPORTED_JS = -s EXPORTED_RUNTIME_METHODS="['stringToNewUTF8']"
LIBS = -s WASM=1 -s ASYNCIFY -s USE_WEBGL2 -s GL_SUPPORT_EXPLICIT_SWAP_CONTROL=1 $(EXPORTED_JS)
EXT = .js
CC=emcc
endif
LIBS += -I./include -I./include/RSGL $(LIBS)
all: source/main.c libs.o
$(CC) $^ $(LINK_GL1) $(LIBS) -o RSGLDoom$(EXT)
libs.o: source/libs.c
$(CC) $^ -c -I./include -I./include/RSGL
clean:
rm -f *.exe RSGLdoom *.o
debug: source/main.c libs.o
$(CC) $^ $(LINK_GL1) $(LIBS) -D RGFW_DEBUG -o RSGLdoom$(EXT)
ifeq (,$(filter $(CC),emcc))
.$(OS_DIR)RSGLdoom$(EXT)
endif