[Kimchi-devel] [PATCH] Use $(wildcard) to list files in Makefile

Aline Manera alinefm at linux.vnet.ibm.com
Fri Feb 21 02:23:49 UTC 2014


From: Aline Manera <alinefm at br.ibm.com>

Instead of listing file by file in Makefile it is better to use a
pattern for it. That way when adding a new file we don't need to change
the Makefile anymore, unless the pattern changes for some reason (new
file extension or so).

Signed-off-by: Aline Manera <alinefm at br.ibm.com>
---
 config/Makefile.am              |    1 -
 plugins/sample/Makefile.am      |    7 +------
 src/kimchi/Makefile.am          |   35 +----------------------------------
 tests/Makefile.am               |   15 +--------------
 ui/js/Makefile.am               |    7 +------
 ui/js/novnc/Makefile.am         |   13 +------------
 ui/libs/Makefile.am             |    7 +------
 ui/libs/themes/base/Makefile.am |    4 +---
 ui/pages/Makefile.am            |   15 +--------------
 ui/pages/help/Makefile.am       |    2 ++
 ui/pages/tabs/Makefile.am       |    8 +-------
 11 files changed, 11 insertions(+), 103 deletions(-)

diff --git a/config/Makefile.am b/config/Makefile.am
index 8c5d364..514ae25 100644
--- a/config/Makefile.am
+++ b/config/Makefile.am
@@ -19,4 +19,3 @@
 # limitations under the License.
 
 SUBDIRS = ui
-#configdir = $(datadir)/kimchi/config
diff --git a/plugins/sample/Makefile.am b/plugins/sample/Makefile.am
index afab703..bb2d926 100644
--- a/plugins/sample/Makefile.am
+++ b/plugins/sample/Makefile.am
@@ -22,9 +22,4 @@
 
 SUBDIRS = ui
 
-EXTRA_DIST = \
-	__init__.py \
-	API.json \
-	model.py \
-	i18n.py \
-	sample.conf
+EXTRA_DIST = API.json sample.conf $(wildcard *.py)
diff --git a/src/kimchi/Makefile.am b/src/kimchi/Makefile.am
index 6adef3c..6a0e100 100644
--- a/src/kimchi/Makefile.am
+++ b/src/kimchi/Makefile.am
@@ -22,40 +22,7 @@
 
 SUBDIRS = control model
 
-kimchi_PYTHON = \
-	__init__.py        \
-	asynctask.py       \
-	auth.py            \
-	basemodel.py	   \
-	cachebust.py       \
-	disks.py           \
-	distroloader.py    \
-	exception.py       \
-	featuretests.py    \
-	i18n.py            \
-	iscsi.py           \
-	isoinfo.py         \
-	mockmodel.py       \
-	netinfo.py         \
-	network.py         \
-	networkxml.py      \
-	objectstore.py     \
-	osinfo.py          \
-	repositories.py	   \
-	rollbackcontext.py \
-	root.py            \
-	scan.py            \
-	screenshot.py      \
-	server.py          \
-	sslcert.py         \
-	swupdate.py        \
-	template.py        \
-	utils.py           \
-	vmtemplate.py      \
-	vnc.py             \
-	websocket.py       \
-	websockify.py      \
-	xmlutils.py
+kimchi_PYTHON = $(filter-out config.py, $(wildcard *.py))
 
 nodist_kimchi_PYTHON = config.py
 
diff --git a/tests/Makefile.am b/tests/Makefile.am
index e8db05c..1c40f5b 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -23,21 +23,8 @@
 EXTRA_DIST = \
 	Makefile.am \
 	run_tests.sh.in \
-	iso_gen.py   \
-	test_authorization.py \
 	test_config.py.in \
-	test_exception.py \
-	test_mockmodel.py \
-	test_model.py \
-	test_networkxml.py \
-	test_osinfo.py \
-	test_plugin.py \
-	test_rest.py \
-	test_rollbackcontext.py \
-	test_server.py \
-	test_storagepool.py \
-	test_vmtemplate.py \
-	utils.py \
+	$(filter-out test_config.py, $(wildcard *.py)) \
 	$(NULL)
 
 noinst_SCRIPTS = run_tests.sh
diff --git a/ui/js/Makefile.am b/ui/js/Makefile.am
index 1468569..ed75ea2 100644
--- a/ui/js/Makefile.am
+++ b/ui/js/Makefile.am
@@ -24,12 +24,7 @@ EXTRA_DIST = src widgets
 
 jsdir = $(datadir)/kimchi/ui/js
 
