|
| 1 | +NAME=Sduino-tools |
| 2 | +VERSION=2017.10.21 |
| 3 | + |
| 4 | +# The package file the information should be added to |
| 5 | +PACKAGEFILE=package_sduino_stm8_index.json |
| 6 | + |
| 7 | +# The filename stem of the tools archives to be generated |
| 8 | +# (up to the first dash '-') |
| 9 | +TOOLS_STEM=release/$(NAME) |
| 10 | + |
| 11 | +# Where to find the tools to be included in the archive |
| 12 | +TOOLSDIR=../sduino/hardware/sduino/tools |
| 13 | + |
| 14 | +# filename for the new tools entries |
| 15 | +TOOLS_ENTRY=tools-entry-$(NAME)-$(VERSION).txt |
| 16 | + |
| 17 | + |
| 18 | +# |
| 19 | +### No user serviceable part below here. Only generated content. ######## |
| 20 | +# |
| 21 | + |
| 22 | +# The individual filenames for the different tools archives |
| 23 | +TOOLS_LINUX32=release/$(NAME)_linux32-$(VERSION).tar.bz2 |
| 24 | +TOOLS_LINUX64=release/$(NAME)_linux64-$(VERSION).tar.bz2 |
| 25 | +TOOLS_WINDOWS=release/$(NAME)_mingw32-$(VERSION).tar.bz2 |
| 26 | + |
| 27 | +TOOLS_TARS=$(TOOLS_LINUX32) $(TOOLS_LINUX64) $(TOOLS_WINDOWS) |
| 28 | + |
| 29 | + |
| 30 | +# Ignore all files matching one of these shell patterns: |
| 31 | +IGNORE=*~ *bak x build-* *.orig *.rej |
| 32 | +EXCLUDES=$(addprefix --exclude=, $(IGNORE)) |
| 33 | + |
| 34 | +TARFLAGS=$(EXCLUDES) --show-transformed-names --transform |
| 35 | + |
| 36 | +.PHONY: release add-tools-entry |
| 37 | + |
| 38 | +release: add-tools-entry |
| 39 | + |
| 40 | + |
| 41 | +# insert the new entry at first position of the platforms list: |
| 42 | +add-tools-entry: $(TOOLS_ENTRY) |
| 43 | + @SHA=$$(grep SHA-256 $^|head -1|cut -d\" -f4); \ |
| 44 | + grep -q $$SHA $(PACKAGEFILE); \ |
| 45 | + if [ $$? -ne 0 ]; then \ |
| 46 | + sed -ie '/"tools" : \[/r $^' $(PACKAGEFILE); \ |
| 47 | + echo "added new tools to package file."; \ |
| 48 | + else echo "tools definiton already included in package file."; fi |
| 49 | + |
| 50 | +# generate one tools entry for each new tools file |
| 51 | + |
| 52 | +$(TOOLS_ENTRY) : $(TOOLS_TARS) |
| 53 | + ./gen_tools_entry.sh "$(TOOLS_STEM)" "$(VERSION)" > $@ |
| 54 | + |
| 55 | +$(TOOLS_LINUX32): |
| 56 | + @echo "Generating the tools archive file for Linux 32 bit." |
| 57 | + tar cjf $@ $(EXCLUDES) -C $(TOOLSDIR) --transform s/linux32/linux/ \ |
| 58 | + wrapper linux32 |
| 59 | + |
| 60 | +$(TOOLS_LINUX64): |
| 61 | + @echo "Generating the tools archive file for Linux 64 bit." |
| 62 | + tar cjf $@ $(EXCLUDES) -C $(TOOLSDIR) --transform s/linux64/linux/ \ |
| 63 | + wrapper linux64 |
| 64 | + |
| 65 | +$(TOOLS_WINDOWS): |
| 66 | + @echo "Generating the tools archive file for Windows." |
| 67 | + tar cjf $@ $(EXCLUDES) -C $(TOOLSDIR) wrapper win |
0 commit comments