summaryrefslogblamecommitdiffstats
path: root/linux/download.mk
blob: 5555074239f3f71e5ba733a1fa88f60c19cdecae (plain) (tree)
1
2

                                                     
































                                                                                                                       
# See LICENSE file for copyright and license details.

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