@@ -24,13 +24,12 @@ SHELL = /bin/sh
2424
2525ROOT_PATH := .
2626
27- # PACKAGE_NAME := $(basename $(notdir $(CURDIR)))
27+ OS ?=$(shell uname -s)
28+
2829PACKAGE_NAME := "CMSIS"
29- PACKAGE_VERSION := 4.5.0
3030
3131# -----------------------------------------------------------------------------
3232# packaging specific
33- PACKAGE_FOLDER := CMSIS
3433
3534ifeq (postpackaging,$(findstring $(MAKECMDGOALS ) ,postpackaging) )
3635PACKAGE_FILENAME =$(PACKAGE_NAME ) -$(PACKAGE_VERSION ) .tar.bz2
@@ -41,15 +40,19 @@ endif
4140# end of packaging specific
4241# -----------------------------------------------------------------------------
4342
44- .PHONY : all clean print_info postpackaging
43+ .PHONY : all cleancmsis cmsis5 print_info postpackaging
4544
4645# Arduino module packaging:
4746# - exclude version control system files, here git files and folders .git, .gitattributes and .gitignore
4847# - exclude 'extras' folder
49- all : clean print_info
48+ all : cmsis cmsis5
49+
50+ cmsis : PACKAGE_VERSION := 4.5.0
51+ cmsis : PACKAGE_FOLDER := CMSIS
52+ cmsis : clean print_info
5053@echo ----------------------------------------------------------
5154@echo" Packaging module."
52- tar --exclude=./.gitattributes\
55+ @ tar --exclude=./.gitattributes\
5356--exclude=./.travis.yml\
5457--exclude=CMSIS/index.html\
5558--exclude=CMSIS/Documentation\
@@ -59,7 +62,36 @@ all: clean print_info
5962--exclude=Device/ARM/Documents\
6063--exclude=.git\
6164-cjf" $( PACKAGE_NAME) -$( PACKAGE_VERSION) .tar.bz2" " $( PACKAGE_FOLDER) "
62- $(MAKE ) --no-builtin-rules postpackaging -C.
65+ $(MAKE ) PACKAGE_VERSION=$(PACKAGE_VERSION ) --no-builtin-rules postpackaging -C.
66+ @echo ----------------------------------------------------------
67+
68+ cmsis5 : PACKAGE_FOLDER := CMSIS_5
69+ cmsis5 : PACKAGE_VERSION :=$(shell git --git-dir=$(PACKAGE_FOLDER ) /.git describe --tags)
70+ cmsis5 : PACKAGE_DATE :=$(firstword $(shell git --git-dir=$(PACKAGE_FOLDER ) /.git log -1 --pretty=format:% ci) )
71+ cmsis5 : clean print_info
72+ @echo ----------------------------------------------------------
73+ @echo" Packaging module."
74+ @tar --mtime=' $(PACKAGE_DATE)' \
75+ --exclude=docs\
76+ --exclude=CMSIS/CoreValidation\
77+ --exclude=CMSIS/Documentation\
78+ --exclude=CMSIS/DoxyGen\
79+ --exclude=CMSIS/NN/Examples\
80+ --exclude=CMSIS/NN/NN_Lib_Tests\
81+ --exclude=CMSIS/Pack\
82+ --exclude=CMSIS/Utilities\
83+ --exclude=CMSIS/DSP/DSP_Lib_TestSuite\
84+ --exclude=CMSIS/DSP/Examples\
85+ --exclude=CMSIS/DSP/Projects\
86+ --exclude=Device/ARM/Documents\
87+ --exclude=.git\
88+ --exclude=.gitignore\
89+ --exclude=.gitattributes\
90+ --exclude=manifest\
91+ --exclude=* .pdf\
92+ --transform" s|CMSIS_5|CMSIS|" \
93+ -cjf" $( PACKAGE_NAME) -$( PACKAGE_VERSION) .tar.bz2" " $( PACKAGE_FOLDER) "
94+ $(MAKE ) PACKAGE_VERSION=$(PACKAGE_VERSION ) --no-builtin-rules postpackaging -C.
6395@echo ----------------------------------------------------------
6496
6597clean :
@@ -74,12 +106,14 @@ print_info:
74106@echo" CURDIR =$( CURDIR) "
75107@echo" OS =$( OS) "
76108@echo" SHELL =$( SHELL) "
77- @echo" PACKAGE_VERSION =$( PACKAGE_VERSION) "
78109@echo" PACKAGE_NAME =$( PACKAGE_NAME) "
110+ @echo" PACKAGE_FOLDER =$( PACKAGE_FOLDER) "
111+ @echo" PACKAGE_VERSION =$( PACKAGE_VERSION) "
112+
79113
80114postpackaging :
81115@echo" PACKAGE_CHKSUM =$( PACKAGE_CHKSUM) "
82116@echo" PACKAGE_SIZE =$( PACKAGE_SIZE) "
83117@echo" PACKAGE_FILENAME =$( PACKAGE_FILENAME) "
84- 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
118+ @ 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
85119@echo" package_$( PACKAGE_NAME) _$( PACKAGE_VERSION) _index.json created"