forked from njh/mqtt-sn-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
62 lines (50 loc) · 1.38 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
CC=cc
PACKAGE=mqtt-sn-tools
VERSION=0.0.3
CFLAGS=-g -Wall -DVERSION=$(VERSION)
LDFLAGS=
INSTALL?=install
prefix=/usr/local
TARGETS=mqtt-sn-dump mqtt-sn-pub mqtt-sn-sub mqtt-sn-serial-bridge
.PHONY : all install uninstall clean dist test coverage
all: $(TARGETS)
$(TARGETS): %: mqtt-sn.o %.o
$(CC) $(LDFLAGS) -o $@ $^
%.o : %.c mqtt-sn.h
$(CC) $(CFLAGS) -c $<
install: $(TARGETS)
$(INSTALL) -d "$(DESTDIR)$(prefix)/bin"
$(INSTALL) -s $(TARGETS) "$(DESTDIR)$(prefix)/bin"
uninstall:
@for target in $(TARGETS); do \
cmd="rm -f $(DESTDIR)$(prefix)/bin/$$target"; \
echo "$$cmd" && $$cmd; \
done
clean:
-rm -f *.o *.gcda *.gcno $(TARGETS)
-rm -Rf coverage
dist:
distdir='$(PACKAGE)-$(VERSION)'; mkdir $$distdir || exit 1; \
list=`git ls-files`; for file in $$list; do \
cp -pR $$file $$distdir || exit 1; \
done; \
tar -zcf $$distdir.tar.gz $$distdir; \
rm -fr $$distdir
test: all
@(which bundle > /dev/null) || (echo "Ruby Bundler is not installed"; exit -1)
cd test && bundle install && bundle exec rake test
# Use gcc for coverage report - it works better than clang/llvm
coverage: CC=gcc
coverage: CFLAGS += --coverage
coverage: LDFLAGS += --coverage
coverage: clean test
mkdir -p coverage
lcov \
--capture \
--directory . \
--no-external \
--output coverage/lcov.info
genhtml \
--title 'MQTT-SN Tools' \
--output-directory coverage \
coverage/lcov.info