summaryrefslogblamecommitdiff
path: root/Makefile
blob: ec1ba4f65ef70d8319777a6c0fbb12069b5cb906 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12

                                

                                               







                                                                                 
                     





























                                                                                                                                    





                                                                                              











































                                                                                                                  





                                                                                         











                                                   
VERSION=linux-6.8.4
VERSION_DISTR = $(VERSION)-vmkos
VERSION_BUILD = $(VERSION_DISTR)-night
CLEAN_BUILD = $(subst linux-,,$(VERSION_BUILD))

TRUSTED_KEYS = ABAF11C65A2970B130ABE3C479BE3E4300411886  # Linus Torvalds
TRUSTED_KEYS += 647F28654894E3BD457199BE38DBBDC86092693E  # Greg Kroah-Hartman

SRC_URL = https://cdn.kernel.org/pub/linux/kernel/v6.x/$(VERSION).tar.xz
# PGP_SGN_URL = https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-6.8.4.tar.sign

CFLAGS = -std=gnu2x -Wall -Werror -Wno-pointer-sign -Werror=vla
C_ARCH = $$(uname -m)

ifdef ONELINE_OUTPUT
	# SED_SUBST = | stdbuf --output=L sed 's/^/\\e[0A\\e[K3<>/gi'
	SED_SUBST = | stdbuf --output=L ./interliner
else
SED_SUBST=
endif

SILENCE=
ifdef QUIET
SILENCE += >all.log
endif

ifdef SILENT
SILENCE += 2>err.log
endif

OUT_FMT = $(SED_SUBST) $(SILENCE)

default: all

all: pre_install install post_install clean clean_misc

pre_install: interliner $(VERSION).tar
	# rm -f linux-6.8.4.tar.xz
	@printf "> MAKING::$@\n"
	tar --skip-old-files -xvf linux-6.8.4.tar.xz 2>tar.err.log | grep -v "skipping existing file" | sed 's/^/\t=> /g' $(OUT_FMT)
	@printf "> MAKING::$@::DONE\n"

install: interliner $(VERSION) clear.ok patch patch.ok build build.ok
	@printf "> MAKING::$@\n"

	sudo install -C -m755 $(VERSION)/arch/$(C_ARCH)/boot/bzImage /boot/vmlinuz-linux-VMKOS

	./mkcp.sh $(VERSION) | sed 's/^/\t==> /g' $(SED_SUBST) $(OUT_FMT)

	@printf "> MAKING::$@::DONE\n"


post_install: interliner
	# @printf "> MAKING::$@\n"
	@printf "> MAKING::$@::DONE\n"

.PHONY: pre_install install post_install

$(VERSION).tar: $(VERSION).tar.xz $(VERSION).tar.sign
	@printf "\t> MAKING::$@\n"

	xz -kd $(VERSION).tar.xz | sed 's/^/\t==> /g' $(OUT_FMT)

ifdef NO_VERIFY
	@printf "\t==> Will not verify\n"
else ifdef SKIP_VERIFY
	@printf "\t==> Will not verify\n"
else
	@printf "\t==> Verifying...\n"

	gpg2 --recv-keys $(TRUSTED_KEYS) $(OUT_FMT)
	if [ "$$(gpg2 --logger-fd 1 --verify $(VERSION).tar.sign | grep 'Good signature')" == "" ]; then false; fi
endif

	@printf "\t> MAKING::$@::DONE\n"

$(VERSION).tar.xz:
	@printf "\t> MAKING::$@\n"
	wget https://cdn.kernel.org/pub/linux/kernel/v6.x/$(VERSION).tar.xz | sed 's/^/\t==> /g' $(OUT_FMT)
	@printf "\t> MAKING::$@::DONE\n"

$(VERSION).tar.sign:
	@printf "\t> MAKING::$@\n"
	wget https://cdn.kernel.org/pub/linux/kernel/v6.x/$(VERSION).tar.sign | sed 's/^/\t==> /g' $(OUT_FMT)
	@printf "\t> MAKING::$@::DONE\n"

patch: ./patch.sh
	@printf "\t> MAKING::$@\n"
	./patch.sh $(VERSION) skip | sed 's/^/\t==> /g' $(SED_SUBST) $(OUT_FMT)
	@printf "\t> MAKING::$@::DONE\n"

build: ./build.sh
	@printf "\t> MAKING::$@\n"
	./build.sh $(VERSION) $(CLEAN_BUILD) | sed 's/^/\t==> /g' $(SED_SUBST) $(OUT_FMT)
	@printf "\t> MAKING::$@::DONE\n"

mkcp: ./mkcp.sh
	@printf "\t> MAKING::$@\n"
	./mkcp.sh $(VERSION) $(CLEAN_BUILD) | sed 's/^/\t==> /g' $(SED_SUBST) $(OUT_FMT)
	@printf "\t> MAKING::$@::DONE\n"

interliner: interliner.c

clean: interliner
	rm -f *.tar *.sign *.sign?? *.xz $(OUT_FMT)

clean_misc: interliner
	rm -f *.tar *.sign *.sign?? $(OUT_FMT)

clear.ok:
	rm -f *.ok