- make should be $(MAKE) - add + in front of rules spawning long-lasted make process in a subshell. (This would not be needed with $(MAKE) -C .. target, but our makefiles do not handle that because they use $(PWD)) - split the main 'all' rule as all 4 targets are independant - fix dependencies where appropriate for parallelism Extra, not speed-related changes: - remove some double-colon for targets as they do not need it This cuts build time from 5s to 1.5s on a laptop with -j4, and more importantly from 85s to 35s on a KNL node. As a bonus, the fixed dependencies removes the need to clean before rebuilding all the time. Probably.
49 lines
1.9 KiB
Makefile
49 lines
1.9 KiB
Makefile
ENABLE_MCOVERLAYFS=@ENABLE_MCOVERLAYFS@
|
|
RELEASE=@UNAME_R@
|
|
|
|
MAJOR=$(shell echo ${RELEASE} | sed -e 's/^\([0-9]*\).*/\1/')
|
|
MINOR=$(shell echo ${RELEASE} | sed -e 's/^[0-9]*.\([0-9]*\).*/\1/')
|
|
PATCH=$(shell echo ${RELEASE} | sed -e 's/^[0-9]*.[0-9]*.\([0-9]*\).*/\1/')
|
|
LINUX_VERSION_CODE=$(shell expr \( ${MAJOR} \* 65536 \) + \( ${MINOR} \* 256 \) + ${PATCH})
|
|
RHEL_RELEASE_TMP=$(shell echo ${RELEASE} | sed -e 's/^[0-9]*.[0-9]*.[0-9]*-\([0-9]*\).*/\1/')
|
|
RHEL_RELEASE=$(shell if [ "${RELEASE}" == "${RHEL_RELEASE_TMP}" ]; then echo ""; else echo ${RHEL_RELEASE_TMP}; fi)
|
|
BUILD_MODULE_TMP=$(shell if [ "${RHEL_RELEASE}" == "" ]; then echo "org"; else echo "rhel"; fi)
|
|
BUILD_MODULE=none
|
|
#$(info "LINUX_VERSION_CODE: ${LINUX_VERSION_CODE}, RHEL_RELEASE: ${RHEL_RELEASE}")
|
|
ifeq ($(ENABLE_MCOVERLAYFS),yes)
|
|
ifeq ($(BUILD_MODULE_TMP),org)
|
|
ifeq ($(BUILD_MODULE),none)
|
|
BUILD_MODULE=$(shell if [ ${LINUX_VERSION_CODE} -ge 262144 -a ${LINUX_VERSION_CODE} -lt 262400 ]; then echo "linux-4.0.9"; else echo "none"; fi)
|
|
endif
|
|
ifeq ($(BUILD_MODULE),none)
|
|
BUILD_MODULE=$(shell if [ ${LINUX_VERSION_CODE} -ge 263680 -a ${LINUX_VERSION_CODE} -lt 263936 ]; then echo "linux-4.6.7"; else echo "none"; fi)
|
|
endif
|
|
endif
|
|
ifeq ($(BUILD_MODULE_TMP),rhel)
|
|
ifeq ($(BUILD_MODULE),none)
|
|
BUILD_MODULE=$(shell if [ ${LINUX_VERSION_CODE} -eq 199168 -a ${RHEL_RELEASE} -ge 327 -a ${RHEL_RELEASE} -le 693 ]; then echo "linux-3.10.0-327.36.1.el7"; else echo "none"; fi)
|
|
endif
|
|
ifeq ($(BUILD_MODULE),none)
|
|
BUILD_MODULE=$(shell if [ ${LINUX_VERSION_CODE} -ge 262144 -a ${LINUX_VERSION_CODE} -lt 262400 ]; then echo "linux-4.0.9"; else echo "none"; fi)
|
|
endif
|
|
endif
|
|
endif
|
|
|
|
.PHONY: clean install modules
|
|
|
|
modules:
|
|
ifneq ($(BUILD_MODULE),none)
|
|
+@(cd $(BUILD_MODULE); make modules)
|
|
endif
|
|
|
|
clean:
|
|
@(cd linux-3.10.0-327.36.1.el7; make clean)
|
|
@(cd linux-4.0.9; make clean)
|
|
@(cd linux-4.6.7; make clean)
|
|
|
|
install:
|
|
ifneq ($(BUILD_MODULE),none)
|
|
@(cd $(BUILD_MODULE); make install)
|
|
endif
|
|
|