2019-04-06 06:09:21 +00:00
|
|
|
MAKEFLAGS += $(_PARALLELMFLAGS) --no-builtin-rules
|
2019-04-17 15:25:56 +00:00
|
|
|
MAKEFILE := $(lastword $(MAKEFILE_LIST))
|
|
|
|
SHELL := /bin/sh
|
|
|
|
|
|
|
|
.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
|
|
|
#######################################################################################################################
|
|
|
|
# Project macros
|
2019-03-03 12:42:46 +00:00
|
|
|
|
2019-04-17 15:25:56 +00:00
|
|
|
filter_targets = $(shell echo '$2' | sed -e 's@\s@\n@g' | sed -n$(foreach REGEX,$1, -e 's@$(REGEX)@\0@p'))
|
2019-03-23 02:48:15 +00:00
|
|
|
|
2019-04-17 15:25:56 +00:00
|
|
|
regex_march_distro = '$1-$2-.*'
|
2019-04-06 06:09:21 +00:00
|
|
|
|
2019-04-17 15:25:56 +00:00
|
|
|
#######################################################################################################################
|
|
|
|
# Overridable project defaults
|
2019-04-06 06:09:21 +00:00
|
|
|
|
2019-04-17 15:25:56 +00:00
|
|
|
PROJECTNAME ?= webfuse
|
|
|
|
PROJECTDIR ?= $(patsubst %/,%,$(dir $(MAKEFILE)))
|
|
|
|
SCRIPTDIR ?= $(PROJECTDIR)/build/mkdocker
|
|
|
|
OUTDIR ?= $(PROJECTDIR)/.build
|
|
|
|
FETCHDIR ?= $(PROJECTDIR)/.deps
|
2019-04-02 20:21:02 +00:00
|
|
|
BUILDTYPE ?= Debug
|
2019-03-23 02:48:15 +00:00
|
|
|
|
2019-04-17 15:25:56 +00:00
|
|
|
SKIP_FETCH ?=
|
2019-04-06 06:09:21 +00:00
|
|
|
|
2019-04-17 15:25:56 +00:00
|
|
|
SKIP_DEFAULT_BUILDTARGET ?= $(or $(MARCH),$(DISTRO))
|
|
|
|
$(SKIP_DEFAULT_BUILDTARGET)BUILDTARGET ?= amd64-ubuntu-builder
|
|
|
|
MARCH ?= '.*'
|
|
|
|
DISTRO ?= '.*'
|
|
|
|
FILTER ?= $(call regex_march_distro,$(MARCH),$(DISTRO))
|
2019-03-23 02:48:15 +00:00
|
|
|
|
2019-04-02 20:21:02 +00:00
|
|
|
CONTAINER_USER ?= user
|
|
|
|
CONTAINER_GROUP ?= user
|
2019-03-28 06:43:21 +00:00
|
|
|
|
2019-04-06 06:09:21 +00:00
|
|
|
UBUNTU_CODENAME ?= bionic
|
2019-05-24 23:57:04 +00:00
|
|
|
ALPINE_CODENAME ?= 3.9
|
2019-04-06 06:09:21 +00:00
|
|
|
|
2019-04-17 15:25:56 +00:00
|
|
|
SKIP_MD5SUM ?= $(call filter_out_command,md5sum)
|
|
|
|
SKIP_MD5SUM := $(SKIP_MD5SUM)
|
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
|
|
|
|
DOCKER_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
|
|
|
|
2019-12-01 10:10:17 +00:00
|
|
|
GTEST_VERSION ?= 1.10.0
|
2019-03-23 01:17:44 +00:00
|
|
|
DOCKER_BUILDARGS += GTEST_VERSION=$(GTEST_VERSION)
|
2019-04-17 15:25:56 +00:00
|
|
|
FETCH_TARGETS += $(FETCHDIR)/googletest-release-$(GTEST_VERSION).tar.gz
|
|
|
|
$(FETCHDIR)/googletest-release-$(GTEST_VERSION).tar.gz: URL := https://github.com/google/googletest/archive/release-$(GTEST_VERSION).tar.gz
|
2019-12-01 10:10:17 +00:00
|
|
|
$(SKIP_MD5SUM)$(FETCHDIR)/googletest-release-$(GTEST_VERSION).tar.gz: MD5 := ecd1fa65e7de707cd5c00bdac56022cd
|
2019-03-23 01:17:44 +00:00
|
|
|
|
2019-03-20 23:43:53 +00:00
|
|
|
FUSE_VERSION ?= 3.1.1
|
2019-03-23 01:17:44 +00:00
|
|
|
DOCKER_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
|
|
|
|
$(SKIP_MD5SUM)$(FETCHDIR)/libfuse-fuse-$(FUSE_VERSION).tar.gz: MD5 := 097f194856938afdd98bea1a5c046edd
|
2019-03-23 01:17:44 +00:00
|
|
|
|
2019-12-01 10:13:53 +00:00
|
|
|
WEBSOCKETS_VERSION ?= 3.2.0
|
2019-03-23 01:17:44 +00:00
|
|
|
DOCKER_BUILDARGS += WEBSOCKETS_VERSION=$(WEBSOCKETS_VERSION)
|
2019-04-17 15:25:56 +00:00
|
|
|
FETCH_TARGETS += $(FETCHDIR)/libwebsockets-$(WEBSOCKETS_VERSION).tar.gz
|
|
|
|
$(FETCHDIR)/libwebsockets-$(WEBSOCKETS_VERSION).tar.gz: URL := https://github.com/warmcat/libwebsockets/archive/v$(WEBSOCKETS_VERSION).tar.gz
|
2019-12-01 10:13:53 +00:00
|
|
|
$(SKIP_MD5SUM)$(FETCHDIR)/libwebsockets-$(WEBSOCKETS_VERSION).tar.gz: MD5 := 1d06f5602604e67e6f50cef9857c6b0c
|
2019-03-23 01:17:44 +00:00
|
|
|
|
2019-03-20 23:43:53 +00:00
|
|
|
JANSSON_VERSION ?= 2.12
|
2019-03-23 01:17:44 +00:00
|
|
|
DOCKER_BUILDARGS += JANSSON_VERSION=$(JANSSON_VERSION)
|
2019-04-17 15:25:56 +00:00
|
|
|
FETCH_TARGETS += $(FETCHDIR)/jansson-$(JANSSON_VERSION).tar.gz
|
|
|
|
$(FETCHDIR)/jansson-$(JANSSON_VERSION).tar.gz: URL := https://github.com/akheron/jansson/archive/v$(JANSSON_VERSION).tar.gz
|
|
|
|
$(SKIP_MD5SUM)$(FETCHDIR)/jansson-$(JANSSON_VERSION).tar.gz: MD5 := c4b106528d5ffb521178565de1ba950d
|
2019-03-20 23:43:53 +00:00
|
|
|
|
2019-12-01 18:01:40 +00:00
|
|
|
QEMU_VERSION ?= v4.1.0-1
|
2019-04-06 06:09:21 +00:00
|
|
|
DOCKER_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
|
|
|
|
2019-04-17 15:25:56 +00:00
|
|
|
CMAKE_TARGETS += amd64-ubuntu-builder
|
2019-05-24 23:57:04 +00:00
|
|
|
CMAKE_TARGETS += amd64-alpine-builder
|
2019-04-17 15:25:56 +00:00
|
|
|
CMAKE_TARGETS += arm32v7-ubuntu-builder
|
2019-05-25 00:44:32 +00:00
|
|
|
CMAKE_TARGETS += arm32v7-alpine-builder
|
2019-04-06 06:09:21 +00:00
|
|
|
|
2019-04-17 15:25:56 +00:00
|
|
|
MEMCHECK_FILTER = $(call regex_march_distro,'$(HOST_MARCH)','.*')
|
2019-03-23 17:16:31 +00:00
|
|
|
|
2019-04-17 15:25:56 +00:00
|
|
|
UBUNTU_FILTER = $(call regex_march_distro,'.*','ubuntu')
|
|
|
|
UBUNTU_TARGETS = $(addprefix $(OUTDIR)/docker/,$(call filter_targets,$(UBUNTU_FILTER),$(TARGETS)))
|
2019-03-23 03:07:47 +00:00
|
|
|
|
2019-05-24 23:57:04 +00:00
|
|
|
ALPINE_FILTER = $(call regex_march_distro,'.*','alpine')
|
|
|
|
ALPINE_TARGETS = $(addprefix $(OUTDIR)/docker/,$(call filter_targets,$(ALPINE_FILTER),$(TARGETS)))
|
|
|
|
|
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-03-03 12:42:46 +00:00
|
|
|
DOCKER_BUILDARGS += CODENAME=$(CODENAME)
|
2019-04-02 20:21:02 +00:00
|
|
|
|
2019-04-17 15:25:56 +00:00
|
|
|
OUTDIRS += $(OUTDIR)/src
|
|
|
|
|
|
|
|
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
|
|
|
|
|
2019-04-17 15:25:56 +00:00
|
|
|
$(SKIP_FETCH)MAKEFILE_DEPS += curl
|
|
|
|
MAKEFILE_DEPS += gunzip
|
|
|
|
MAKEFILE_DEPS += tar
|
|
|
|
MAKEFILE_DEPS += chmod
|
|
|
|
MAKEFILE_DEPS += touch
|
|
|
|
MAKEFILE_DEPS += test
|
|
|
|
MAKEFILE_DEPS += cp
|
|
|
|
MAKEFILE_DEPS += sed
|
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
|
|
|
|
2019-04-17 15:25:56 +00:00
|
|
|
include $(SCRIPTDIR)/cmake.mk
|
|
|
|
include $(SCRIPTDIR)/docker.mk
|
|
|
|
include $(SCRIPTDIR)/standardrules.mk
|
2019-03-19 23:58:06 +00:00
|
|
|
|
2019-03-28 06:43:21 +00:00
|
|
|
$(CHECK_TARGETS): GOALS := test
|
2019-03-03 12:42:46 +00:00
|
|
|
|
2019-04-17 15:25:56 +00:00
|
|
|
$(UBUNTU_TARGETS): CODENAME := $(UBUNTU_CODENAME)
|
2019-03-20 23:43:53 +00:00
|
|
|
|
2019-05-24 23:57:04 +00:00
|
|
|
$(ALPINE_TARGETS): CODENAME := $(ALPINE_CODENAME)
|
|
|
|
|
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/%.dockerfile : $(PROJECTDIR)/build/%.dockerfile | $(OUTDIRS)
|
|
|
|
cp $< $@
|
|
|
|
|
|
|
|
$(OUTDIR)/docker/qemu-arm-static-$(QEMU_VERSION) : $(FETCHDIR)/qemu-arm-static-$(QEMU_VERSION) | $(OUTDIRS)
|
|
|
|
$(SILENT) \
|
|
|
|
$(call echo_if_silent,cp $< $@) \
|
|
|
|
&& cp $< $@ \
|
|
|
|
&& chmod +x $@
|
|
|
|
|
|
|
|
$(OUTDIR)/src/%: $(FETCHDIR)/%.tar.gz | $(OUTDIRS)
|
2019-03-20 23:43:53 +00:00
|
|
|
$(SILENT) \
|
2019-03-23 01:17:44 +00:00
|
|
|
$(call echo_if_silent,tar -C $(dir $@) -xf $<) \
|
|
|
|
&& tar -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)
|
|
|
|
|