blob: 2f123bd363821687a5764585bbfbe7d9e3f7676a (
plain)
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
|
# this Makefile is specific to GNU Make and GCC'compatible compilers
PKG_CONFIG := $(or\
$(shell pkg-config --version >/dev/null 2>/dev/null && echo pkg-config),\
$(shell command -v pkg-config 2>/dev/null),\
$(error missing pkg-config utility!))
PKG_SDL3 := $(or\
$(and $(shell ${PKG_CONFIG} sdl3 --path 2>/dev/null),sdl3),\
$(shell ${PKG_CONFIG} sdl3 --exists 2>/dev/null && echo sdl3),\
$(error pkg-config was unable to find: sdl3))
PKG_SDL3_IMAGE := $(or\
$(and $(shell ${PKG_CONFIG} sdl3-image --path 2>/dev/null),sdl3-image),\
$(shell ${PKG_CONFIG} sdl3-image --exists 2>/dev/null && echo sdl3-image),\
$(error pkg-config was unable to find: sdl3-image))
OSNAME := $(or\
$(and ${EMSCRIPTEN}, Emscripten),\
${OS},\
$(shell uname -s),\
$(error could not detect OSNAME))
binext_Windows_NT := .exe
binext_Emscripten := .html
BINEXT := ${binext_${OSNAME}}
TEMPDIR := ./bin
BIN := ${TEMPDIR}/demo${BINEXT}
cflags += -std=c99 -Wall -Wextra -Wpedantic
cflags += -O2
#cflags += -O0 -g
#cflags += -fsanitize=address
#cflags += -fsanitize=undefined
cflags += ${CFLAGS}
cppflags += $(shell ${PKG_CONFIG} ${PKG_SDL3} ${PKG_SDL3_IMAGE} --cflags --keep-system-cflags)
cppflags += ${CPPFLAGS}
ldflags += $(shell ${PKG_CONFIG} ${PKG_SDL3} ${PKG_SDL3_IMAGE} --libs-only-L --libs-only-other --keep-system-libs)
ldflags += ${LDFLAGS}
ldlibs += $(shell ${PKG_CONFIG} ${PKG_SDL3} ${PKG_SDL3_IMAGE} --libs-only-l --keep-system-libs)
ldlibs += -lm -luvc
ldlibs += ${LDLIBS}
# HACK: this one is for compatibility with other demos
ldlibs += ${LIBS}
DEP := ${TEMPDIR}/$(notdir ${BIN}).d
SRC := main.c
${BIN}:
mkdir -p $(dir $@)
${CC} ${SRC} -o $@ -MD -MF ${DEP} ${cppflags} ${ldflags} ${ldlibs} ${cflags}
${BIN}: ${SRC}
-include ${DEP}
|