-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
219 lines (170 loc) · 6.36 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
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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
#-------------------------------------------------------------------------------
# Ubuntu + Ubuntu Touch Makefile
targets:
@grep '^[a-zA-Z0-9\.#-]\+:' Makefile | grep -v '^\.' | grep -v targets | sed 's/:.*//' | uniq | sed 's/\.elf/.hex/' | sed 's/^/Make clean \&\& Make -j /'
MAKEFLAGS += --no-builtin-rules
#-------------------------------------------------------------------------------
INCLUDES = \
-I/usr/include/libevdev-1.0 \
-I./include \
-I./include/vulkan \
-I./libraries \
-I./src/ \
-I./src/lib \
-I./src/onl \
-I./src/onl/vulkan \
-I./src/onn/ \
-I./src/onp/ \
#-------------------------------------------------------------------------------
LIB_SOURCES = \
./src/lib/lib.c \
./src/lib/list.c \
./src/lib/value.c \
./src/lib/tests.c \
./src/lib/properties.c \
ONL_UNIX_SOURCES = \
./src/onl/unix/serial.c \
./src/onl/unix/channel-serial.c \
./src/onl/unix/log.c \
./src/onl/unix/mem.c \
./src/onl/unix/time.c \
./src/onl/unix/random.c \
./src/onl/unix/persistence.c \
ONL_VULKAN_XCB_SOURCES = \
./src/onl/drivers/onl.c \
./src/onl/drivers/libevdev/libevdev.c \
./src/onl/drivers/viture/viture_imu.c \
./src/onl/vulkan/vulkan-xcb.c \
./src/onl/vulkan/vk.c \
./src/onl/vulkan/vk-rendering.c \
ONL_VULKAN_DRM_SOURCES = \
./src/onl/drivers/onl.c \
./src/onl/drivers/libevdev/libevdev.c \
./src/onl/drivers/viture/viture_imu.c \
./src/onl/vulkan/vulkan-drm.c \
./src/onl/vulkan/vk.c \
./src/onl/vulkan/vk-rendering.c \
ONN_ONP_SOURCES = \
./src/onn/onn.c \
./src/onp/onp.c \
LIBONEX_XCB_SOURCES = \
$(LIB_SOURCES) \
$(ONL_UNIX_SOURCES) \
$(ONL_VULKAN_XCB_SOURCES) \
$(ONN_ONP_SOURCES) \
LIBONEX_DRM_SOURCES = \
$(LIB_SOURCES) \
$(ONL_UNIX_SOURCES) \
$(ONL_VULKAN_DRM_SOURCES) \
$(ONN_ONP_SOURCES) \
#-------------------------------------------------------------------------------
TESTS_SOURCES = \
./tests/test-properties.c \
./tests/test-list.c \
./tests/test-value.c \
./tests/test-onn.c \
./tests/main.c \
#-------------------------------------------------------------------------------
ONT_VULKAN_SOURCES = \
./tests/ont-examples/vulkan/ont-vk.c \
./tests/ont-examples/vulkan/one-panel.c \
ONT_VULKAN_SHADERS = \
./tests/ont-examples/vulkan/onx.vert.spv \
./tests/ont-examples/vulkan/onx.frag.spv \
#-------------------------------------------------------------------------------
libonex-kernel-xcb.a: COMPILE_LINE=$(X86_FLAGS) $(CC_FLAGS) $(XCB_CC_SYMBOLS) $(INCLUDES)
libonex-kernel-xcb.a: CC=/usr/bin/gcc
libonex-kernel-xcb.a: LD=/usr/bin/gcc
libonex-kernel-xcb.a: AR=/usr/bin/ar
libonex-kernel-xcb.a: TARGET=TARGET_X86
libonex-kernel-xcb.a: CHANNELS=-DONP_CHANNEL_SERIAL -DONP_DEBUG -DONP_OVER_SERIAL
libonex-kernel-xcb.a: $(LIBONEX_XCB_SOURCES:.c=.o)
$(AR) rcs $@ $^
libonex-kernel-drm.a: COMPILE_LINE=$(X86_FLAGS) $(CC_FLAGS) $(DRM_CC_SYMBOLS) $(INCLUDES)
libonex-kernel-drm.a: CC=/usr/bin/gcc
libonex-kernel-drm.a: LD=/usr/bin/gcc
libonex-kernel-drm.a: AR=/usr/bin/ar
libonex-kernel-drm.a: TARGET=TARGET_X86
libonex-kernel-drm.a: CHANNELS=-DONP_CHANNEL_SERIAL -DONP_DEBUG -DONP_OVER_SERIAL
libonex-kernel-drm.a: $(LIBONEX_DRM_SOURCES:.c=.o)
$(AR) rcs $@ $^
#-------------------------------------------------------------------------------
test-ok: COMPILE_LINE=$(X86_FLAGS) $(CC_FLAGS) $(XCB_CC_SYMBOLS) $(INCLUDES)
test-ok: CC=/usr/bin/gcc
test-ok: LD=/usr/bin/gcc
test-ok: TARGET=TARGET_X86
test-ok: CHANNELS=-DONP_CHANNEL_SERIAL
test-ok: libonex-kernel-xcb.a $(TESTS_SOURCES:.c=.o)
$(LD) $(TESTS_SOURCES:.c=.o) -pthread -L. -lonex-kernel-xcb -o $@
run.tests: test-ok
./test-ok
run.valgrind: test-ok
valgrind --leak-check=yes --undef-value-errors=no ./test-ok
#-------------------------------------------------------------------------------
vulkan.xcb: COMPILE_LINE=$(X86_FLAGS) $(CC_FLAGS) $(XCB_CC_SYMBOLS) $(INCLUDES)
vulkan.xcb: CC=/usr/bin/gcc
vulkan.xcb: LD=/usr/bin/gcc
vulkan.xcb: TARGET=TARGET_X86
vulkan.xcb: libonex-kernel-xcb.a $(ONT_VULKAN_SOURCES:.c=.o) ${ONT_VULKAN_SHADERS:.spv=.o}
@echo ================
@echo $@ '<=' $(ONT_VULKAN_SOURCES:.c=.o) ${ONT_VULKAN_SHADERS:.spv=.o}
@echo -----
$(LD) $(ONT_VULKAN_SOURCES:.c=.o) ${ONT_VULKAN_SHADERS:.spv=.o} ${XCB_LIBS} -o $@
vulkan.drm: COMPILE_LINE=$(X86_FLAGS) $(CC_FLAGS) $(DRM_CC_SYMBOLS) $(INCLUDES)
vulkan.drm: CC=/usr/bin/gcc
vulkan.drm: LD=/usr/bin/gcc
vulkan.drm: TARGET=TARGET_X86
vulkan.drm: libonex-kernel-drm.a $(ONT_VULKAN_SOURCES:.c=.o) ${ONT_VULKAN_SHADERS:.spv=.o}
@echo ================
@echo $@ '<=' $(ONT_VULKAN_SOURCES:.c=.o) ${ONT_VULKAN_SHADERS:.spv=.o}
@echo -----
$(LD) $(ONT_VULKAN_SOURCES:.c=.o) ${ONT_VULKAN_SHADERS:.spv=.o} ${DRM_LIBS} -o $@
#-------------------------------------------------------------------------------
XCB_LIBS=-pthread -Wl,-rpath,./libraries -L. -L./libraries -lonex-kernel-xcb -lviture_one_sdk -lvulkan -lxcb -levdev -lfreetype -lm
DRM_LIBS=-pthread -Wl,-rpath,./libraries -L. -L./libraries -lonex-kernel-drm -lviture_one_sdk -lvulkan -levdev -lfreetype -lm
X86_FLAGS=-ggdb3 -O2
XCB_CC_SYMBOLS = -D$(TARGET) $(CHANNELS) -DVK_USE_PLATFORM_XCB_KHR
DRM_CC_SYMBOLS = -D$(TARGET) $(CHANNELS) -DVK_USE_PLATFORM_DISPLAY_KHR
CC_FLAGS = -std=gnu17 -Wall -Werror -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -fno-strict-aliasing -fno-builtin-memcmp -Wimplicit-fallthrough=0 -fvisibility=hidden -Wno-unused-function -Wno-incompatible-pointer-types -Wno-unused-variable -Wno-unused-but-set-variable -Wno-unused-result -Wno-switch
%.o: %.c
@echo ================
@echo $@ '<=' $<
@echo -----
$(CC) $(COMPILE_LINE) -o $@ -c $<
%.o: %.cpp
@echo ================
@echo $@ '<=' $<
@echo -----
$(CC) $(COMPILE_LINE) -o $@ -c $<
%.vert.spv: %.vert
@echo ================
@echo $@ '<=' $<
@echo -----
glslc $< -o $@
%.frag.spv: %.frag
@echo ================
@echo $@ '<=' $<
@echo -----
glslc $< -o $@
%.vert.c: %.vert.spv
@echo ================
@echo $@ '<=' $<
@echo -----
xxd -i $< > $@
%.frag.c: %.frag.spv
@echo ================
@echo $@ '<=' $<
@echo -----
xxd -i $< > $@
copy:
rsync -ruav --stats --progress --delete ok/ duncan@arb:ok
clean:
find src tests -name '*.o' -o -name '*.d' | xargs -r rm
rm -f core
rm -rf test-ok *.xcb *.drm ok
rm -rf ${TARGETS} tests/ont-examples/vulkan/*.{inc,spv,vert.c,frag.c}
find . -name onex.ondb | xargs -r rm
@echo "------------------------------"
@echo "files not cleaned:"
@git ls-files --others --exclude-from=.git/info/exclude | xargs -r ls -Fla
#-------------------------------------------------------------------------------