-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathMakefile
67 lines (56 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
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
CFLAGS=-Wall -std=c99
DEFS=
# CC=gcc
INCS=-I. -Isrc/backend/lib
src=\
$(wildcard src/*.c)\
$(wildcard src/backend/*.c)\
$(wildcard src/backend/lib/*.c)\
$(wildcard src/core/*.c)\
$(wildcard src/core/hw/*.c)\
# platform
ifndef platform
platform=linux
endif
ifeq ($(platform), windows)
CC=x86_64-w64-mingw32-gcc
LIBS+=-lkernel32 -luser32 -lshell32 -lgdi32 -ld3d11 -ldxgi -lole32 -loleaut32 -lomdlg32
OUTEXT=.exe
else ifeq ($(platform), linux)
DEFS+=-D_GNU_SOURCE
CFLAGS+=-pthread
LIBS+=-lX11 -lXi -lXcursor -lGL -ldl -lm -lasound
else ifeq ($(platform), macos)
LIBS+=-framework Cocoa -framework QuartzCore -framework Metal -framework MetalKit -framework AudioToolbox -framework IOKit
CFLAGS+= -x objective-c
else ifeq ($(platform), web)
LIBS+=-sUSE_WEBGL2=1
CC=emcc
OUTEXT=.html
CFLAGS+=--shell-file=samples/sample-shell.html --embed-file images
endif
# build type
ifndef build
build=debug
endif
ifeq ($(platform), web)
ifeq ($(build), debug)
CFLAGS+=-O1 -fno-inline -g
else
CFLAGS+=-Oz -g0 -flto
CFLAGS+=-Wl,--strip-all,--gc-sections,--lto-O3
endif
else ifeq ($(build), debug)
CFLAGS+=-Og -g
else ifeq ($(build), release)
CFLAGS+=-O3 -g -ffast-math -fno-plt -flto
DEFS+=-DNDEBUG
endif
CFLAGS += $(DEFS)
CFLAGS += $(INCS)
obj=$(src:.c=.o)
.PHONY: VFrown clean
VFrown: $(obj)
$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
clean:
rm -f $(obj)