-dist_js_DATA = \
-	kimchi.min.js \
-	jquery.min.js \
-	jquery-ui.js \
-	modernizr.custom.2.6.2.min.js \
-	$(NULL)
+dist_js_DATA = $(wildcard *.js) $(NULL)
 
 kimchi.min.js: widgets/*.js src/*.js
 	cat $(sort $^) > $@
diff --git a/ui/js/novnc/Makefile.am b/ui/js/novnc/Makefile.am
index 61383f8..b9038d7 100644
--- a/ui/js/novnc/Makefile.am
+++ b/ui/js/novnc/Makefile.am
@@ -22,15 +22,4 @@ SUBDIRS = web-socket-js
 
 jsdir = $(datadir)/kimchi/ui/js/novnc
 
-dist_js_DATA = \
-	base64.js \
-	des.js \
-	display.js \
-	input.js \
-	jsunzip.js \
-	main.js \
-	rfb.js \
-	util.js \
-	websock.js \
-	webutil.js \
-	$(NULL)
+dist_js_DATA = $(wildcard *.js) $(NULL)
diff --git a/ui/libs/Makefile.am b/ui/libs/Makefile.am
index d9bc761..0e99517 100644
--- a/ui/libs/Makefile.am
+++ b/ui/libs/Makefile.am
@@ -22,9 +22,4 @@ SUBDIRS = themes
 
 jsdir = $(datadir)/kimchi/ui/libs
 
-dist_js_DATA = \
-	jquery-1.10.0.min.js \
-	jquery-ui.min.js \
-	jquery-ui-i18n.min.js \
-	modernizr.custom.76777.js \
-	$(NULL)
+dist_js_DATA = $(wildcard *.js) $(NULL)
diff --git a/ui/libs/themes/base/Makefile.am b/ui/libs/themes/base/Makefile.am
index 811b2e6..ccf12e8 100644
--- a/ui/libs/themes/base/Makefile.am
+++ b/ui/libs/themes/base/Makefile.am
@@ -23,6 +23,4 @@ SUBDIRS = images
 
 basedir = $(datadir)/kimchi/ui/libs/themes/base
 
-dist_base_DATA = \
-	jquery-ui.min.css \
-	$(NULL)
+dist_base_DATA = $(wildcard *.css) $(NULL)
diff --git a/ui/pages/Makefile.am b/ui/pages/Makefile.am
index 8d72398..42bbfa0 100644
--- a/ui/pages/Makefile.am
+++ b/ui/pages/Makefile.am
@@ -22,17 +22,4 @@ SUBDIRS = help tabs
 
 htmldir = $(datadir)/kimchi/ui/pages
 
-dist_html_DATA = \
-	error.html.tmpl \
-	kimchi-ui.html.tmpl \
-	guest-add.html.tmpl \
-	guest-edit.html.tmpl \
-	guest.html.tmpl \
-	template-add.html.tmpl \
-	template-edit.html.tmpl \
-	vnc_auto.html.tmpl \
-	i18n.html.tmpl \
-	login-window.html.tmpl \
-	storagepool-add.html.tmpl \
-	report-add.html.tmpl \
-	$(NULL)
+dist_html_DATA = $(wildcard *.html.tmpl) $(NULL)
diff --git a/ui/pages/help/Makefile.am b/ui/pages/help/Makefile.am
index 5146692..cd09995 100644
--- a/ui/pages/help/Makefile.am
+++ b/ui/pages/help/Makefile.am
@@ -25,6 +25,8 @@ helpdir = $(datadir)/kimchi/ui/pages/help
 
 dist_help_DATA = $(HTML_FILES) $(NULL)
 
+EXTRA_DIST = $(wildcard *.dita)
+
 %.html: %.dita $(DITA_XSL_FILE)
 	xsltproc -o $@ $(DITA_XSL_FILE) $<
 	$(shell pwd)/gen-index.py
diff --git a/ui/pages/tabs/Makefile.am b/ui/pages/tabs/Makefile.am
index 163401b..fee2a5e 100644
--- a/ui/pages/tabs/Makefile.am
+++ b/ui/pages/tabs/Makefile.am
@@ -20,10 +20,4 @@
 
 tabshtmldir = $(datadir)/kimchi/ui/pages/tabs
 
-dist_tabshtml_DATA = \
-	guests.html.tmpl \
-	host.html.tmpl \
-	network.html.tmpl \
-	storage.html.tmpl \
-	templates.html.tmpl \
-	$(NULL)
+dist_tabshtml_DATA = $(wildcard *.html.tmpl) $(NULL)
-- 
1.7.10.4




More information about the Kimchi-devel mailing list