From e2bd1784282eeeea707e61746070e202a0af474b Mon Sep 17 00:00:00 2001 From: Allan Blanchard <allan.blanchard@cea.fr> Date: Thu, 27 Oct 2022 17:11:29 +0200 Subject: [PATCH] [lint/headers] fix makefile --- share/Makefile.headers | 20 ++++++++++++++++++-- share/Makefile.linting | 20 ++++++++++++++++++-- 2 files changed, 36 insertions(+), 4 deletions(-) diff --git a/share/Makefile.headers b/share/Makefile.headers index ea3826c56bf..5afbe5a533a 100644 --- a/share/Makefile.headers +++ b/share/Makefile.headers @@ -123,10 +123,10 @@ endif ## HDRCK HDRCK.HAS_GIT:=$(shell git rev-parse --is-inside-work-tree 2> /dev/null) +HDRCK.ENABLED=yes ifneq ($(HDRCK.HAS_GIT),true) ifeq ($(HDRCK_FILES_INPUT),) -$(error "Cannot check or make headers: not a Git repository, \ - you should specify HDRCK_FILES_INPUT") +HDRCK.ENABLED=no endif endif @@ -136,6 +136,8 @@ else HDRCK.COLLECT=cat $(HDRCK_FILES_INPUT) endif +ifeq ($(HDRCK.ENABLED),yes) + .PHONY: check-headers check-headers: $(HDRCK.COLLECT) | $(HDRCK.CMD) $(HDRCK.OPTS) $(HDRCK_EXTRA) @@ -144,6 +146,20 @@ check-headers: headers: $(HDRCK.COLLECT) | $(HDRCK.CMD) -update $(HDRCK.OPTS) $(HDRCK_EXTRA) +else + +.PHONY: check-headers +check-headers: + $(error "Cannot check-headers: not a Git repository, \ + you should specify HDRCK_FILES_INPUT") + +.PHONY: headers +headers: + $(error "Cannot make headers: not a Git repository, \ + you should specify HDRCK_FILES_INPUT") + +endif + ################################# .PHONY: headers.info diff --git a/share/Makefile.linting b/share/Makefile.linting index 7b9ea957390..2384a35f186 100644 --- a/share/Makefile.linting +++ b/share/Makefile.linting @@ -56,10 +56,10 @@ endif ## LINT LINTCK.HAS_GIT:=$(shell git rev-parse --is-inside-work-tree 2> /dev/null) +LINTCK.ENABLED=yes ifneq ($(LINTCK.HAS_GIT),true) ifeq ($(LINTCK_FILES_INPUT),) -$(error "Cannot lint: not a Git repository, \ - you should specify LINTCK_FILES_INPUT") +LINTCK.ENABLED=no endif endif @@ -69,6 +69,8 @@ else LINTCK.COLLECT=cat $(LINTCK_FILES_INPUT) endif +ifeq ($(LINTCK.ENABLED),yes) + .PHONY: lint lint: $(LINTCK.COLLECT) | $(LINTCK.CMD) $(LINTCK_EXTRA) @@ -77,6 +79,20 @@ lint: fix-lint: $(LINTCK.COLLECT) | $(LINTCK.CMD) -u $(LINTCK_EXTRA) +else + +.PHONY: lint +lint: + $(error "Cannot lint: not a Git repository, \ + you should specify LINTCK_FILES_INPUT") + +.PHONY: fix-lint +fix-lint: + $(error "Cannot fix-lint: not a Git repository, \ + you should specify LINTCK_FILES_INPUT") + +endif + ########################################################################## .PHONY: lint.info -- GitLab