From ac8f972e4b26f22b9c0cf2fba63fba21e7f561aa Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= <fidencio@redhat.com>
Date: Tue, 13 Jul 2021 14:16:44 +0200
Subject: [PATCH] build: Add `make vendor`
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Add a top-level `vendor` entry, which will help us when adding the
vendor check as part of the static checks.

Related: #2159

Signed-off-by: Fabiano FidĂȘncio <fidencio@redhat.com>
---
 Makefile |  2 +-
 utils.mk | 10 +++++++---
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/Makefile b/Makefile
index f17597a261..f536c9bcf3 100644
--- a/Makefile
+++ b/Makefile
@@ -15,7 +15,7 @@ TOOLS =
 
 TOOLS += agent-ctl
 
-STANDARD_TARGETS = build check clean install test
+STANDARD_TARGETS = build check clean install test vendor
 
 include utils.mk
 
diff --git a/utils.mk b/utils.mk
index 3ad884fec4..5ee04bf88f 100644
--- a/utils.mk
+++ b/utils.mk
@@ -13,9 +13,9 @@
 # $1 - Directory component lives in.
 # $2 - Name of component.
 #
-# Note: The "clean" rule is the "odd one out" - it only depends on the
-# Makefile. This ensure that running clean won't first try to build the
-# project.
+# Note: The "clean" and "vendor" rules are the "odd one out" - they only
+# depend on the Makefile. This ensure that running them won't first try
+# to build the project.
 
 define make_rules
 $(2) : $(1)/$(2)/Makefile
@@ -25,6 +25,9 @@ build-$(2) : $(2)
 check-$(2) : $(2)
 	make -C $(1)/$(2) check
 
+vendor-$(2) : $(1)/$(2)/Makefile
+	make -C $(1)/$(2) vendor
+
 clean-$(2) : $(1)/$(2)/Makefile
 	make -C $(1)/$(2) clean
 
@@ -39,6 +42,7 @@ test-$(2) : $(2)
     build-$(2) \
     clean-$(2) \
     check-$(2) \
+    vendor-$(2) \
     test-$(2) \
     install-$(2)
 endef