mirror of
https://github.com/falk-werner/webfuse-provider
synced 2026-03-02 04:09:18 +00:00
fix(webfuse): fix macros (#18)
* fixes return code on error * fixes macro usage * adds clean target * fixes file mode * fixes image name * adds registry prefix to allow usage of custom registry (on-premise) * changes syntax in travis file for package installation * fixes duplicate settings discovery
This commit is contained in:
63
Makefile
63
Makefile
@@ -26,6 +26,7 @@ UID ?= $(shell id -u)
|
||||
|
||||
CONTAINER_USER ?= $(UID)
|
||||
CONTAINER_GROUP ?= $(shell id -g)
|
||||
CONTAINER_CGROUP_PARENT ?=
|
||||
|
||||
HOST_CONTAINER ?= $(shell $(PROJECT_ROOT)/build/get_container_id.sh)
|
||||
HOST_CONTAINER := $(HOST_CONTAINER)
|
||||
@@ -96,15 +97,17 @@ CMAKEFLAGS += '-GNinja'
|
||||
BUILDSILENT := $(if $(BUILDVERBOSE),,1)
|
||||
$(BUILDSILENT)NINJAFLAGS += -v
|
||||
|
||||
DOCKER_RUNFLAGS += --device /dev/fuse --cap-add SYS_ADMIN --security-opt apparmor:unconfined
|
||||
|
||||
DOCKER_RUNFLAGS += --interactive
|
||||
DOCKER_RUNFLAGS += --rm
|
||||
DOCKER_RUNFLAGS += --init
|
||||
DOCKER_RUNFLAGS += --user $(CONTAINER_USER):$(CONTAINER_GROUP)
|
||||
DOCKER_RUNFLAGS += --device /dev/fuse --cap-add SYS_ADMIN --security-opt apparmor:unconfined
|
||||
DOCKER_RUNFLAGS += --env SOURCE_DATE_EPOCH
|
||||
DOCKER_RUNFLAGS += --env BUILDTIME
|
||||
DOCKER_RUNFLAGS += --env NINJA_STATUS
|
||||
DOCKER_RUNFLAGS += $(addprefix --volumes-from ,$(HOST_CONTAINER))
|
||||
DOCKER_RUNFLAGS += $(addprefix --cgroup-parent ,$(CONTAINER_CGROUP_PARENT))
|
||||
|
||||
DOCKER_BUILDARGS += CODENAME=$(CODENAME)
|
||||
DOCKER_BUILDARGS += PARALLELMFLAGS=$(PARALLELMFLAGS)
|
||||
@@ -139,60 +142,60 @@ $(VERBOSE)SILENT := @
|
||||
$(HOST_CONTAINER)container_run_volumes += '$(realpath $(PROJECT_ROOT)):$(CONTAINER_PROJECT_ROOT):cached'
|
||||
$(HOST_CONTAINER)container_run_volumes += '$(realpath $(OUT)/$1):$(CONTAINER_OUT)/$1:delegated'
|
||||
|
||||
container_name = $(REGISTRY_PREFIX)$(subst -,/,$1)/$(PROJECT_NAME):$(VERSION)
|
||||
container_run = $(DOCKER) run $(DOCKER_RUNFLAGS) $3 \
|
||||
$(addprefix --volume ,$(call container_run_volumes,$1)) \
|
||||
--workdir '$(CONTAINER_OUT)/$1' \
|
||||
$(PROJECT_NAME)-$1:$(VERSION) \
|
||||
$(call container_name,$1) \
|
||||
$2
|
||||
|
||||
image_rule = \
|
||||
$$(OUT)/docker/$1: $$(OUT)/docker/$1.dockerfile $$(EXTRACT_TARGETS) $$(PROJECT_ROOT)/Makefile; \
|
||||
$$(call image,$1)
|
||||
image = $(SILENT) \
|
||||
$(call echo_if_silent,docker build $(PROJECT_NAME)-$1:$(VERSION) $(OUT)) \
|
||||
&& $(DOCKER) build $(DOCKER_BUILDFLAGS) --iidfile $@ --file $< --tag $(PROJECT_NAME)-$1:$(VERSION) $(OUT)
|
||||
|
||||
run_rule = \
|
||||
run-$1: $$(OUT)/docker/$1; \
|
||||
$$(call run_recipe,$1,/bin/bash,--tty)
|
||||
run = $(call echo_if_silent,TARGET=$1 $2) && $(call container_run,$1,$2,$3)
|
||||
run_recipe = $(SILENT)-$(call run,$1,$2,$3)
|
||||
$(SILENT)$$(call image,$1)
|
||||
image = \
|
||||
$(call echo_if_silent,docker build $(call container_name,$1) $(OUT)) \
|
||||
&& $(DOCKER) build $(DOCKER_BUILDFLAGS) --iidfile $@ --file $< --tag $(call container_name,$1) $(OUT)
|
||||
|
||||
configure_rule = \
|
||||
$$(OUT)/$1/CMakeCache.txt: $$(PROJECT_ROOT)/CMakeLists.txt $$(OUT)/docker/$1; \
|
||||
$$(call configure,$1)
|
||||
configure = $(SILENT) \
|
||||
$(SILENT)$$(call configure,$1)
|
||||
configure = \
|
||||
$(call run,$1,sh -c 'cmake $(CMAKEFLAGS) $(CONTAINER_PROJECT_ROOT) && $(CONTAINER_PROJECT_ROOT)/build/discover_cc_settings.sh $(notdir $@) $(realpath $(dir $@))') \
|
||||
&& touch $@
|
||||
&& touch $(addprefix $(dir $@)/,include_dirs.txt) $@
|
||||
|
||||
build_rule = \
|
||||
build-$1: $$(OUT)/$1/CMakeCache.txt; \
|
||||
$$(call build,$1)
|
||||
build = $(SILENT)$(call run,$1,ninja $(PARALLELMFLAGS) $(NINJAFLAGS) $(GOALS))
|
||||
$(SILENT)$$(call build,$1)
|
||||
build = $(call run,$1,ninja $(PARALLELMFLAGS) $(NINJAFLAGS) $(GOALS))
|
||||
|
||||
check_rule = \
|
||||
check-$1: build-$1;
|
||||
|
||||
memcheck_rule = \
|
||||
memcheck-$1: build-$1; \
|
||||
$$(call memcheck,$1)
|
||||
memcheck = $(SILENT)$(call run,$1,ctest -T memcheck $(CTESTFLAGS))
|
||||
$(SILENT)$$(call memcheck,$1)
|
||||
memcheck = $(call run,$1,ctest -T memcheck $(CTESTFLAGS))
|
||||
|
||||
run_rule = \
|
||||
run-$1: $$(OUT)/docker/$1; \
|
||||
$(SILENT)$$(call run,$1,/bin/bash,--tty) || true
|
||||
run = $(call echo_if_silent,TARGET=$1 $2) && $(call container_run,$1,$2,$3)
|
||||
|
||||
clean_rule = \
|
||||
clean-$1: ; \
|
||||
$(SILENT)-$$(call clean,$1)
|
||||
clean = rm -rf $(OUT)/$1
|
||||
|
||||
discover_cc_settings_rule = \
|
||||
$$(OUT)/$1/include_dirs.txt: $$(OUT)/$1/CMakeCache.txt; \
|
||||
$$(call discover_cc_settings,$1)
|
||||
discover_cc_settings = $(SILENT) \
|
||||
$(SILENT)$$(call discover_cc_settings,$1)
|
||||
discover_cc_settings = \
|
||||
$(call run,$1,$(CONTAINER_PROJECT_ROOT)/build/discover_cc_settings.sh $(notdir $<) $(realpath $(dir $<)))
|
||||
|
||||
discover_cc_rule = \
|
||||
discover-cc-$1: $$(OUT)/$1/include_dirs.txt; \
|
||||
$$(call discover_cc,$1)
|
||||
discover_cc = $(SILENT)cat $<
|
||||
|
||||
clean_rule = \
|
||||
clean-$1: ; \
|
||||
$$(call clean,$1)
|
||||
clean = $(SILENT)-rm -rf $(OUT)/$1
|
||||
$(SILENT)$$(call discover_cc,$1)
|
||||
discover_cc = cat $<
|
||||
|
||||
# Rules
|
||||
|
||||
@@ -216,11 +219,11 @@ $(RULE_TARGETS): $(PROJECT_ROOT)/Makefile | $(OUT_DIRS)
|
||||
echo; \
|
||||
echo '$(call run_rule,$(TARGET))'; \
|
||||
echo; \
|
||||
echo '$(call clean_rule,$(TARGET))'; \
|
||||
echo; \
|
||||
echo '$(call discover_cc_settings_rule,$(TARGET))'; \
|
||||
echo; \
|
||||
echo '$(call discover_cc_rule,$(TARGET))'; \
|
||||
echo; \
|
||||
echo '$(call clean_rule,$(TARGET))'; \
|
||||
} > $@
|
||||
|
||||
.PHONY: all build-%
|
||||
|
||||
Reference in New Issue
Block a user