-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
73 lines (62 loc) · 1.57 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
CC = gcc
ODIN = odin
CUSTOM_CFLAGS =
LIBS := -w -lgdi32 -lm -lopengl32 -lwinmm -ggdb
LIB_EXT = .lib
ifneq (,$(filter $(CC),winegcc x86_64-w64-mingw32-gcc))
detected_OS := Windows
LIB_EXT = .lib
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 -lshell32 -lgdi32 -lopengl32 -lwinmm
LIB_EXT = .dll
endif
ifeq ($(detected_OS),Darwin) # Mac OS X
LIBS := -lm -framework Foundation -framework AppKit -framework OpenGL -framework CoreVideo -w
LIB_EXT = .a
endif
ifeq ($(detected_OS),Linux)
LIBS := -lXrandr -lX11 -lm -lGL
LIB_EXT = .a
endif
all:
make RGFW/RGFW$(LIB_EXT)
$(ODIN) build basic.odin -file
$(ODIN) build basic-buffer.odin -file
build-RGFW:
make RGFW/RGFW$(LIB_EXT)
debug:
ifeq ($(detected_OS),Windows)
make clean
.\build-libs.bat
make RGFW/RGFW$(LIB_EXT)
$(ODIN) run basic.odin -file
$(ODIN) run basic-buffer.odin -file
else
make clean
make RGFW/RGFW$(LIB_EXT)
$(ODIN) run basic.odin -file
$(ODIN) run basic-buffer.odin -file
endif
RGFW/RGFW.o:
$(CC) $(CUSTOM_CFLAGS) RGFW/RGFW.c -c $(LIBS) -fPIC -o RGFW/RGFW.o
RGFW/RGFW$(LIB_EXT):
ifeq ($(detected_OS),Windows)
.\build-libs.bat
else
make RGFW/RGFW.o
$(AR) rcs RGFW.a RGFW/RGFW.o
mv RGFW.a RGFW/RGFW.a
endif
clean:
rm -f RGFW/RGFW.o RGFW/RGFW$(LIB_EXT)
rm -f RGFW/RGFW.lib RGFW/RGFW.obj