Skip to content

Commit

Permalink
Merge pull request #5400 from miri64/pkg/enh/non-concurrent
Browse files Browse the repository at this point in the history
pkg: split patch and download rule
  • Loading branch information
kaspar030 committed Jun 1, 2016
2 parents 56b1dd8 + 0fb50eb commit 6032ffe
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions pkg/pkg.mk
Expand Up @@ -4,13 +4,20 @@
PKG_DIR?=$(CURDIR)
PKG_BUILDDIR?=$(BINDIRBASE)/pkg/$(BOARD)/$(PKG_NAME)

.PHONY: git-download
.PHONY: git-download clean

ifneq (,$(wildcard $(PKG_DIR)/patches))
git-download: $(PKG_BUILDDIR)/.git-patched
else
git-download: $(PKG_BUILDDIR)/.git-downloaded
endif

GIT_APPLY_PATCHES:=if test -d "$(PKG_DIR)"/patches; then \
git -C "$(PKG_BUILDDIR)" am --ignore-whitespace "$(PKG_DIR)"/patches/*.patch; \
fi
ifneq (,$(wildcard $(PKG_DIR)/patches))
$(PKG_BUILDDIR)/.git-patched: $(PKG_BUILDDIR)/.git-downloaded $(PKG_DIR)/Makefile $(PKG_DIR)/patches/*.patch
git -C $(PKG_BUILDDIR) checkout -f $(PKG_VERSION)
git -C $(PKG_BUILDDIR) am --ignore-whitespace "$(PKG_DIR)"/patches/*.patch
touch $@
endif

$(PKG_BUILDDIR)/.git-downloaded:
rm -Rf $(PKG_BUILDDIR)
Expand All @@ -21,9 +28,10 @@ $(PKG_BUILDDIR)/.git-downloaded:

clean::
@test -d $(PKG_BUILDDIR) && { \
rm $(PKG_BUILDDIR)/.git-patched ; \
git -C $(PKG_BUILDDIR) clean -f ; \
git -C $(PKG_BUILDDIR) checkout "$(PKG_VERSION)"; \
$(GIT_APPLY_PATCHES) ; \
make $(PKG_BUILDDIR)/.git-patched ; \
touch $(PKG_BUILDDIR)/.git-downloaded ; \
} > /dev/null 2>&1 || true

Expand Down

0 comments on commit 6032ffe

Please sign in to comment.