Skip to content

Under evaluation: Better module folder organization #15

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
92 changes: 92 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
#
# Amel-Tech SmartEverything Arduino IDE Module makefile.
#
# Copyright (c) 2015 Amel-Tech (a division of Amel Srl). 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 := .
VARIANTS_PATH := $(ROOT_PATH)/module/variants

# Variant list, can be overriden via command line or ENV
VARIANTS?=$(shell ls --hide=*.mk $(VARIANTS_PATH))

ifeq ($(TRAVIS),true)
PRINT_INFO_TRAVIS=print_info_travis
else
PRINT_INFO_TRAVIS=
endif

CORE_VERSION := $(shell grep version= $(ROOT_PATH)/module/platform.txt | sed 's/version=//g')
#PACKAGE_NAME := $(basename $(notdir $(CURDIR)))
PACKAGE_NAME := AMEL-samd

# -----------------------------------------------------------------------------
# packaging specific
PACKAGE_FOLDER := module

ifeq (postpackaging,$(findstring $(MAKECMDGOALS),postpackaging))
PACKAGE_FILENAME=$(PACKAGE_NAME)-$(CORE_VERSION).tar.bz2
PACKAGE_CHKSUM := $(firstword $(shell sha256sum "$(PACKAGE_FILENAME)"))
PACKAGE_SIZE := $(firstword $(shell wc -c "$(PACKAGE_FILENAME)"))
endif

# end of packaging specific
# -----------------------------------------------------------------------------

.PHONY: all clean print_info print_info_travis postpackaging

# Arduino module packaging:
# - exclude version control system files, here git files and folders .git, .gitattributes and .gitignore
# - exclude 'extras' folder
# - exclude 'obj' folder from variants
all: clean print_info $(PRINT_INFO_TRAVIS)
@echo ----------------------------------------------------------
@echo "Packaging module."
tar --transform "s|module|$(PACKAGE_NAME)-$(CORE_VERSION)|g" --exclude=.gitattributes --exclude=.travis.yml --exclude-vcs --exclude=obj -cjf "$(PACKAGE_NAME)-$(CORE_VERSION).tar.bz2" "$(PACKAGE_FOLDER)"
$(MAKE) --no-builtin-rules postpackaging -C .
@echo ----------------------------------------------------------

clean:
@echo ----------------------------------------------------------
@echo Cleanup
-$(RM) $(PACKAGE_NAME)-*.tar.bz2 package_$(PACKAGE_NAME)_*.json
@echo ----------------------------------------------------------

print_info:
@echo ----------------------------------------------------------
@echo Building module using
@echo "CURDIR = $(CURDIR)"
@echo "OS = $(OS)"
@echo "SHELL = $(SHELL)"
@echo "VARIANTS_PATH = $(VARIANTS_PATH)"
@echo "VARIANTS = $(VARIANTS)"
@echo "CORE_VERSION = $(CORE_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%%/$(CORE_VERSION)/ | sed s/%%FILENAME%%/$(PACKAGE_FILENAME)/ | sed s/%%CHECKSUM%%/$(PACKAGE_CHKSUM)/ | sed s/%%SIZE%%/$(PACKAGE_SIZE)/ > package_$(PACKAGE_NAME)_$(CORE_VERSION)_index.json
cp package_$(PACKAGE_NAME)_$(CORE_VERSION)_index.json package_$(PACKAGE_NAME)_index.json
cp package_$(PACKAGE_NAME)_$(CORE_VERSION)_index.json test_package_$(PACKAGE_NAME)_$(CORE_VERSION)_index.json
cp package_$(PACKAGE_NAME)_$(CORE_VERSION)_index.json test_package_$(PACKAGE_NAME)_index.json
@echo "package_$(PACKAGE_NAME)_$(CORE_VERSION)_index.json created"
57 changes: 57 additions & 0 deletions extras/package_index.json.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
"packages":
[
{
"name": "AMEL",
"maintainer": "AMEL Technology",
"websiteURL": "http://www.amel-tech.com",
"email": "dev@amel-tech.com",
"help":
{
"online": "http://www.amel-tech.com"
},
"platforms":
[
{
"name": "AMEL-Tech Boards",
"architecture": "samd",
"version": "%%VERSION%%",
"category": "Partner",
"url": "http://downloads.arduino.cc/cores/%%FILENAME%%",
"archiveFileName": "%%FILENAME%%",
"checksum": "SHA-256:%%CHECKSUM%%",
"size": "%%SIZE%%",
"boards": [
{"name": "SmartEverything Fox"}
],
"toolsDependencies":
[
{
"packager": "arduino",
"name": "arm-none-eabi-gcc",
"version": "4.8.3-2014q1"
},
{
"packager": "arduino",
"name": "bossac",
"version": "1.6.1-arduino"
},
{
"packager": "arduino",
"name": "openocd",
"version": "0.9.0-arduino"
},
{
"packager": "arduino",
"name": "CMSIS",
"version": "4.0.0-atmel"
}
]
}
],
"tools":
[
]
}
]
}
4 changes: 0 additions & 4 deletions hardware/AMEL/samd/platform.txt

This file was deleted.

File renamed without changes.
File renamed without changes.
23 changes: 23 additions & 0 deletions module/platform.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#
# Amel-Tech SmartEverything Arduino IDE Module makefile.
#
# Copyright (c) 2015 Amel-Tech (a division of Amel Srl). 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
#

name=AMEL-Tech Boards
version=1.1.0