-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
49 lines (43 loc) · 1.26 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
## build all targets to ./build/
MOD=$(shell cat go.mod | grep ^module -m 1 | awk '{ print $$2; }' || '')
.PHONY: targets
targets:
@cd cmd && for target in * ; \
do \
echo "\033[32mbuilding $$target ... \033[0m" ; \
if [ -d $$target ] && [ -e $$target/Makefile ]; then \
cd $$target; \
make build --no-print-directory; \
cd ..; \
else \
echo "\033[31mno entry\033[0m" ; \
fi; \
echo "\033[32mdone!\033[0m\n"; \
done
.PHONY: images
images:
@cd cmd && for target in * ; \
do \
echo "\033[32mbuilding $$target docker image ... \033[0m" ; \
if [ -d $$target ] && [ -e $$target/Dockerfile ]; then \
cd $$target; \
make image --no-print-directory || true; \
cd ..; \
else \
echo "\033[31mno entry\033[0m" ; \
fi; \
echo "\033[32mdone!\033[0m\n"; \
done
.PHONY: fmt
fmt:
@if [ -z ${MOD} ]; then \
goimports -w . ; \
else \
goimports -w -local "${MOD}" . ; \
fi
.PHONY: test
test:
@CGO_LDFLAGS='-L./pkg/ioconnect/lib/linux-x86_64 -lioConnectCore' go test ./... -v -covermode=atomic -coverprofile cover.out
valgrind:
@cd pkg/ioconnect/example && CGO_LDFLAGS="-L../lib/linux-x86_64 -lioConnectCore" go build -o example.valgrind .
@valgrind --leak-check=full --show-leak-kinds=all --track-origins=yes pkg/ioconnect/example/example.valgrind