Basic Makefile starter

Use this template as a sterter for your Makefile, making sure you intent using tabs as that’s a hard requirement of the make tool.

#-------------------------------------------------------------------------------
# Settings
#-------------------------------------------------------------------------------

# By default the `help` goal is executed.
.DEFAULT_GOAL := help

# Absolute path to the directory of this Makefile.
HERE = $(realpath $(dir $(realpath $(firstword $(MAKEFILE_LIST)))))

#-------------------------------------------------------------------------------
# Goals
#-------------------------------------------------------------------------------

.PHONY: help
help:
	@echo 'Usage: make [<GOAL_1>, ...] [<VARIABLE_1>=value_1, ...]'
	@echo ''
	@echo 'Examples:'
	@echo '  make'
	@echo '  make help'
	@echo ''
	@echo 'Goals:'
	@echo '  - help: Displays this help message.'
	@echo '  - here: Displays the directory where this Makefile is located.'
	@echo ''
	@echo 'Default Goal: help'
	@echo ''

.PHONY: here
here:
	@echo $(HERE)

CI

Create a general ci goal for running things locally with docer and specific lint/* goals for quick execution in pipelines:

#-------------------------------------------------------------------------------
# CI
#-------------------------------------------------------------------------------

DOCKER_HERE := docker run --rm -it -u `id -u`:`id -g` -v "$(PWD)":/here -w /here

.PHONY: ci
ci:
	@$(DOCKER_HERE) sdwolfz/eclint:latest make lint/eclint
	@$(DOCKER_HERE) sdwolfz/hadolint:latest make lint/hadolint
	@$(DOCKER_HERE) sdwolfz/yamllint:latest make lint/yamllint

.PHONY: lint/eclint
lint/eclint:
	@eclint check $(git ls-files)

.PHONY: lint/hadolint
lint/hadolint:
	@find . -name Dockerfile | xargs hadolint

.PHONY: lint/yamllint
lint/yamllint:
	@yamllint .