-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
44 lines (34 loc) · 1.29 KB
/
Copy pathMakefile
File metadata and controls
44 lines (34 loc) · 1.29 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
FFMPEG_LIBS= libavdevice \
libavformat \
libavfilter \
libavcodec \
libswresample \
libswscale \
libavutil \
CFLAGS += -Wall -g -fPIC
CFLAGS := $(shell pkg-config --cflags $(FFMPEG_LIBS)) $(CFLAGS)
LDFLAGS := $(shell pkg-config --libs $(FFMPEG_LIBS))
# export CGO_ENABLED=1
# export CGO_LDFLAGS=$(LDFLAGS)
# export CGO_CFLAGS=$(CFLAGS)
EXAMPLE_C=$(wildcard ./example/*.c)
SOURCES_C=$(wildcard ./ffmpegio/*.c)
SOURCES_GO=$(wildcard ./ffmpegio/*.go)
all: framecounterc mainc test
framecounterc: ./example/framecounter.c $(SOURCES_C)
gcc $(CFLAGS) -I./ $^ $(LDFLAGS) -o ./bin/framecounterc
# TODO: figure out how to statically link this.
# gcc $(CFLAGS) -I./ $^ -static $(LDFLAGS) -o ./bin/framecounter-static
mainc: ./example/main.c $(SOURCES_C)
gcc $(CFLAGS) -I./ $^ $(LDFLAGS) -o ./bin/mainc
test: $(SOURCES_C) $(SOURCES_GO)
go test -v ./ffmpegio
debug: $(SOURCES_C) $(SOURCES_GO)
export CGO_CFLAGS=-Wno-error; dlv test ./ffmpegio
fmt: $(SOURCES_C) $(SOURCES_GO) $(EXAMPLE_C)
clang-format -i --style=google $(EXAMPLE_C) $(SOURCES_C)
go fmt $(SOURCES_GO)
go run golang.org/x/tools/cmd/goimports@latest -w $(SOURCES_GO)
clean:
go clean -testcache -cache
rm -f $(filter-out bin/.gitkeep, $(wildcard bin/*))