summaryrefslogtreecommitdiffstats
path: root/linux/download.mk
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--linux/download.mk33
1 files changed, 33 insertions, 0 deletions
diff --git a/linux/download.mk b/linux/download.mk
new file mode 100644
index 0000000..31da0b1
--- /dev/null
+++ b/linux/download.mk
@@ -0,0 +1,33 @@
+LINUX_MIRROR = https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/snapshot
+LINUX_TAREXT = tar.gz
+LINUX_TARBALL = $(LINUX_MIRROR)/linux-$(LINUX_VERSION).$(LINUX_TAREXT)
+LINUX_UNPACK = (gunzip | tar -x)
+
+LINUX_DIR = linux-src/linux-$(LINUX_VERSION)
+LINUX_SOURCE = $(LINUX_DIR)/README
+
+
+SILENCE_LINUX_SOURCE_IF_EXISTS != test ! -f "$(LINUX_SOURCE)" || printf '@'
+SILENCE_LINUX_TARBALL_IF_EXISTS != test ! -f "$(LINUX_DIR).$(LINUX_TAREXT)" || printf '@'
+
+$(LINUX_SOURCE): $(LINUX_DIR).$(LINUX_TAREXT)
+ $(SILENCE_LINUX_SOURCE_IF_EXISTS)if test ! -f "$@"; then \
+ (cd -- linux-src && $(LINUX_UNPACK)) < $(LINUX_DIR).$(LINUX_TAREXT) && \
+ (test -d $(LINUX_DIR) || \
+ mv -- linux-src/linux-v$(LINUX_VERSION) $(LINUX_DIR) || \
+ mv -- linux-src/$(LINUX_VERSION) $(LINUX_DIR) || \
+ mv -- linux-src/v$(LINUX_VERSION) $(LINUX_DIR) \
+ ) && \
+ touch -- "$@"; \
+ fi
+
+$(LINUX_DIR).$(LINUX_TAREXT):
+ $(SILENCE_LINUX_TARBALL_IF_EXISTS)mkdir -p -- linux-src
+ $(SILENCE_LINUX_TARBALL_IF_EXISTS)test -f "$@" || $(DOWNLOAD) $(LINUX_TARBALL) > "$@" || (rm -f -- "$@"; false)
+
+
+download-linux: $(LINUX_DIR).$(LINUX_TAREXT)
+download: download-linux
+
+
+.PHONY: download-linux