-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathGNUmakefile
123 lines (96 loc) · 1.74 KB
/
GNUmakefile
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
UNAME = $(shell uname -s)
MACHINE = $(shell uname -m)
NAME = \
cddNES
OBJS = \
src/cart.o \
src/apu.o \
src/nes.o \
src/cpu.o \
src/ppu.o \
ui/main.o \
ui/api.o \
ui/fs.o \
ui/args.o \
ui/settings.o \
ui/audio.o \
ui/render/render.o \
ui/render/gl.o \
ui/render/ui.o
CFLAGS = \
-Iui/include \
-Wall \
-Wextra \
-Wno-unused-value \
-Wno-missing-field-initializers \
-Wno-switch \
-Wno-unused-result
CXXFLAGS = \
$(CFLAGS) \
-std=c++11
STATIC_LIBS = \
ui/lib/$(PLATFORM)/libimgui.a \
ui/lib/$(PLATFORM)/libuncurl.a \
ui/lib/$(PLATFORM)/libssl.a \
ui/lib/$(PLATFORM)/libcrypto.a \
ui/lib/$(PLATFORM)/libcJSON.a
ifeq ($(UNAME), Linux)
ifeq ($(MACHINE), armv7l)
PLATFORM = linux-arm
else
PLATFORM = linux
endif
DYNAMIC_LIBS = \
-ldl \
-lstdc++ \
-lm \
-lpthread \
-lGL \
-lSDL2
endif
ifeq ($(UNAME), Darwin)
export SDKROOT=$(shell xcrun --sdk macosx --show-sdk-path)
PLATFORM = macos
%.o: %.mm
$(CC) $(CFLAGS) -c -o $@ $<
OBJS := $(OBJS) \
ui/render/metal.o \
ui/render/ui-metal-shim.o
CFLAGS := $(CFLAGS) \
-DGL_SILENCE_DEPRECATION
DYNAMIC_LIBS = \
-liconv \
-lc++ \
-framework OpenGL \
-framework CoreAudio \
-framework AudioToolbox \
-framework IOKit \
-framework ForceFeedback \
-framework Carbon \
-framework AppKit \
-framework Metal \
-framework QuartzCore
STATIC_LIBS := $(STATIC_LIBS) \
ui/lib/$(PLATFORM)/libSDL2.a
endif
LD_FLAGS = \
ifdef DEBUG
CFLAGS := $(CFLAGS) -O0 -g
LD_FLAGS := $(LD_FLAGS) -O0 -g
else
CFLAGS := $(CFLAGS) -fvisibility=hidden -O3 -flto
LD_FLAGS := $(LD_FLAGS) -fvisibility=hidden -O3 -flto
endif
LD_COMMAND = \
$(CC) \
$(OBJS) \
$(STATIC_LIBS) \
$(DYNAMIC_LIBS) \
-o $(NAME) \
$(LD_FLAGS)
all: clean clear $(OBJS)
$(LD_COMMAND)
clean:
rm -rf $(OBJS)
clear:
clear