From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-859266-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	by finch.gentoo.org (Postfix) with ESMTP id 7532E58975
	for <garchives@archives.gentoo.org>; Sat, 23 Jan 2016 21:28:45 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id 5BD28E0871;
	Sat, 23 Jan 2016 21:28:44 +0000 (UTC)
Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183])
	(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id DC37021C00C
	for <gentoo-commits@lists.gentoo.org>; Sat, 23 Jan 2016 21:28:43 +0000 (UTC)
Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84])
	(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id 0DD04340AA7
	for <gentoo-commits@lists.gentoo.org>; Sat, 23 Jan 2016 21:28:43 +0000 (UTC)
Received: from localhost.localdomain (localhost [127.0.0.1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id A54511021
	for <gentoo-commits@lists.gentoo.org>; Sat, 23 Jan 2016 21:28:40 +0000 (UTC)
From: "Robin H. Johnson" <robbat2@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Content-Transfer-Encoding: 8bit
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "Robin H. Johnson" <robbat2@gentoo.org>
Message-ID: <1453583134.164fcba61cc8cc4458e74f21bcfd97ef2f3aa815.robbat2@gentoo>
Subject: [gentoo-commits] proj/genkernel:master commit in: /
X-VCS-Repository: proj/genkernel
X-VCS-Files: Makefile
X-VCS-Directories: /
X-VCS-Committer: robbat2
X-VCS-Committer-Name: Robin H. Johnson
X-VCS-Revision: 164fcba61cc8cc4458e74f21bcfd97ef2f3aa815
X-VCS-Branch: master
Date: Sat, 23 Jan 2016 21:28:40 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
X-Archives-Salt: b0f27d40-ad71-46d5-b845-c0bfb2a7948e
X-Archives-Hash: 73a80cb299b9ef0512530e10617644b4

commit:     164fcba61cc8cc4458e74f21bcfd97ef2f3aa815
Author:     Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
AuthorDate: Sat Jan 23 20:33:38 2016 +0000
Commit:     Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
CommitDate: Sat Jan 23 21:05:34 2016 +0000
URL:        https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=164fcba6

Makefile: Fix kernel config building, ensure targets are always updated properly as well.

Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org>

 Makefile | 34 ++++++++++++++++++++++++----------
 1 file changed, 24 insertions(+), 10 deletions(-)

diff --git a/Makefile b/Makefile
index 7f79e4f..421a071 100644
--- a/Makefile
+++ b/Makefile
@@ -1,18 +1,24 @@
 PACKAGE_VERSION = `/bin/fgrep GK_V= genkernel | sed "s/.*GK_V='\([^']\+\)'/\1/"`
 distdir = genkernel-$(PACKAGE_VERSION)
-KCONF = $(shell ls arch/*/arch-config | sed 's/arch-/generated-/g')
-
+MANPAGE = genkernel.8
 # Add off-Git/generated files here that need to be shipped with releases
-EXTRA_DIST = genkernel.8 ChangeLog $(KCONF)
+EXTRA_DIST = $(MANPAGE) ChangeLog $(KCONF)
 
-default: $(KCONF) genkernel.8
+default: kconfig man
 
-$(KCONF):
-	perl merge.pl defaults/kernel-generic-config $(dir $@)arch-config > $@
+# First argument in the override file
+# Second argument is the base file
+BASE_KCONF = defaults/kernel-generic-config
+ARCH_KCONF = $(wildcard arch/*/arch-config)
+GENERATED_KCONF = $(subst arch-,generated-,$(ARCH_KCONF))
+KCONF = $(GENERATED_KCONF)
 
-genkernel.8: doc/genkernel.8.txt doc/asciidoc.conf Makefile genkernel
-	a2x --conf-file=doc/asciidoc.conf --attribute="genkernelversion=$(PACKAGE_VERSION)" \
-		 --format=manpage -D . "$<"
+debug:
+	@echo "ARCH_KCONF=$(ARCH_KCONF)"
+	@echo "GENERATED_KCONF=$(GENERATED_KCONF)"
+
+kconfig: $(GENERATED_KCONF)
+man: $(MANPAGE)
 
 ChangeLog:
 	git log >$@
@@ -35,4 +41,12 @@ dist: check-git-repository distclean $(EXTRA_DIST)
 distclean: clean
 	rm -Rf "$(distdir)" "$(distdir)".tar "$(distdir)".tar.xz
 
-.PHONY: clean check-git-repository dist distclean
+.PHONY: clean check-git-repository dist distclean kconfig
+
+# Generic rules
+%/generated-config: %/arch-config $(BASE_KCONF) merge.pl Makefile
+	perl merge.pl $^ $(BASE_KCONF) > $@
+
+%.8: doc/%.8.txt doc/asciidoc.conf Makefile genkernel
+	a2x --conf-file=doc/asciidoc.conf --attribute="genkernelversion=$(PACKAGE_VERSION)" \
+		 --format=manpage -D . "$<"