2016-08-02 23:25:47 +00:00
|
|
|
modules :=
|
|
|
|
pwd := $(shell pwd)
|
|
|
|
packages := $(pwd)/packages
|
|
|
|
build := $(pwd)/build
|
|
|
|
config := $(pwd)/build
|
2016-12-28 17:45:12 +00:00
|
|
|
INSTALL := $(pwd)/install
|
2017-02-28 23:02:10 +00:00
|
|
|
log_dir := $(build)/log
|
2017-03-21 18:29:07 +00:00
|
|
|
MAKE_JOBS ?= -j8 --max-load 24
|
2017-02-28 23:02:10 +00:00
|
|
|
|
|
|
|
# Create the log directory if it doesn't already exist
|
|
|
|
BUILD_LOG := $(shell [ -d "$(log_dir)" ] || mkdir "$(log_dir)")
|
|
|
|
|
|
|
|
# If V is set in the environment, do not redirect the tee
|
|
|
|
# command to /dev/null.
|
|
|
|
ifeq "$V" ""
|
|
|
|
VERBOSE_REDIRECT := > /dev/null
|
|
|
|
endif
|
2016-08-02 23:25:47 +00:00
|
|
|
|
2017-01-27 21:17:03 +00:00
|
|
|
# Check that we have a correct version of make
|
|
|
|
LOCAL_MAKE_VERSION := $(shell $(MAKE) --version | head -1 | cut -d' ' -f3)
|
|
|
|
include modules/make
|
|
|
|
|
|
|
|
ifeq "$(LOCAL_MAKE_VERSION)" "$(make_version)"
|
|
|
|
# We are running our own version of make,
|
|
|
|
# proceed with the build.
|
|
|
|
|
2017-03-20 18:47:47 +00:00
|
|
|
# Force pipelines to fail if any of the commands in the pipe fail
|
|
|
|
SHELL := /bin/bash
|
|
|
|
.SHELLFLAGS := -o pipefail -c
|
|
|
|
|
2016-11-23 17:11:08 +00:00
|
|
|
# Currently supported targets are x230, chell and qemu
|
2016-12-01 19:03:55 +00:00
|
|
|
BOARD ?= qemu
|
2016-08-14 20:02:15 +00:00
|
|
|
|
2016-12-29 23:23:08 +00:00
|
|
|
# If musl-libc is being used in the initrd, set the heads_cc
|
|
|
|
# variable to point to it.
|
|
|
|
musl_dep := musl
|
2017-01-28 18:14:56 +00:00
|
|
|
heads_cc := $(INSTALL)/bin/musl-gcc \
|
|
|
|
-fdebug-prefix-map=$(pwd)=heads \
|
|
|
|
-gno-record-gcc-switches \
|
|
|
|
|
2017-03-21 18:29:07 +00:00
|
|
|
CROSS := $(build)/../crossgcc/x86_64-linux-musl/bin/x86_64-musl-linux-
|
2017-01-31 19:57:41 +00:00
|
|
|
|
2017-01-27 21:17:03 +00:00
|
|
|
#heads_cc := $(HOME)/install/x86_64-linux-musl/x86_64-linux-musl/bin/gcc
|
2016-12-29 23:23:08 +00:00
|
|
|
|
2016-11-29 16:19:48 +00:00
|
|
|
all: $(BOARD).rom
|
|
|
|
|
|
|
|
# Disable all built in rules
|
|
|
|
.SUFFIXES:
|
2016-08-02 23:25:47 +00:00
|
|
|
|
2017-02-28 23:02:10 +00:00
|
|
|
# Timestamps should be in ISO format
|
|
|
|
DATE=`date --rfc-3339=seconds`
|
2016-08-03 12:40:51 +00:00
|
|
|
|
2016-11-23 17:11:08 +00:00
|
|
|
# Bring in all of the module definitions;
|
|
|
|
# these are the external pieces that will be downloaded and built
|
|
|
|
# as part of creating the Heads firmware image.
|
2016-08-03 12:40:51 +00:00
|
|
|
include modules/*
|
2016-08-02 23:25:47 +00:00
|
|
|
|
2016-11-29 16:19:48 +00:00
|
|
|
# These will be built via their intermediate targets
|
|
|
|
# This increases the build time, so it is commented out for now
|
|
|
|
#all: $(foreach m,$(modules),$m.intermediate)
|
2016-08-02 23:25:47 +00:00
|
|
|
|
|
|
|
define prefix =
|
|
|
|
$(foreach _, $2, $1$_)
|
|
|
|
endef
|
|
|
|
|
2016-09-10 21:36:36 +00:00
|
|
|
define bins =
|
2016-08-03 12:40:51 +00:00
|
|
|
$(foreach m,$1,$(call prefix,$(build)/$($m_dir)/,$($m_output)))
|
2016-08-02 23:25:47 +00:00
|
|
|
endef
|
2016-09-10 21:36:36 +00:00
|
|
|
define libs =
|
|
|
|
$(foreach m,$1,$(call prefix,$(build)/$($m_dir)/,$($m_libraries)))
|
|
|
|
endef
|
|
|
|
|
|
|
|
define outputs =
|
|
|
|
$(foreach m,$1,\
|
|
|
|
$(call bins,$m)\
|
|
|
|
$(call libs,$m)\
|
|
|
|
)
|
|
|
|
endef
|
2016-08-02 23:25:47 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# Generate the targets for a module.
|
|
|
|
#
|
|
|
|
# Special variables like $@ must be written as $$@ to avoid
|
|
|
|
# expansion during the first evaluation.
|
|
|
|
#
|
|
|
|
define define_module =
|
2016-08-19 15:31:07 +00:00
|
|
|
ifneq ("$($1_repo)","")
|
|
|
|
# Checkout the tree instead and touch the canary file so that we know
|
|
|
|
# that the files are all present. No signature hashes are checked in
|
|
|
|
# this case, since we don't have a stable version to compare against.
|
|
|
|
$(build)/$($1_dir)/.canary:
|
|
|
|
git clone "$($1_repo)" "$(build)/$($1_dir)"
|
2017-01-31 16:56:14 +00:00
|
|
|
if [ -r patches/$1.patch ]; then \
|
|
|
|
( cd $(build)/$($1_dir) ; patch -p1 ) \
|
|
|
|
< patches/$1.patch; \
|
|
|
|
fi
|
2016-08-19 15:31:07 +00:00
|
|
|
touch "$$@"
|
|
|
|
else
|
|
|
|
# Fetch and verify the source tar file
|
|
|
|
$(packages)/$($1_tar):
|
2016-08-02 23:25:47 +00:00
|
|
|
wget -O "$$@" $($1_url)
|
2016-08-19 15:31:07 +00:00
|
|
|
$(packages)/.$1_verify: $(packages)/$($1_tar)
|
2017-01-27 20:47:08 +00:00
|
|
|
echo "$($1_hash) $$^" | sha256sum --check -
|
2016-08-02 23:25:47 +00:00
|
|
|
touch "$$@"
|
|
|
|
|
2016-08-19 15:31:07 +00:00
|
|
|
# Unpack the tar file and touch the canary so that we know
|
|
|
|
# that the files are all present
|
|
|
|
$(build)/$($1_dir)/.canary: $(packages)/.$1_verify
|
2016-08-03 12:52:23 +00:00
|
|
|
tar -xf "$(packages)/$($1_tar)" -C "$(build)"
|
2016-08-03 22:10:44 +00:00
|
|
|
if [ -r patches/$1-$($1_version).patch ]; then \
|
2016-12-29 23:23:08 +00:00
|
|
|
( cd $(build)/$($1_dir) ; patch -p1 ) \
|
|
|
|
< patches/$1-$($1_version).patch; \
|
2016-08-03 22:10:44 +00:00
|
|
|
fi
|
2016-08-02 23:25:47 +00:00
|
|
|
touch "$$@"
|
2016-08-19 15:31:07 +00:00
|
|
|
endif
|
2016-08-02 23:25:47 +00:00
|
|
|
|
2016-12-01 19:03:55 +00:00
|
|
|
ifeq "$($1_config)" ""
|
|
|
|
# There is no official .config file
|
2016-11-29 16:19:48 +00:00
|
|
|
$(build)/$($1_dir)/.config: $(build)/$($1_dir)/.canary
|
|
|
|
touch "$$@"
|
2016-12-01 19:03:55 +00:00
|
|
|
else
|
|
|
|
# Copy the stored config file into the unpacked directory
|
|
|
|
$(build)/$($1_dir)/.config: config/$($1_config) $(build)/$($1_dir)/.canary
|
|
|
|
cp -a "$$<" "$$@"
|
2016-11-29 16:19:48 +00:00
|
|
|
endif
|
2016-12-13 18:10:21 +00:00
|
|
|
|
2016-08-02 23:25:47 +00:00
|
|
|
# Use the module's configure variable to build itself
|
|
|
|
$(build)/$($1_dir)/.configured: \
|
|
|
|
$(build)/$($1_dir)/.canary \
|
|
|
|
$(build)/$($1_dir)/.config
|
2017-03-21 18:24:00 +00:00
|
|
|
@echo "$(DATE) Configuring $1"
|
|
|
|
@( \
|
|
|
|
cd "$(build)/$($1_dir)" ; \
|
|
|
|
echo "$($1_configure)"; \
|
|
|
|
$($1_configure) \
|
|
|
|
) \
|
2017-03-20 18:47:47 +00:00
|
|
|
< /dev/null \
|
2017-02-28 23:02:10 +00:00
|
|
|
2>&1 \
|
|
|
|
| tee "$(log_dir)/$1.configure.log" \
|
|
|
|
$(VERBOSE_REDIRECT)
|
2016-08-02 23:25:47 +00:00
|
|
|
touch "$$@"
|
|
|
|
|
2017-03-20 21:52:54 +00:00
|
|
|
# All of the outputs should result from building the intermediate target
|
2016-11-29 16:19:48 +00:00
|
|
|
$(call outputs,$1): $1.intermediate
|
2016-08-03 01:23:18 +00:00
|
|
|
|
|
|
|
# Short hand target for the module
|
2016-11-29 16:19:48 +00:00
|
|
|
#$1: $(call outputs,$1)
|
2016-08-02 23:25:47 +00:00
|
|
|
|
2016-11-29 16:19:48 +00:00
|
|
|
# Target for all of the outputs, which depend on their dependent modules
|
2016-12-28 17:45:12 +00:00
|
|
|
$1.intermediate: \
|
2016-12-29 23:23:08 +00:00
|
|
|
$(foreach d,$($1_depends),$d.intermediate) \
|
2017-03-20 21:52:54 +00:00
|
|
|
$(foreach d,$($1_depends),$(call outputs,$d)) \
|
2016-12-28 17:45:12 +00:00
|
|
|
$(build)/$($1_dir)/.configured
|
2017-02-28 23:02:10 +00:00
|
|
|
@echo "$(DATE) Building $1"
|
2017-03-21 18:24:00 +00:00
|
|
|
@( \
|
|
|
|
echo "$(MAKE) \
|
|
|
|
-C \"$(build)/$($1_dir)\" \
|
|
|
|
$($1_target)" ; \
|
|
|
|
$(MAKE) \
|
|
|
|
-C "$(build)/$($1_dir)" \
|
|
|
|
$($1_target) \
|
2017-02-28 23:02:10 +00:00
|
|
|
) \
|
2017-03-20 18:47:47 +00:00
|
|
|
< /dev/null \
|
2017-02-28 23:02:10 +00:00
|
|
|
2>&1 \
|
|
|
|
| tee "$(log_dir)/$1.log" \
|
2017-03-20 18:47:47 +00:00
|
|
|
$(VERBOSE_REDIRECT) \
|
|
|
|
|| ( \
|
|
|
|
echo "tail $(log_dir)/$1.log"; \
|
|
|
|
echo "-----"; \
|
|
|
|
tail -20 "$(log_dir)/$1.log"; \
|
|
|
|
exit 1; \
|
|
|
|
)
|
2016-11-29 16:19:48 +00:00
|
|
|
|
2017-01-31 16:56:14 +00:00
|
|
|
$1.clean:
|
2017-01-31 19:57:41 +00:00
|
|
|
-$(RM) "$(build)/$($1_dir)/.configured"
|
2017-01-31 16:56:14 +00:00
|
|
|
-$(MAKE) -C "$(build)/$($1_dir)" clean
|
|
|
|
|
2016-11-29 16:19:48 +00:00
|
|
|
.INTERMEDIATE: $1.intermediate
|
2016-08-02 23:25:47 +00:00
|
|
|
endef
|
|
|
|
|
|
|
|
$(foreach _, $(modules), $(eval $(call define_module,$_)))
|
2016-07-25 14:08:53 +00:00
|
|
|
|
2017-01-04 15:31:27 +00:00
|
|
|
initrd_lib_dir := initrd/lib
|
2016-09-10 21:36:36 +00:00
|
|
|
initrd_bin_dir := initrd/bin
|
|
|
|
|
|
|
|
#
|
|
|
|
# Install a file into the initrd, if it changed from
|
|
|
|
# the destination file.
|
|
|
|
#
|
|
|
|
define install =
|
2017-02-28 23:02:10 +00:00
|
|
|
@echo "$(DATE) Installing $2"
|
2017-03-20 18:47:47 +00:00
|
|
|
@cp -a "$1" "$2"
|
2016-09-10 21:36:36 +00:00
|
|
|
endef
|
2016-08-03 01:23:18 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# Files that should be copied into the initrd
|
|
|
|
# THis should probably be done in a more scalable manner
|
|
|
|
#
|
2016-09-10 21:36:36 +00:00
|
|
|
define initrd_bin_add =
|
|
|
|
$(initrd_bin_dir)/$(notdir $1): $1
|
2016-09-26 18:55:48 +00:00
|
|
|
@if [ ! -d "$(initrd_bin_dir)" ]; \
|
|
|
|
then mkdir -p "$(initrd_bin_dir)"; \
|
|
|
|
fi
|
|
|
|
$(call install,$$<,$$@)
|
2016-09-10 21:36:36 +00:00
|
|
|
initrd_bins += $(initrd_bin_dir)/$(notdir $1)
|
2016-08-03 01:23:18 +00:00
|
|
|
endef
|
|
|
|
|
2016-09-10 21:36:36 +00:00
|
|
|
|
|
|
|
define initrd_lib_add =
|
|
|
|
$(initrd_lib_dir)/$(notdir $1): $1
|
2016-09-26 18:55:48 +00:00
|
|
|
@if [ ! -d "$(initrd_lib_dir)" ]; \
|
|
|
|
then mkdir -p "$(initrd_lib_dir)"; \
|
|
|
|
fi
|
|
|
|
$(call install,$$<,$$@)
|
2016-09-10 21:36:36 +00:00
|
|
|
initrd_libs += $(initrd_lib_dir)/$(notdir $1)
|
|
|
|
endef
|
|
|
|
|
|
|
|
$(foreach _, $(call bins,kexec), $(eval $(call initrd_bin_add,$_)))
|
|
|
|
$(foreach _, $(call bins,tpmtotp), $(eval $(call initrd_bin_add,$_)))
|
2016-12-01 19:03:55 +00:00
|
|
|
$(foreach _, $(call bins,cryptsetup), $(eval $(call initrd_bin_add,$_)))
|
2016-12-28 17:45:12 +00:00
|
|
|
$(foreach _, $(call bins,gpg), $(eval $(call initrd_bin_add,$_)))
|
|
|
|
$(foreach _, $(call bins,lvm2), $(eval $(call initrd_bin_add,$_)))
|
2016-09-10 21:36:36 +00:00
|
|
|
|
|
|
|
$(foreach _, $(call libs,tpmtotp), $(eval $(call initrd_lib_add,$_)))
|
|
|
|
$(foreach _, $(call libs,mbedtls), $(eval $(call initrd_lib_add,$_)))
|
|
|
|
$(foreach _, $(call libs,qrencode), $(eval $(call initrd_lib_add,$_)))
|
2016-12-28 17:45:12 +00:00
|
|
|
$(foreach _, $(call libs,lvm2), $(eval $(call initrd_lib_add,$_)))
|
2016-09-10 21:36:36 +00:00
|
|
|
|
2016-08-06 21:13:22 +00:00
|
|
|
#$(foreach _, $(call outputs,xen), $(eval $(call initrd_bin,$_)))
|
2016-08-03 01:23:18 +00:00
|
|
|
|
|
|
|
# hack to install busybox into the initrd
|
|
|
|
initrd_bins += initrd/bin/busybox
|
|
|
|
|
|
|
|
initrd/bin/busybox: $(build)/$(busybox_dir)/busybox
|
|
|
|
cmp --quiet "$@" "$^" || \
|
2017-01-27 21:17:03 +00:00
|
|
|
$(MAKE) \
|
2016-08-03 01:23:18 +00:00
|
|
|
-C $(build)/$(busybox_dir) \
|
2016-12-29 23:23:08 +00:00
|
|
|
CC="$(heads_cc)" \
|
2016-08-03 01:23:18 +00:00
|
|
|
CONFIG_PREFIX="$(pwd)/initrd" \
|
2017-03-21 18:29:07 +00:00
|
|
|
$(MAKE_JOBS) \
|
2016-08-03 01:23:18 +00:00
|
|
|
install
|
|
|
|
|
2016-08-04 21:38:00 +00:00
|
|
|
# hack to build cbmem from coreboot
|
2016-12-29 23:23:08 +00:00
|
|
|
# this must be built *AFTER* musl
|
2016-08-04 21:38:00 +00:00
|
|
|
initrd_bins += initrd/bin/cbmem
|
|
|
|
initrd/bin/cbmem: $(build)/$(coreboot_dir)/util/cbmem/cbmem
|
2017-03-20 18:47:47 +00:00
|
|
|
cp "$^" "$@"
|
2016-12-29 23:23:08 +00:00
|
|
|
$(build)/$(coreboot_dir)/util/cbmem/cbmem: \
|
|
|
|
$(build)/$(coreboot_dir)/.canary \
|
|
|
|
musl.intermediate
|
2017-02-28 23:02:10 +00:00
|
|
|
@echo "$(DATE) Building cbmem"
|
|
|
|
@$(MAKE) -C "$(dir $@)" CC="$(heads_cc)"
|
2016-08-04 21:38:00 +00:00
|
|
|
|
2016-08-03 01:23:18 +00:00
|
|
|
|
|
|
|
# Update all of the libraries in the initrd based on the executables
|
|
|
|
# that were installed.
|
2016-09-10 21:36:36 +00:00
|
|
|
initrd_lib_install: $(initrd_bins) $(initrd_libs)
|
|
|
|
-find initrd/bin -type f -a ! -name '*.sh' -print0 \
|
2017-03-20 18:47:47 +00:00
|
|
|
| xargs -0 $(CROSS)strip --preserve-dates
|
2016-12-28 17:45:12 +00:00
|
|
|
LD_LIBRARY_PATH="$(INSTALL)/lib" \
|
2016-08-03 01:23:18 +00:00
|
|
|
./populate-lib \
|
2017-01-04 15:31:27 +00:00
|
|
|
$(initrd_lib_dir) \
|
2016-08-03 01:23:18 +00:00
|
|
|
initrd/bin/* \
|
|
|
|
initrd/sbin/* \
|
|
|
|
|
2017-01-31 19:57:41 +00:00
|
|
|
-$(CROSS)strip $(initrd_lib_dir)/* ; true
|
2016-08-03 01:23:18 +00:00
|
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
# initrd image creation
|
|
|
|
#
|
|
|
|
# The initrd is constructed from various bits and pieces
|
2016-11-23 17:11:08 +00:00
|
|
|
# The cpio-clean program is used ensure that the files
|
|
|
|
# always have the same timestamp and appear in the same order.
|
2016-08-03 01:23:18 +00:00
|
|
|
#
|
2016-11-23 17:11:08 +00:00
|
|
|
# If there is no /dev/console, initrd can't startup.
|
2016-08-03 14:47:48 +00:00
|
|
|
# We have to force it to be included into the cpio image.
|
2016-11-23 17:11:08 +00:00
|
|
|
# Since we are picking up the system's /dev/console, there
|
|
|
|
# is a chance the build will not be reproducible (although
|
|
|
|
# unlikely that their device file has a different major/minor)
|
2016-08-03 01:23:18 +00:00
|
|
|
#
|
|
|
|
#
|
2016-09-10 21:36:36 +00:00
|
|
|
initrd.cpio: $(initrd_bins) $(initrd_libs) initrd_lib_install
|
2016-08-03 14:47:48 +00:00
|
|
|
cd ./initrd ; \
|
2017-02-28 20:18:57 +00:00
|
|
|
find . \
|
2016-08-03 14:47:48 +00:00
|
|
|
| cpio --quiet -H newc -o \
|
2017-02-28 20:18:57 +00:00
|
|
|
| ../cpio-clean ../dev.cpio - \
|
2016-12-13 18:10:21 +00:00
|
|
|
> "../$@.tmp"
|
2016-08-03 01:23:18 +00:00
|
|
|
if ! cmp --quiet "$@" "$@.tmp"; then \
|
|
|
|
mv "$@.tmp" "$@"; \
|
|
|
|
else \
|
|
|
|
echo "$@: Unchanged"; \
|
|
|
|
rm "$@.tmp"; \
|
|
|
|
fi
|
2016-11-29 16:19:48 +00:00
|
|
|
|
|
|
|
initrd.intermediate: initrd.cpio
|
2016-12-13 18:10:21 +00:00
|
|
|
|
2016-08-03 01:23:18 +00:00
|
|
|
|
2016-08-14 20:02:15 +00:00
|
|
|
# populate the coreboot initrd image from the one we built.
|
|
|
|
# 4.4 doesn't allow this, but building from head does.
|
2017-03-17 19:17:14 +00:00
|
|
|
#$(call outputs,linux): initrd.cpio
|
|
|
|
coreboot.intermediate: $(build)/$(coreboot_dir)/initrd.cpio.xz
|
2016-08-14 20:02:15 +00:00
|
|
|
$(build)/$(coreboot_dir)/initrd.cpio.xz: initrd.cpio
|
2017-03-17 19:17:14 +00:00
|
|
|
xz \
|
|
|
|
--check=crc32 \
|
|
|
|
--lzma2=dict=1MiB \
|
|
|
|
--extreme \
|
|
|
|
< "$<" \
|
|
|
|
> "$@"
|
2016-08-03 01:59:14 +00:00
|
|
|
|
|
|
|
# hack for the coreboot to find the linux kernel
|
2017-03-20 22:02:05 +00:00
|
|
|
$(build)/$(coreboot_dir)/bzImage: $(build)/$(linux_dir)/arch/x86/boot/bzImage
|
2017-02-28 23:02:10 +00:00
|
|
|
@echo "$(DATE) Copying $@"
|
2017-03-20 18:47:47 +00:00
|
|
|
@cp -a "$^" "$@"
|
|
|
|
coreboot.intermediate: $(build)/$(coreboot_dir)/bzImage
|
2016-08-03 12:40:51 +00:00
|
|
|
|
2016-08-06 21:13:22 +00:00
|
|
|
|
2016-12-13 17:02:35 +00:00
|
|
|
# The coreboot gcc won't work for us since it doesn't have libc
|
2016-08-06 21:13:22 +00:00
|
|
|
#XGCC := $(build)/$(coreboot_dir)/util/crossgcc/xgcc/
|
|
|
|
#export CC := $(XGCC)/bin/x86_64-elf-gcc
|
|
|
|
#export LDFLAGS := -L/lib/x86_64-linux-gnu
|
|
|
|
|
2016-11-23 17:11:08 +00:00
|
|
|
x230.rom: $(build)/$(coreboot_dir)/x230/coreboot.rom
|
2017-03-20 18:47:47 +00:00
|
|
|
"$(build)/$(coreboot_dir)/$(BOARD)/cbfstool" "$<" print
|
2016-08-14 20:02:15 +00:00
|
|
|
dd if="$<" of="$@" bs=1M skip=8
|
2017-03-20 21:52:54 +00:00
|
|
|
$(RM) "$<"
|
2017-03-21 18:31:36 +00:00
|
|
|
@sha256sum "$@"
|
2016-08-14 20:02:15 +00:00
|
|
|
|
2016-11-23 17:11:08 +00:00
|
|
|
qemu.rom: $(build)/$(coreboot_dir)/qemu/coreboot.rom
|
2017-03-20 18:47:47 +00:00
|
|
|
"$(build)/$(coreboot_dir)/$(BOARD)/cbfstool" "$<" print
|
2017-03-20 21:52:54 +00:00
|
|
|
mv "$<" "$@"
|
2017-03-21 18:31:36 +00:00
|
|
|
@sha256sum "$@"
|
2017-03-20 21:52:54 +00:00
|
|
|
|
2017-01-04 15:31:27 +00:00
|
|
|
|
|
|
|
clean-modules:
|
2017-02-28 23:02:10 +00:00
|
|
|
for dir in \
|
|
|
|
$(busybox_dir) \
|
|
|
|
$(cryptsetup_dir) \
|
|
|
|
$(gnupg_dir) \
|
|
|
|
$(kexec_dir) \
|
|
|
|
$(libuuid_dir) \
|
|
|
|
$(lvm2_dir) \
|
|
|
|
$(mbedtls_dir) \
|
|
|
|
$(popt_dir) \
|
|
|
|
$(qrencode_dir) \
|
|
|
|
$(tpmtotp_dir) \
|
|
|
|
; do \
|
|
|
|
$(MAKE) -C "build/$$dir" clean ; \
|
|
|
|
rm "build/$$dir/.configured" ; \
|
2017-01-04 15:31:27 +00:00
|
|
|
done
|
2017-01-27 21:17:03 +00:00
|
|
|
|
|
|
|
|
|
|
|
else
|
|
|
|
# Wrong make version detected -- build our local version
|
|
|
|
# and re-invoke the Makefile with it instead.
|
|
|
|
$(info Wrong make detected: $(LOCAL_MAKE_VERSION))
|
|
|
|
HEADS_MAKE := $(build)/$(make_dir)/make
|
|
|
|
|
|
|
|
# Once we have a proper Make, we can just pass arguments into it
|
|
|
|
%: $(HEADS_MAKE)
|
|
|
|
LANG=C MAKE=$(HEADS_MAKE) $(HEADS_MAKE) $@
|
|
|
|
all:
|
|
|
|
|
|
|
|
# How to download and build the correct version of make
|
|
|
|
$(HEADS_MAKE): $(build)/$(make_dir)/Makefile
|
2017-03-21 18:29:07 +00:00
|
|
|
make -C "`dirname $@`" $(MAKE_JOBS) \
|
2017-02-28 23:02:10 +00:00
|
|
|
2>&1 \
|
|
|
|
| tee "$(log_dir)/make.log" \
|
|
|
|
$(VERBOSE_REDIRECT)
|
|
|
|
|
2017-01-27 21:17:03 +00:00
|
|
|
$(build)/$(make_dir)/Makefile: $(packages)/$(make_tar)
|
|
|
|
tar xf "$<" -C build/
|
2017-02-28 23:02:10 +00:00
|
|
|
cd "`dirname $@`" ; ./configure \
|
|
|
|
2>&1 \
|
|
|
|
| tee "$(log_dir)/make.configure.log" \
|
|
|
|
$(VERBOSE_REDIRECT)
|
|
|
|
|
2017-01-27 21:17:03 +00:00
|
|
|
$(packages)/$(make_tar):
|
|
|
|
wget -O "$@" "$(make_url)"
|
|
|
|
if ! echo "$(make_hash) $@" | sha256sum --check -; then \
|
|
|
|
$(MV) "$@" "$@.failed"; \
|
|
|
|
false; \
|
|
|
|
fi
|
|
|
|
|
|
|
|
endif
|