-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathMakefile
142 lines (109 loc) · 3.35 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
# Makefile for creating stuff on host.
# Use Arduino IDE for compiling for Arduino.
# The functions for generating keywords.txt requires KeywordsTxtGenerator,
# https://github.com/bengtmartensson/KeywordsTxtGenerator, to be installed in
# KEYWORD_TXT_GENERATOR_DIR.
ifneq ($(ARDUINO),)
$(error This Makefile is not for compiling target code, for that, use the Arduino IDE.)
endif
KEYWORD_TXT_GENERATOR_DIR = ../KeywordsTxtGenerator
DOXYGEN := doxygen
DOXYFILE := Doxyfile
XSLTPROC := xsltproc
TRANSFORMATION := $(KEYWORD_TXT_GENERATOR_DIR)/doxygen2keywords.xsl
CXX:=g++
BROWSER:=firefox
DEBUGFLAGS:=-g
WARNINGFLAGS:=-Wall -Werror -Wextra -pedantic
VPATH=tests src src/boards
GH_PAGES := gh-pages
VERSION_H := src/version.h
# Get VERSION from the version in library.properties
VERSION := $(subst version=,,$(shell grep version= library.properties))
ORIGINURL := $(shell git remote get-url origin)
.PRECIOUS: test1
OBJS=\
Board.o \
HashDecoder.o \
IrReader.o \
IrReceiver.o \
IrReceiverPoll.o \
IrReceiverSampler.o \
IrSender.o \
IrSender.o \
IrSenderNonMod.o \
IrSenderPwm.o \
IrSenderPwmHard.o \
IrSenderPwmSoft.o \
IrSenderPwmSoftDelay.o \
IrSenderPwmSpinWait.o \
IrSenderSimulator.o \
IrSequence.o \
IrSignal.o \
IrWidget.o \
IrWidgetAggregating.o \
MultiDecoder.o \
Nec1Decoder.o \
Nec1Renderer.o \
Pronto.o \
Rc5Decoder.o \
Rc5Renderer.o \
SIL.o
EXTRA_INCLUDES=\
InfraredTypes.h \
IrDecoder.h \
IrSenderNonMod.h \
IrSequenceReader.h \
NOT_EXPORTED_INCLUDE = SIL.h Board.h
EXPORTED_INCLUDES := $(sort $(filter-out $(NOT_EXPORTED_INCLUDE), $(EXTRA_INCLUDES) $(subst .o,.h,$(OBJS))))
all: test doc keywords.txt library.properties
libInfrared.a: $(OBJS)
$(AR) rs $@ $(OBJS)
%.o: %.cpp
$(CXX) -Isrc -std=c++11 $(WARNINGFLAGS) $(OPTIMIZEFLAGS) $(DEBUGFLAGS) -c $<
test%: test%.o libInfrared.a
$(CXX) -o $@ $< -L. -lInfrared
./$@
release: push gh-pages tag deploy
push:
git push
deploy:
version: $(VERSION_H)
$(VERSION_H): library.properties Makefile
echo "Creating $(VERSION_H)"
@echo "// This file was automatically generated from $<; do not edit." > $@
@echo "#pragma once" >> $@
@echo "/**" >> $@
@echo " * Version of the current library." >> $@
@echo " * Taken from the version in $<." >> $@
@echo " */" >> $@
@echo "#define VERSION \"$(VERSION)\"" >> $@
api-doc/index.html xml/index.xml: $(wildcard src/*) $(VERSION_H) $(DOXYFILE) README.md
GIT_VERSION=$(VERSION) $(DOXYGEN) $(DOXYFILE)
doc: api-doc/index.html
$(BROWSER) $<
gh-pages: api-doc/index.html
rm -rf $(GH_PAGES)
git clone --depth 1 -b gh-pages ${ORIGINURL} ${GH_PAGES}
( cd ${GH_PAGES} ; \
cp -rf ../api-doc/* . ; \
git add * ; \
git commit -S -a -m "Update of API documentation" ; \
git push )
tag:
git checkout master
git status
git tag -s -a Version-$(VERSION) -m "Tagging Version-$(VERSION)"
git push origin Version-$(VERSION)
clean:
rm -rf *.a *.o api-doc xml test1 $(GH_PAGES) library.properties.tmp
spotless: clean
rm -rf keywords.txt
build-tests:
test: test1
keywords.txt: xml/index.xml
$(XSLTPROC) $(TRANSFORMATION) $< > $@
library.properties: Makefile
sed -e "s/^includes=.*/includes=$(EXPORTED_INCLUDES:%=%,)/" -e s/,$$// $@ > [email protected]
mv [email protected] $@
.PHONY: clean spotless doc