-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathMakefile
134 lines (98 loc) · 3.71 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
# Makefile for creating stuff on host.
# Not used for "normal" build of the software for the Arduino.
# Use Arduino IDE (https://www.arduino.cc/en/Main/Software) for that.
# 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
# External programs, change if necessary or desired.
CXX=g++
DOXYGEN := doxygen
DOXYFILE := Doxyfile
XSLTPROC := xsltproc
TRANSFORMATION := $(KEYWORD_TXT_GENERATOR_DIR)/doxygen2keywords.xsl
BROWSER=firefox
DEBUGFLAGS=-g
WARNINGFLAGS=-Wall -Wextra -pedantic
BOARD=nano
# Should point to the directory where the Infrared4Arduino
# (https://github.com/bengtmartensson/Infrared4Arduino)
# sources are located. Only used for SIL test.
INFRARED4ARDUINO_DIR=../Infrared4Arduino
INCLUDES=-I$(INFRARED4ARDUINO_DIR)/src -Isrc
# Get VERSION from the version in library.properties
VERSION=$(subst version=,,$(shell grep version= library.properties))
ORIGINURL=$(shell git remote get-url origin)
FLASHER=GirsLite-$(VERSION)-$(BOARD)-flasher.sh
FLASHER_BAT=GirsLite-$(VERSION)-$(BOARD)-flasher.bat
HEXFILE=GirsLite-$(VERSION)-$(BOARD).hex
default: all
VERSION_H := src/GirsLib/version.h
version: $(VERSION_H)
$(VERSION_H): library.properties Makefile
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)\"" >> $@
flasher: $(FLASHER)
hex: $(HEXFILE)
$(FLASHER) $(FLASHER_BAT) $(HEXFILE): tools/mkflasher.sh
tools/mkflasher.sh
# Flash an Arduino nano on /dev/ttyUSB0, without questions etc. May require root.
# Warning: overwrites without question! Be careful!
flash-nano: $(FLASHER)
./$(FLASHER)
#lib: libGirs.a
VPATH=src src/GirsLib examples/Girs
#.PRECIOUS: test1
# TODO: compile Girs.o separately, in tests/Girs
OBJS=\
Girs.o \
GirsUtils.o \
LedLcdManager.o \
LiquidCrystal_I2C_bm.o \
StreamParser.o
libGirs.a: $(OBJS)
$(AR) rs $@ $(OBJS)
%.o: %.cpp $(VERSION_H)
$(CXX) -std=c++11 $(INCLUDES) $(BOARDDEFINES) $(WARNINGFLAGS) $(OPTIMIZEFLAGS) $(DEBUGFLAGS) -c $<
#test%: test%.o libInfrared.a
# $(CXX) -o $@ $< -L. -lInfrared
# ./$@
doc: api-doc/index.html
$(BROWSER) $<
api-doc/index.html xml/index.xml: $(wildcard src/* src/*/* examples/*/*) Doxyfile README.md $(VERSION_H)
$(DOXYGEN) $(DOXYFILE) > /dev/null
gh-pages: api-doc/index.html
rm -rf gh-pages
git clone --depth 1 -b gh-pages $(ORIGINURL) gh-pages
rm -rf gh-pages/*
cp -rf api-doc/* gh-pages
(cd gh-pages; git add . )
(cd gh-pages; git commit -a -m "Update of API documentation for version $(VERSION)")
@echo Now perform \"git push\" from gh-pages
tag:
git checkout master
git status
git tag -a Version-$(VERSION) -m "Tagging Version-$(VERSION)"
git push origin Version-$(VERSION)
mostlyclean:
rm -rf *.a *.o xml test1
clean: mostlyclean
rm -rf *.hex *.zip api-doc gh-pages test1 $(FLASHER) $(FLASHER_BAT)
# Remove all products. Do not use before commit.
spotless: clean
rm -f keywords.txt $(VERSION_H)
keywords: keywords.txt
keywords.txt: xml/index.xml
$(XSLTPROC) $(TRANSFORMATION) $< | uniq > $@
build-tests:
#test: lib
all: version keywords flasher api-doc/index.html
.PHONY: clean distclean spotless version keywords flasher flash-nano lib