Skip to content

Commit

Permalink
ci: clean Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
Mizux committed Sep 3, 2024
1 parent 0a07a89 commit e7e088d
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions ci/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ SHA1 := $(shell git rev-parse --verify HEAD)

# General commands
.PHONY: help
BOLD=\e[1m
RESET=\e[0m
BOLD:=\e[1m
RESET:=\e[0m

help:
@echo -e "${BOLD}SYNOPSIS${RESET}"
Expand Down Expand Up @@ -61,41 +61,45 @@ help:
@echo
@echo -e "\tGlobal targets."
@echo -e "\t${BOLD}clean${RESET}: Remove ALL caches and docker images."
@echo -e "\t${BOLD}clean_<distro>${RESET}: Remove cache and docker images for the specified distro."
@echo -e "\t${BOLD}distclean${RESET}: Remove everything."
@echo
@echo -e "\t${BOLD}NOCACHE=1${RESET}: use 'docker build --no-cache' when building container (default use cache)."
@echo -e "\t${BOLD}VERBOSE=1${RESET}: use 'docker build --progress=plain' when building container."
@echo
@echo -e "branch: $(BRANCH)"
@echo -e "sha1: $(SHA1)"

# Need to add cmd_distro to PHONY otherwise target are ignored since they do not
# contain recipe (using FORCE do not work here)
.PHONY: all
all: build
all: amd64_all_test

# Delete all implicit rules to speed up makefile
MAKEFLAGS += --no-builtin-rules
.SUFFIXES:
# Remove some rules from gmake that .SUFFIXES does not remove.
SUFFIXES =
SUFFIXES :=
# Keep all intermediate files
# ToDo: try to remove it later
.SECONDARY:

# Docker image name prefix.
IMAGE := ${PROJECT}

ifdef NOCACHE
DOCKER_BUILD_CMD := docker build --no-cache
DOCKER_BUILDX_CMD := docker buildx build --no-cache
else
DOCKER_BUILD_CMD := docker build
DOCKER_BUILDX_CMD := docker buildx build
ifdef NOCACHE
DOCKER_BUILD_CMD := ${DOCKER_BUILD_CMD} --no-cache
DOCKER_BUILDX_CMD := ${DOCKER_BUILDX_CMD} --no-cache
endif
ifdef VERBOSE
DOCKER_BUILD_CMD := ${DOCKER_BUILD_CMD} --progress=plain
DOCKER_BUILDX_CMD := ${DOCKER_BUILDX_CMD} --progress=plain
endif
DOCKER_RUN_CMD := docker run --rm --init --net=host

# Currently supported distro
DISTROS = \
DISTROS := \
almalinux \
alpine \
archlinux \
Expand All @@ -111,7 +115,7 @@ DISTROS = \

# ref: https://go.dev/doc/install/source#environment
# ref: https://github.com/containerd/containerd/blob/269548fa27e0089a8b8278fc4fc781d7f65a939b/platforms/platforms.go#L80-L94
PLATFORMS = \
PLATFORMS := \
386 amd64 \
arm arm64 \
mips mipsle mips64 mips64le \
Expand All @@ -122,8 +126,7 @@ PLATFORMS = \
STAGES = env devel build test

define make-platform-stage-target =
#$$(info PLATFORM: $1)
#$$(info STAGE: $2)
#$$(info PLATFORM: '$1' STAGE: '$2')
#$$(info Create targets: $1_all_$2 $(addprefix $1_, $(addsuffix _$2, $(DISTROS))).)
targets_$1_$2 = $(addprefix $1_, $(addsuffix _$2, $(DISTROS)))
.PHONY: $1_all_$2 $$(targets_$1_$2)
Expand Down

0 comments on commit e7e088d

Please sign in to comment.