Files
linux-3.16.37/Makefile
Jay Larson 9957ddd7b9 THe following changes were made:
* Moved to new version scheme
  * Added brief
  * Split off linux-headers-3.16.37 and linux-firmware as separate packages
2017-03-24 15:46:35 -05:00

108 lines
3.5 KiB
Makefile

# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation here:
# (http://www.gnu.org/licenses/gpl-2.0.html)
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
export SRCPKG = $(shell echo $(PWD)|sed 's/.*\///')
export DEPENDS = mkinitramfs
export ARCH = x86_64
export URL = https://www.kernel.org/
BRIEF = The Linux kernel
DESC = Linux is a clone of the operating system Unix, written from scratch \
by Linus Torvalds with assistance from a loosely-knit team of hackers \
across the Net.
SNAPVER = 3
ARCHIVE := $(PWD)/SRC/$(shell ls SRC|egrep '(bz2|gz|tar|xz)$$'|tail -1)
TYPE := $(shell file -ib $(ARCHIVE)|cut -d';' -f1|tr -d '\n')
SRCDIR := $(shell tar -tf $(ARCHIVE)|head -1|sed 's/\/.*//')
PATCHDIR := $(PWD)/SRC/patches
export KERNVER := $(shell echo $(SRCDIR)|egrep -o '\-[0-9].*'|sed 's/^-//')
export VERSION := $(SNAPVER)
LINUX-FIRMWARE := $(PWD)/linux-firmware
LINUX-FIRMWARE-ROOT := $(LINUX-FIRMWARE)/ROOT
LINUX-HEADERS := $(PWD)/linux-headers-$(KERNVER)
LINUX-HEADERS-ROOT := $(LINUX-HEADERS)/ROOT
include /usr/share/snap/Makefile.snaplinux
$(LINUX-HEADERS-ROOT): $(LINUX-FIRMWARE-ROOT)
@install -v -d $(LINUX-HEADERS)/SNAP && \
install -v -d $(LINUX-HEADERS-ROOT) && \
cd $(SRCDIR) && make headers_install \
INSTALL_HDR_PATH=$(LINUX-HEADERS-ROOT)/usr && \
cd $(LINUX-HEADERS) && make -f \
../Makefile.linux-headers-$(KERNVER) && \
mv *.snap ../
$(LINUX-FIRMWARE-ROOT): $(SRCDIR)/arch/x86_64/boot/bzImage
@install -v -d $(LINUX-FIRMWARE)/SNAP && \
install -v -d $(LINUX-FIRMWARE-ROOT) && \
cd $(SRCDIR) && make firmware_install \
INSTALL_FW_PATH=$(LINUX-FIRMWARE-ROOT) && \
cd $(LINUX-FIRMWARE) && make -f \
../Makefile.linux-firmware && mv *.snap ../
$(SRCDIR)/Makefile: $(ARCHIVE)
@if [ '$(TYPE)' == 'application/x-bzip2' ]; then \
tar -jxf $(ARCHIVE); \
elif [ '$(TYPE)' == 'application/x-gzip' ]; then \
tar -zxf $(ARCHIVE); \
elif [ '$(TYPE)' == 'application/x-tar' ]; then \
tar -xf $(ARCHIVE); \
elif [ '$(TYPE)' == 'application/x-xz' ]; then \
tar -xf $(ARCHIVE); \
else \
echo 'Unable to determine archive type'; \
exit 1; \
fi
@touch $(SRCDIR)/Makefile
$(SRCDIR)/arch/x86_64/boot/bzImage: $(SRCDIR)/Makefile
@cd $(SRCDIR); \
make mrproper
@cp SNAP/config-$(KERNVER)-$(VERSION) $(SRCDIR)/.config
@cd $(SRCDIR); \
make
$(ROOT): $(LINUX-HEADERS-ROOT)
@if [ -d $(ROOT) ]; then \
touch $(ROOT); \
else \
mkdir -v $(ROOT); \
fi
@cd $(SRCDIR); \
make modules_install INSTALL_MOD_PATH=$(ROOT) && \
rm -rf $(ROOT)/lib/firmware && \
install -d -m 755 $(ROOT)/boot && \
install -d -m 755 $(ROOT)/etc/modprobe.d && \
install -d -m 755 $(ROOT)/usr/share/doc/linux-$(KERNVER)-$(VERSION) && \
install -m 644 .config $(ROOT)/boot/config-$(KERNVER)-$(VERSION) && \
install -m 644 System.map \
$(ROOT)/boot/System.map-$(KERNVER)-$(VERSION) && \
install -m 644 arch/x86_64/boot/bzImage \
$(ROOT)/boot/vmlinuz-$(KERNVER)-$(VERSION) && \
install -m 644 ../SNAP/usb.conf $(ROOT)/etc/modprobe.d/usb.conf && \
cp -r Documentation/* $(ROOT)/usr/share/doc/linux-$(KERNVER)-$(VERSION)
test: $(ROOT)
@cd $(SRCDIR); \
make test
clean:
@rm -rvf $(ROOT) \
$(LINUX-FIRMWARE) \
$(LINUX-HEADERS) \
$(SNAPINFO) \
$(MANIFEST) \
$(FILES) \
$(SRCDIR)