2013-11-18 12:30:01 +01:00
|
|
|
PKG_NAME= # name of the package
|
|
|
|
PKG_URL= # source url of the package e.g. a git repository
|
|
|
|
PKG_VERSION= # version of the package to use e.g. a git commit/ref
|
|
|
|
|
|
|
|
ifneq ($(RIOTBOARD),)
|
|
|
|
include $(RIOTBOARD)/Makefile.base
|
|
|
|
include $(RIOTBOARD)/$(BOARD)/Makefile.include
|
|
|
|
endif
|
|
|
|
|
2014-07-22 23:59:22 +02:00
|
|
|
.PHONY: all clean patch distclean
|
2013-11-18 12:30:01 +01:00
|
|
|
|
|
|
|
all: patch
|
2014-07-22 23:59:22 +02:00
|
|
|
$(MAKE) -C $(CURDIR)/$(PKG_NAME)
|
2013-11-18 12:30:01 +01:00
|
|
|
|
|
|
|
patch: $(CURDIR)/$(PKG_NAME)/Makefile
|
|
|
|
# Dependancy might be changed accordingly though we think the Makefile
|
|
|
|
# will be the first thing you want to change
|
|
|
|
#
|
|
|
|
# Here might not happen anything besides dependancy checks
|
|
|
|
|
|
|
|
$(CURDIR)/$(PKG_NAME)/Makefile: $(CURDIR)/$(PKG_NAME)
|
|
|
|
# Here you apply your patch.
|
2014-03-19 16:17:36 +01:00
|
|
|
$(foreach patch,$(shell ls [0-9][0-9][0-9][0-9]*.patch),cd "$<" && git am "$(patch)" || { git am --abort; exit 1; };)
|
2013-11-18 12:30:01 +01:00
|
|
|
|
2014-03-19 16:17:36 +01:00
|
|
|
$(PKG_NAME):
|
2013-11-18 12:30:01 +01:00
|
|
|
# Get PKG_VERSION of package from PKG_URL
|
2014-03-19 16:17:36 +01:00
|
|
|
git clone $(PKG_URL) $(PKG_NAME) && cd $(PKG_NAME) && git reset --hard $(PKG_VERSION)
|
2013-11-18 12:30:01 +01:00
|
|
|
|
|
|
|
clean::
|
|
|
|
# Reset package to checkout state.
|
|
|
|
cd $(CURDIR)/$(PKG_NAME) || true && \
|
|
|
|
git clean -x -f && \
|
|
|
|
git reset --hard $(PKG_VERSION)
|
|
|
|
|
|
|
|
distclean::
|
|
|
|
rm -rf $(CURDIR)/$(PKG_NAME)
|