Fixed several broken things in makefile

This commit is contained in:
Bruce Leidl 2017-10-18 21:06:38 +00:00
parent eb6a99eb90
commit 7a87547cc8

View File

@ -30,17 +30,17 @@ UNXZ = unxz
PWD = $(shell pwd) PWD = $(shell pwd)
PATCH_FILES := $(shell find patches/ -name "00*.patch" | sort) PATCH_FILES := $(shell find patches/ -name "00*.patch" | sort)
PATCHES = $(patsubst %.patch,build/.%.done,$(PATCH_FILES)) PATCH_SENTINEL = build/.patches_applied
GRSEC_DL_PATH = downloads/$(GRSEC_DIFF) GRSEC_DL_PATH = downloads/$(GRSEC_DIFF)
KERNEL_DL_PATH = downloads/$(KERNEL_VERSION).tar KERNEL_DL_PATH = downloads/$(KERNEL_VERSION).tar
KERNEL_BUILD_PATH = build/$(KERNEL_VERSION) KERNEL_BUILD_PATH = build/$(KERNEL_VERSION)
KERNEL_UNPACK_PATH = build/unpack/$(KERNEL_VERSION) KERNEL_UNPACK_PATH = build/.unpack/$(KERNEL_VERSION)
KERNEL_BUILD_OUTPUT = $(KERNEL_BUILD_PATH)/vmlinux KERNEL_BUILD_OUTPUT = $(KERNEL_BUILD_PATH)/vmlinux
PH_LINUX = ph_linux PH_LINUX = ph_linux
PH_LINUX_VER = $(PH_LINUX)-$(KERNEL_VERSION) PH_LINUX_VER = $(PH_LINUX)-$(LINUX_VERSION)
GPGTMP = verify-tmp/ GPGTMP = verify-tmp/
GPGOPTS = --homedir $(GPGTMP) --trust-model direct --no-autostart GPGOPTS = --homedir $(GPGTMP) --trust-model direct --no-autostart
@ -51,11 +51,14 @@ SHA256_FILE = v$(KERNEL_VERSION).sha256
SHA256_SENTINEL = build/.sha256-verififed SHA256_SENTINEL = build/.sha256-verififed
$(shell mkdir -p downloads)
$(shell mkdir -p build)
.NOTPARALLEL: .NOTPARALLEL:
.PHONY: all gen-sha256 .PHONY: all gen-sha256
all: $(KERNEL_BUILD_OUTPUT) all: $(KERNEL_BUILD_OUTPUT) $(PH_LINUX_VER)
$(GRSEC_DL_PATH): $(GRSEC_DL_PATH):
cd downloads; $(WGET) $(GRSEC_DOWNLOAD) cd downloads; $(WGET) $(GRSEC_DOWNLOAD)
@ -67,37 +70,33 @@ $(KERNEL_DL_PATH):
cd downloads; $(WGET) $(KERNEL_DOWNLOAD).tar.sign cd downloads; $(WGET) $(KERNEL_DOWNLOAD).tar.sign
$(KERNEL_BUILD_PATH): $(KERNEL_UNPACK_PATH) $(GRSEC_DL_PATH) $(KERNEL_BUILD_PATH): $(KERNEL_DL_PATH) $(GRSEC_DL_PATH) $(SHA256_SENTINEL)
$(PATCH) -p1 -d $(KERNEL_UNPACK_PATH) < $(GRSEC_DL_PATH)
$(CP) config $(KERNEL_UNPACK_PATH)/.config
$(MV) build/unpack/$(KERNEL_VERSION) build/
$(MKDIR) $(KERNEL_UNPACK_PATH)
$(MKDIR) build/.patches
$(KERNEL_UNPACK_PATH): $(KERNEL_DL_PATH)
$(RM) -rf build/.unpack $(RM) -rf build/.unpack
$(MKDIR) -p build/.unpack $(MKDIR) -p build/.unpack
$(TAR) -C build/.unpack -xvf downloads/$(KERNEL_VERSION).tar $(TAR) -C build/.unpack -xvf downloads/$(KERNEL_VERSION).tar
$(MV) build/.unpack build/unpack $(PATCH) -p1 -d $(KERNEL_UNPACK_PATH) < $(GRSEC_DL_PATH)
$(CP) config $(KERNEL_UNPACK_PATH)/.config
$(MV) $(KERNEL_UNPACK_PATH) build/
$(PATCHES): build/.%.done : | $(KERNEL_BUILD_PATH) $(RM) -rf build/.unpack
$(PATCH) -p1 -d build/$(KERNEL_VERSION) < $*.patch
$(PATCH_SENTINEL): | $(KERNEL_BUILD_PATH)
for p in $(PATCH_FILES); do $(PATCH) -p1 -d build/$(KERNEL_VERSION) < "$$p"; done
$(TOUCH) $@ $(TOUCH) $@
$(PH_LINUX_VER): $(KERNEL_BUILD_OUTPUT) $(PH_LINUX_VER): $(KERNEL_BUILD_OUTPUT)
$(RM) $(PH_LINUX) $(RM) -f $(PH_LINUX)
$(CP) $(KERNEL_BUILD_OUTPUT) $(PH_LINUX_VER) $(CP) $(KERNEL_BUILD_OUTPUT) $(PH_LINUX_VER)
$(LN) $(PWD)/$(PH_LINUX_VER) $(PH_LINUX) $(LN) -s $(PWD)/$(PH_LINUX_VER) $(PH_LINUX)
$(KERNEL_BUILD_OUTPUT): $(PATCHES) $(KERNEL_BUILD_OUTPUT): $(PATCH_SENTINEL)
$(MAKE) -C build/$(KERNEL_VERSION) -j 4 $(MAKE) -C build/$(KERNEL_VERSION)
clean: clean:
$(RM) -rf $(KERNEL_BUILD_PATH) build/unpack build/.unpack build/.patches $(SHA256_SENTINEL) $(RM) -rf $(KERNEL_BUILD_PATH) $(SHA256_SENTINEL) $(PATCH_SENTINEL) $(PH_LINUX_VER)
$(SHA256_SENTINEL): $(SHA256_SENTINEL): $(KERNEL_DL_PATH) $(GRSEC_DL_PATH)
$(SHA256) -c v$(LINUX_VERSION).sha256 $(SHA256) -c v$(LINUX_VERSION).sha256
$(TOUCH) $@ $(TOUCH) $@