11NAME=sduino-tools
2- TOOLSVERSION?=2017.10.21
2+ COREVERSION?=0.3.2
3+ # default the tool version to be the current date as YYYY.MM.DD
4+ TOOLSVERSION?=$(shell date '+%Y.%m.%d')
35
46# Where to find the tools directory
57BASEDIR=../sduino/hardware/sduino
@@ -8,7 +10,7 @@ BASEDIR=../sduino/hardware/sduino
810IGNORE=*~ *bak x build-* *.orig *.rej
911
1012# where to put the generated files
11- ARCHIVEDIR=release
13+ ARCHIVEDIR=release/v$(COREVERSION)
1214PARTSDIR=parts
1315
1416
@@ -24,9 +26,9 @@ TOOLS_STEM=$(ARCHIVEDIR)/$(NAME)
2426TOOLS_ENTRY=$(PARTSDIR)/tools-entry-$(NAME)-$(TOOLSVERSION).txt
2527
2628# The individual filenames for the different tools archives
27- TOOLS_LINUX32=release /$(NAME)_linux32-$(TOOLSVERSION).tar.bz2
28- TOOLS_LINUX64=release /$(NAME)_linux64-$(TOOLSVERSION).tar.bz2
29- TOOLS_WINDOWS=release /$(NAME)_mingw32-$(TOOLSVERSION).tar.bz2
29+ TOOLS_LINUX32=$(ARCHIVEDIR) /$(NAME)_linux32-$(TOOLSVERSION).tar.bz2
30+ TOOLS_LINUX64=$(ARCHIVEDIR) /$(NAME)_linux64-$(TOOLSVERSION).tar.bz2
31+ TOOLS_WINDOWS=$(ARCHIVEDIR) /$(NAME)_mingw32-$(TOOLSVERSION).tar.bz2
3032
3133TOOLS_TARS=$(TOOLS_LINUX32) $(TOOLS_LINUX64) $(TOOLS_WINDOWS)
3234EXCLUDES=$(addprefix --exclude=, $(IGNORE))
@@ -40,16 +42,25 @@ TARFLAGS=$(EXCLUDES) --show-transformed-names --transform
4042$(TOOLS_ENTRY) : $(TOOLS_TARS)
4143 ./gen_tools_entry.sh "$(TOOLS_STEM)" "$(TOOLSVERSION)" "$(COREVERSION)" > $@
4244
43- $(TOOLS_LINUX32):
45+ $(TOOLS_LINUX32): | $(ARCHIVEDIR)
4446 @echo "Generating the tools archive file for Linux 32 bit."
4547 tar cjf $@ $(EXCLUDES) -C $(BASEDIR) --transform s/linux32/linux/ \
4648 tools/wrapper tools/linux32
4749
48- $(TOOLS_LINUX64):
50+ $(TOOLS_LINUX64): | $(ARCHIVEDIR)
4951 @echo "Generating the tools archive file for Linux 64 bit."
5052 tar cjf $@ $(EXCLUDES) -C $(BASEDIR) --transform s/linux64/linux/ \
5153 tools/wrapper tools/linux64
5254
53- $(TOOLS_WINDOWS):
55+ $(TOOLS_WINDOWS): | $(ARCHIVEDIR)
5456 @echo "Generating the tools archive file for Windows."
5557 tar cjf $@ $(EXCLUDES) -C $(BASEDIR) tools/wrapper tools/win
58+
59+
60+ # make a new release directory if not present
61+ #
62+ # make sure to define an order-only dependency on this rule by placing it on
63+ # the right side of a pipe symbol. This prevents rebuilding the archives
64+ # every time.
65+ $(ARCHIVEDIR):
66+ mkdir -p $@
0 commit comments