-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
64 lines (53 loc) · 2.42 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
SHELL = /bin/sh
.SUFFIXES: .tar.bz2
ROOT_PATH := .
#PACKAGE_NAME := $(basename $(notdir $(CURDIR)))
PACKAGE_NAME := CMSIS
PACKAGE_VERSION := 5.7.0
# -----------------------------------------------------------------------------
# packaging specific
PACKAGE_FOLDER := CMSIS_5
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 print_info postpackaging
# Arduino module packaging:
# - exclude version control system files, here git files and folders .git, .gitattributes and .gitignore
# - exclude 'extras' folder
all: clean print_info
@echo ----------------------------------------------------------
@echo "Packaging module."
tar --exclude=./.gitattributes \
--exclude=./.travis.yml \
--exclude=docs \
--exclude=CMSIS/Pack \
--exclude=CMSIS/Utilities \
--exclude=CMSIS/DSP/Examples \
--exclude=.git \
-cf "$(PACKAGE_NAME)-$(PACKAGE_VERSION).tar" "$(PACKAGE_FOLDER)"
bzip2 "$(PACKAGE_NAME)-$(PACKAGE_VERSION).tar"
$(MAKE) --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_VERSION = $(PACKAGE_VERSION)"
@echo "PACKAGE_NAME = $(PACKAGE_NAME)"
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"