forked from stm32duino/ArduinoModule-CMSIS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
127 lines (111 loc) · 4.83 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
#
# ARM CMSIS Arduino IDE Module makefile.
#
# Copyright (c) 2015 Atmel Corp./Thibaut VIARD. All right reserved.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
SHELL = /bin/sh
.SUFFIXES: .tar.bz2
ROOT_PATH := .
OS ?=$(shell uname -s)
PACKAGE_NAME := "CMSIS"
# -----------------------------------------------------------------------------
# packaging specific
ifeq (postpackaging,$(findstring $(MAKECMDGOALS),postpackaging))
PACKAGE_FILENAME=$(PACKAGE_NAME)-$(PACKAGE_VERSION).tar.bz2
PACKAGE_CHKSUM := $(firstword $(shell shasum -a 256 "$(PACKAGE_FILENAME)"))
PACKAGE_SIZE := $(firstword $(shell wc -c "$(PACKAGE_FILENAME)"))
endif
# end of packaging specific
# -----------------------------------------------------------------------------
.PHONY: all clean cmsis cmsis5 print_info postpackaging
# Arduino module packaging:
# - exclude version control system files, here git files and folders .git, .gitattributes and .gitignore
# - exclude 'extras' folder
all: cmsis cmsis5
cmsis: PACKAGE_VERSION := 4.5.0
cmsis: PACKAGE_FOLDER := CMSIS
cmsis: clean print_info
@echo ----------------------------------------------------------
@echo "Packaging module."
@tar --exclude=./.gitattributes \
--exclude=./.travis.yml \
--exclude=CMSIS/index.html \
--exclude=CMSIS/Documentation \
--exclude=CMSIS/Pack \
--exclude=CMSIS/Utilities \
--exclude=CMSIS/DSP_Lib/Examples \
--exclude=Device/ARM/Documents \
--exclude=.git \
-cjf "$(PACKAGE_NAME)-$(PACKAGE_VERSION).tar.bz2" "$(PACKAGE_FOLDER)"
$(MAKE) PACKAGE_VERSION=$(PACKAGE_VERSION) --no-builtin-rules postpackaging -C .
@echo ----------------------------------------------------------
cmsis5: PACKAGE_FOLDER := CMSIS_5
cmsis5: PACKAGE_VERSION := $(shell git --git-dir=$(PACKAGE_FOLDER)/.git describe --tags)
cmsis5: PACKAGE_DATE := $(firstword $(shell git --git-dir=$(PACKAGE_FOLDER)/.git log -1 --pretty=format:%ci))
cmsis5: clean print_info
@echo ----------------------------------------------------------
@echo "Packaging module."
@tar --mtime='$(PACKAGE_DATE)' \
--exclude=docs \
--exclude=CMSIS/CoreValidation \
--exclude=CMSIS/Documentation \
--exclude=CMSIS/DoxyGen \
--exclude=CMSIS/DAP/Firmware/Examples/ \
--exclude=CMSIS/DSP/DSP_Lib_TestSuite \
--exclude=CMSIS/DSP/Examples \
--exclude=CMSIS/DSP/Lib/ARM \
--exclude=CMSIS/DSP/Lib/ARMCLANG \
--exclude=CMSIS/DSP/Lib/IAR \
--exclude=CMSIS/DSP/Projects \
--exclude=CMSIS/NN/Examples \
--exclude=CMSIS/NN/NN_Lib_Tests \
--exclude=CMSIS/Pack \
--exclude=CMSIS/RTOS/RTX/Library/ARM \
--exclude=CMSIS/RTOS/RTX/Library/IAR \
--exclude=CMSIS/RTOS2/RTX/Examples \
--exclude=CMSIS/RTOS2/RTX/Library/ARM \
--exclude=CMSIS/RTOS2/RTX/Library/IAR \
--exclude=CMSIS/Utilities \
--exclude=.git \
--exclude=.gitignore \
--exclude=.gitattributes \
--exclude=manifest \
--exclude=*.pdf \
--transform "s|CMSIS_5|CMSIS|" \
-cjf "$(PACKAGE_NAME)-$(PACKAGE_VERSION).tar.bz2" "$(PACKAGE_FOLDER)"
$(MAKE) PACKAGE_VERSION=$(PACKAGE_VERSION) --no-builtin-rules postpackaging -C .
@echo ----------------------------------------------------------
clean:
@echo ----------------------------------------------------------
@echo Cleanup
-$(RM) $(PACKAGE_NAME)-*.tar.bz2 package_$(PACKAGE_NAME)_*.json test_package_$(PACKAGE_NAME)_*.json
@echo ----------------------------------------------------------
print_info:
@echo ----------------------------------------------------------
@echo Building $(PACKAGE_NAME) using
@echo "CURDIR = $(CURDIR)"
@echo "OS = $(OS)"
@echo "SHELL = $(SHELL)"
@echo "PACKAGE_NAME = $(PACKAGE_NAME)"
@echo "PACKAGE_FOLDER = $(PACKAGE_FOLDER)"
@echo "PACKAGE_VERSION = $(PACKAGE_VERSION)"
postpackaging:
@echo "PACKAGE_CHKSUM = $(PACKAGE_CHKSUM)"
@echo "PACKAGE_SIZE = $(PACKAGE_SIZE)"
@echo "PACKAGE_FILENAME = $(PACKAGE_FILENAME)"
@cat extras/package_index.json.template | sed s/%%VERSION%%/$(PACKAGE_VERSION)/ | sed s/%%FILENAME%%/$(PACKAGE_FILENAME)/ | sed s/%%CHECKSUM%%/$(PACKAGE_CHKSUM)/ | sed s/%%SIZE%%/$(PACKAGE_SIZE)/ > package_$(PACKAGE_NAME)_$(PACKAGE_VERSION)_index.json
@echo "package_$(PACKAGE_NAME)_$(PACKAGE_VERSION)_index.json created"