summaryrefslogtreecommitdiffstats
path: root/linux/download.mk
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2023-12-03 19:23:35 +0100
committerMattias Andrée <maandree@kth.se>2023-12-03 19:23:35 +0100
commitc131f122778c62f920a99bbf854ced4a37ee8b03 (patch)
tree14c933f98f4d64dffb0a594bc40dd5121c6c5a8e /linux/download.mk
downloadlibsyscalls-c131f122778c62f920a99bbf854ced4a37ee8b03.tar.gz
libsyscalls-c131f122778c62f920a99bbf854ced4a37ee8b03.tar.bz2
libsyscalls-c131f122778c62f920a99bbf854ced4a37ee8b03.tar.xz
First commit
Signed-off-by: Mattias Andrée <maandree@kth.se>
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