-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
83 lines (56 loc) · 2.06 KB
/
Makefile
File metadata and controls
83 lines (56 loc) · 2.06 KB
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
TESTS=tests/test-io-inputs tests/test-plugins tests/test-ai-engines
DEBUG ?= 1
PLUGINS_PATH=$(PWD)/plugins
CC=gcc -std=gnu99 -D_GNU_SOURCE
LINKER=gcc -std=gnu99 -D_GNU_SOURCE
AR=ar crf
CFLAGS = -g -Wall -Iinclude -D_DEBUG
ifeq ($(DEBUG),1)
CFLAGS += -D_DEBUG
endif
LDFLAGS = $(CFLAGS)
ifeq (,$(OS))
OS=$(shell uname -s)
endif
ifeq ($(OS),MINGW64_NT-10.0)
CFLAGS += -D_WIN32 -IC:/msys64/mingw64/include/
LIBS += $(shell pkg-config --libs json-c)
endif
ifeq ($(OS),Windows_NT)
CFLAGS += -D_WIN32 -IC:/msys64/mingw64/include/
LIBS += $(shell pkg-config --libs json-c)
endif
SOURCES := $(wildcard src/*.c)
OBJECTS := $(SOURCES:src/%.c=obj/%.o)
UTILS_CFLAGS = $(CFLAGS) `pkg-config --cflags gio-2.0 glib-2.0`
UTILS_LDFLAGS = $(UTILS_CFLAGS)
UTILS_LIBS = -lm -lpthread -ljson-c -ljpeg -lpng -lcairo -ldl `pkg-config --libs gio-2.0 glib-2.0`
UTILS_SOURCES := $(wildcard utils/*.c)
UTILS_OBJECTS := $(UTILS_SOURCES:utils/%.c=obj/utils/%.o)
all: do_init lib/libann-utils.a lib/libann-utils.so plugins tests/test-plugins tests
lib/libann-utils.a: $(UTILS_OBJECTS) $(OBJECTS)
echo "[libann-utils.a]:: " $^
$(AR) $@ $^
lib/libann-utils.so: $(UTILS_SOURCES) $(SOURCES)
$(LINKER) -fPIC -shared $(UTILS_LDFLAGS) -o $@ $(UTILS_SOURCES) $(SOURCES) $(UTILS_LIBS)
plugins: $(OBJECTS)
cd src/plugins/io && ./make.sh all
cd src/plugins/ai-engines && ./make.sh
$(UTILS_OBJECTS): obj/utils/%.o : utils/%.c
$(CC) -o $@ -c $< $(UTILS_CFLAGS)
$(OBJECTS) : obj/%.o : src/%.c
echo "os: $(OS)"
$(CC) -o $@ -c $< $(CFLAGS)
tests/test-plugins: tests/test-plugins.c lib/libann-utils.a
gcc -g -Wall $(LDFLAGS) -o $@ $^ $(UTILS_LDFLAGS) $(UTILS_LIBS)
tests/test-io-inputs: tests/test-io-inputs.c lib/libann-utils.a
gcc -g -Wall $(LDFLAGS) -o $@ $^ $(UTILS_LDFLAGS) $(UTILS_LIBS) \
`pkg-config --cflags --libs gstreamer-1.0`
tests/test-ai-engines: tests/test-ai-engines.c lib/libann-utils.a
gcc -g -Wall $(LDFLAGS) -o $@ $^ $(UTILS_LDFLAGS) $(UTILS_LIBS)
.PHONY: do_init clean tests
do_init:
mkdir -p plugins obj obj/utils lib
clean:
rm -f obj/*.o obj/utils/*.o lib/libann-utils.*
tests: $(TESTS)