From 5cf5eced1ac522fdf875fb17b2f0d26487e08f83 Mon Sep 17 00:00:00 2001 From: Matthijs Kooijman Date: Fri, 19 Mar 2010 21:39:59 +0100 Subject: [PATCH] Simplify some makefiles. By using static pattern rules, a lot of repetitive rules can be removed. --- handlers/Makefile.am | 79 ++------------------------------------------ lib/Makefile.am | 20 +++-------- src/Makefile.am | 14 +++----- 3 files changed, 11 insertions(+), 102 deletions(-) diff --git a/handlers/Makefile.am b/handlers/Makefile.am index eaf4b9e..7c847d3 100644 --- a/handlers/Makefile.am +++ b/handlers/Makefile.am @@ -14,79 +14,6 @@ edit = sed \ dist_pkgdata_DATA = $(HANDLERS) -dup: $(srcdir)/dup.in - rm -f dup - $(edit) $(srcdir)/dup.in > dup - -dup.helper: $(srcdir)/dup.helper.in - rm -f dup.helper - $(edit) $(srcdir)/dup.helper.in > dup.helper - -ldap: $(srcdir)/ldap.in - rm -f ldap - $(edit) $(srcdir)/ldap.in > ldap - -ldap.helper: $(srcdir)/ldap.helper.in - rm -f ldap.helper - $(edit) $(srcdir)/ldap.helper.in > ldap.helper - -maildir: $(srcdir)/maildir.in - rm -f maildir - $(edit) $(srcdir)/maildir.in > maildir - -makecd: $(srcdir)/makecd.in - rm -f makecd - $(edit) $(srcdir)/makecd.in > makecd - -makecd.helper: $(srcdir)/makecd.helper.in - rm -f makecd.helper - $(edit) $(srcdir)/makecd.helper.in > makecd.helper - -mysql: $(srcdir)/mysql.in - rm -f mysql - $(edit) $(srcdir)/mysql.in > mysql - -mysql.helper: $(srcdir)/mysql.helper.in - rm -f mysql.helper - $(edit) $(srcdir)/mysql.helper.in > mysql.helper - -pgsql: $(srcdir)/pgsql.in - rm -f pgsql - $(edit) $(srcdir)/pgsql.in > pgsql - -pgsql.helper: $(srcdir)/pgsql.helper.in - rm -f pgsql.helper - $(edit) $(srcdir)/pgsql.helper.in > pgsql.helper - -rdiff: $(srcdir)/rdiff.in - rm -f rdiff - $(edit) $(srcdir)/rdiff.in > rdiff - -rdiff.helper: $(srcdir)/rdiff.helper.in - rm -f rdiff.helper - $(edit) $(srcdir)/rdiff.helper.in > rdiff.helper - -rsync: $(srcdir)/rsync.in - rm -f rsync - $(edit) $(srcdir)/rsync.in > rsync - -sh: $(srcdir)/sh.in - rm -f sh - $(edit) $(srcdir)/sh.in > sh - -svn: $(srcdir)/svn.in - rm -f svn - $(edit) $(srcdir)/svn.in > svn - -sys: $(srcdir)/sys.in - rm -f sys - $(edit) $(srcdir)/sys.in > sys - -sys.helper: $(srcdir)/sys.helper.in - rm -f sys.helper - $(edit) $(srcdir)/sys.helper.in > sys.helper - -trac: $(srcdir)/trac.in - rm -f trac - $(edit) $(srcdir)/trac.in > trac - +$(HANDLERS): %: $(srcdir)/%.in + rm -f $@ + $(edit) $@.in > $@ diff --git a/lib/Makefile.am b/lib/Makefile.am index 11eba37..a8926ff 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -2,7 +2,7 @@ pkglib_SCRIPTS = easydialog parseini tools vserver CLEANFILES = $(pkglib_SCRIPTS) -EXTRA_DIST = easydialog.in parseini.in tools.in vserver.in +EXTRA_DIST = $(pkglib_SCRIPTS:%=%.in) edit = sed \ -e "s,@CFGDIR\@,$(CFGDIR),g" \ @@ -12,18 +12,6 @@ edit = sed \ -e "s,@MKTEMP\@,$(MKTEMP),g" \ -e "s,@libdir\@,$(pkglibdir),g" -easydialog: $(srcdir)/easydialog.in - rm -f easydialog - $(edit) easydialog.in > easydialog - -parseini: $(srcdir)/parseini.in - rm -f parseini - $(edit) parseini.in > parseini - -tools: $(srcdir)/tools.in - rm -f tools - $(edit) tools.in > tools - -vserver: $(srcdir)/vserver.in - rm -f vserver - $(edit) vserver.in > vserver +$(pkglib_SCRIPTS): %: $(srcdir)/%.in + rm -f $@ + $(edit) $@.in > $@ diff --git a/src/Makefile.am b/src/Makefile.am index 5694e9a..9d71734 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -4,7 +4,7 @@ sbin_SCRIPTS = backupninja ninjahelper # a proto je taky musíme smazat ... CLEANFILES = $(sbin_SCRIPTS) -EXTRA_DIST = backupninja.in ninjahelper.in ninjareport.in +EXTRA_DIST = $(sbin_SCRIPTS:%=%.in) ninjareport.in edit = sed \ -e "s,@CFGDIR\@,$(CFGDIR),g" \ @@ -19,15 +19,9 @@ edit = sed \ #install-exec-hook: -backupninja: $(srcdir)/backupninja.in - rm -f backupninja - $(edit) $(srcdir)/backupninja.in > backupninja - chmod ugo+x backupninja - -ninjahelper: $(srcdir)/ninjahelper.in - rm -f ninjahelper - $(edit) $(srcdir)/ninjahelper.in > ninjahelper - chmod ugo+x ninjahelper +$(sbin_SCRIPTS): %: $(srcdir)/%.in + rm -f $@ + $(edit) $@.in > $@ ninjareport: $(srcdir)/ninjareport.in rm -f ninjareport -- 2.30.2