2019-04-17 15:25:56 +00:00
|
|
|
SHELL := /bin/sh
|
2020-05-25 22:44:25 +00:00
|
|
|
MAKEFILE := $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))
|
|
|
|
MAKEFLAGS += --no-builtin-rules
|
2019-04-17 15:25:56 +00:00
|
|
|
|
|
|
|
.SUFFIXES:
|
2019-03-28 06:43:21 +00:00
|
|
|
|
2019-03-03 12:42:46 +00:00
|
|
|
.PHONY: default
|
|
|
|
default: all
|
|
|
|
|
2019-04-17 15:25:56 +00:00
|
|
|
#######################################################################################################################
|
|
|
|
# Overridable project defaults
|
2019-04-06 06:09:21 +00:00
|
|
|
|
2020-05-25 22:44:25 +00:00
|
|
|
DOBUILD_DOCKERFILE ?= $(PROJECTDIR)/build/%MARCH%-%DISTRIB_ID%-%ID%.dockerfile
|
2020-06-07 14:21:15 +00:00
|
|
|
DOBUILD_EXTDIR ?= $(PROJECTDIR)/build/dobuild-extensions
|
2020-05-25 22:44:25 +00:00
|
|
|
DOBUILD_PROJECTDIR ?= $(patsubst %/,%,$(dir $(MAKEFILE)))
|
2020-06-07 14:21:15 +00:00
|
|
|
DOBUILD_GENERIC_ADAPTER ?= meson
|
2019-03-23 02:48:15 +00:00
|
|
|
|
2020-05-25 22:44:25 +00:00
|
|
|
DOBUILDDIR ?= $(PROJECTDIR)/build/dobuild
|
|
|
|
PROJECTDIR = $(DOBUILD_PROJECTDIR)
|
2019-04-06 06:09:21 +00:00
|
|
|
|
2020-05-25 22:44:25 +00:00
|
|
|
include $(DOBUILDDIR)/defaults.mk
|
2019-03-23 02:48:15 +00:00
|
|
|
|
2020-05-25 22:44:25 +00:00
|
|
|
#######################################################################################################################
|
|
|
|
# Project defaults and macros
|
|
|
|
|
|
|
|
DEFAULTTARGET = x86_64-ubuntu@bionic+builder@debug
|
2019-03-28 06:43:21 +00:00
|
|
|
|
2020-05-25 22:44:25 +00:00
|
|
|
FETCHDIR = $(BUILDDIR)/.deps
|
2019-04-06 06:09:21 +00:00
|
|
|
|
2020-05-25 22:44:25 +00:00
|
|
|
dobuild_image_buildargs = \
|
|
|
|
$(addprefix MARCH=,%MARCH%) \
|
|
|
|
$(addprefix DISTRIB_VERSION=,%DISTRIB_VERSION%) \
|
|
|
|
$(addprefix USERID=,$(USERID))
|
2019-03-23 01:17:44 +00:00
|
|
|
|
2019-04-17 15:25:56 +00:00
|
|
|
#######################################################################################################################
|
2019-04-06 06:09:21 +00:00
|
|
|
# Project dependencies
|
|
|
|
|
|
|
|
DUMB_INIT_VERSION ?= 1.2.2
|
2020-05-25 22:44:25 +00:00
|
|
|
IMAGE_BUILDARGS += DUMB_INIT_VERSION=$(DUMB_INIT_VERSION)
|
2019-04-17 15:25:56 +00:00
|
|
|
FETCH_TARGETS += $(FETCHDIR)/dumb-init-$(DUMB_INIT_VERSION).tar.gz
|
|
|
|
$(FETCHDIR)/dumb-init-$(DUMB_INIT_VERSION).tar.gz: URL := https://github.com/Yelp/dumb-init/archive/v${DUMB_INIT_VERSION}.tar.gz
|
|
|
|
$(SKIP_MD5SUM)$(FETCHDIR)/dumb-init-$(DUMB_INIT_VERSION).tar.gz: MD5 := 6166084b05772cdcf615a762c6f3b32e
|
2019-04-02 20:21:02 +00:00
|
|
|
|
2020-03-20 16:03:33 +00:00
|
|
|
FUSE_VERSION ?= 3.9.1
|
2020-05-25 22:44:25 +00:00
|
|
|
IMAGE_BUILDARGS += FUSE_VERSION=$(FUSE_VERSION)
|
2019-04-17 15:25:56 +00:00
|
|
|
FETCH_TARGETS += $(FETCHDIR)/libfuse-fuse-$(FUSE_VERSION).tar.gz
|
|
|
|
$(FETCHDIR)/libfuse-fuse-$(FUSE_VERSION).tar.gz: URL := https://github.com/libfuse/libfuse/archive/fuse-$(FUSE_VERSION).tar.gz
|
2020-03-20 16:03:33 +00:00
|
|
|
$(SKIP_MD5SUM)$(FETCHDIR)/libfuse-fuse-$(FUSE_VERSION).tar.gz: MD5 := 5f7c1062def710d8b60343524a18cc82
|
2019-03-23 01:17:44 +00:00
|
|
|
|
2019-12-01 18:01:40 +00:00
|
|
|
QEMU_VERSION ?= v4.1.0-1
|
2020-05-25 22:44:25 +00:00
|
|
|
IMAGE_BUILDARGS += QEMU_VERSION_=$(QEMU_VERSION)
|
2019-04-17 15:25:56 +00:00
|
|
|
FETCH_TARGETS += $(FETCHDIR)/qemu-arm-static-$(QEMU_VERSION)
|
|
|
|
$(FETCHDIR)/qemu-arm-static-$(QEMU_VERSION): URL := https://github.com/multiarch/qemu-user-static/releases/download/$(QEMU_VERSION)/qemu-arm-static
|
2019-12-01 18:01:40 +00:00
|
|
|
$(SKIP_MD5SUM)$(FETCHDIR)/qemu-arm-static-$(QEMU_VERSION): MD5 := e508e6e4dd7f3a851207aac245a4653f
|
2019-03-23 03:07:47 +00:00
|
|
|
|
2019-04-17 15:25:56 +00:00
|
|
|
#######################################################################################################################
|
2019-03-23 03:07:47 +00:00
|
|
|
# Architecture-specific rule target configuration
|
2019-03-03 12:42:46 +00:00
|
|
|
|
2020-06-07 14:21:15 +00:00
|
|
|
GENERIC_TARGETS += $(call target_properties_combine,\
|
2020-05-25 22:44:25 +00:00
|
|
|
,\
|
|
|
|
x86_64 arm32v7,\
|
|
|
|
ubuntu@bionic alpine@3.9,\
|
|
|
|
,\
|
|
|
|
,\
|
|
|
|
builder,\
|
|
|
|
,\
|
2020-06-07 14:56:23 +00:00
|
|
|
debug release coverage minsize \
|
2020-05-25 22:44:25 +00:00
|
|
|
)
|
2020-06-07 14:21:15 +00:00
|
|
|
DOCKER_TARGETS += $(GENERIC_TARGETS)
|
2019-05-24 23:57:04 +00:00
|
|
|
|
2019-04-17 15:25:56 +00:00
|
|
|
#######################################################################################################################
|
2019-03-23 03:07:47 +00:00
|
|
|
# Common rule target configuration
|
2019-03-03 12:42:46 +00:00
|
|
|
|
2019-04-06 06:09:21 +00:00
|
|
|
CURLFLAGS += -s
|
|
|
|
|
2019-04-02 20:21:02 +00:00
|
|
|
DOCKER_RUNFLAGS += --device /dev/fuse
|
|
|
|
DOCKER_RUNFLAGS += --cap-add SYS_ADMIN
|
|
|
|
DOCKER_RUNFLAGS += --security-opt apparmor:unconfined
|
|
|
|
|
|
|
|
DOCKER_RUNFLAGS += --cap-add SYS_PTRACE
|
|
|
|
DOCKER_RUNFLAGS += --security-opt seccomp=unconfined
|
2019-03-29 12:23:17 +00:00
|
|
|
|
2019-04-17 15:25:56 +00:00
|
|
|
OUTDIRS += $(OUTDIR)/src
|
2020-05-25 22:59:08 +00:00
|
|
|
OUTDIRS += $(OUTDIR)/docker
|
2019-04-17 15:25:56 +00:00
|
|
|
|
|
|
|
EXTRACT_TARGETS += $(OUTDIR)/docker/qemu-arm-static-$(QEMU_VERSION)
|
|
|
|
EXTRACT_TARGETS += $(patsubst $(FETCHDIR)/%.tar.gz,$(OUTDIR)/src/%,$(FETCH_TARGETS))
|
|
|
|
|
|
|
|
#######################################################################################################################
|
2019-04-06 06:09:21 +00:00
|
|
|
# Makefile dependencies
|
|
|
|
|
2020-05-25 22:44:25 +00:00
|
|
|
MAKEFILE_DEPS += gzip
|
2019-04-17 15:25:56 +00:00
|
|
|
MAKEFILE_DEPS += tar
|
|
|
|
MAKEFILE_DEPS += chmod
|
|
|
|
MAKEFILE_DEPS += touch
|
|
|
|
MAKEFILE_DEPS += cp
|
2019-04-06 06:09:21 +00:00
|
|
|
|
2019-04-17 15:25:56 +00:00
|
|
|
#######################################################################################################################
|
2019-03-20 23:43:53 +00:00
|
|
|
# Rules
|
2019-03-03 12:42:46 +00:00
|
|
|
|
2020-05-25 22:44:25 +00:00
|
|
|
include $(DOBUILDDIR)/docker.mk
|
|
|
|
include $(DOBUILDDIR)/standardrules.mk
|
2019-05-24 23:57:04 +00:00
|
|
|
|
2019-04-17 15:25:56 +00:00
|
|
|
$(FETCH_TARGETS): | $(FETCHDIR)
|
2019-04-06 06:09:21 +00:00
|
|
|
$(SILENT)$(call curl,$@,$(URL),$(MD5))
|
2019-03-20 23:43:53 +00:00
|
|
|
|
2019-04-17 15:25:56 +00:00
|
|
|
$(OUTDIR)/docker/qemu-arm-static-$(QEMU_VERSION) : $(FETCHDIR)/qemu-arm-static-$(QEMU_VERSION) | $(OUTDIRS)
|
|
|
|
$(SILENT) \
|
2020-05-25 22:44:25 +00:00
|
|
|
$(call echo_if_silent_cmd,cp $< $@) \
|
2019-04-17 15:25:56 +00:00
|
|
|
&& cp $< $@ \
|
|
|
|
&& chmod +x $@
|
|
|
|
|
|
|
|
$(OUTDIR)/src/%: $(FETCHDIR)/%.tar.gz | $(OUTDIRS)
|
2019-03-20 23:43:53 +00:00
|
|
|
$(SILENT) \
|
2020-05-25 22:44:25 +00:00
|
|
|
$(call echo_if_silent_cmd,tar -C $(dir $@) -xf $<) \
|
|
|
|
&& tar -I 'gzip -n' -C $(dir $@) -xf $< \
|
2019-03-20 23:43:53 +00:00
|
|
|
&& touch $@
|
|
|
|
|
2019-04-17 15:25:56 +00:00
|
|
|
$(FETCHDIR):
|
2019-03-03 12:42:46 +00:00
|
|
|
$(SILENT)mkdir -p $@
|
|
|
|
|
2019-04-06 06:09:21 +00:00
|
|
|
.DELETE_ON_ERROR: $(FETCH_TARGETS)
|
|
|
|
|