summaryrefslogtreecommitdiffstats
path: root/scripts/Makefile.am
diff options
context:
space:
mode:
authorAllan McRae <allan@archlinux.org>2011-06-08 15:36:46 +0200
committerDan McGee <dan@archlinux.org>2011-06-15 16:16:38 +0200
commit6f3a2145b0de7f27a1bf5932af3fe0a67171a881 (patch)
tree675413c6ba4b2ecdfc7aea7c6b0c053c6b52f843 /scripts/Makefile.am
parent5f404f2cb78f48ddd90be0334fa2528961b17871 (diff)
downloadpacman-6f3a2145b0de7f27a1bf5932af3fe0a67171a881.tar.gz
pacman-6f3a2145b0de7f27a1bf5932af3fe0a67171a881.tar.xz
makepkg: move option parsing code to separate file
This move the getopt replacement function parse_options out of makepkg.sh.in and into a separate file. The code is inserted into the relevant place in makepkg using m4. This will allow the reuse of the option parsing code in other scripts (i.e. pacman-key) while avoiding code duplication. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'scripts/Makefile.am')
-rw-r--r--scripts/Makefile.am13
1 files changed, 9 insertions, 4 deletions
diff --git a/scripts/Makefile.am b/scripts/Makefile.am
index daa5b2ae..5e8b57c4 100644
--- a/scripts/Makefile.am
+++ b/scripts/Makefile.am
@@ -21,7 +21,11 @@ EXTRA_DIST = \
pacman-optimize.sh.in \
pkgdelta.sh.in \
rankmirrors.sh.in \
- repo-add.sh.in
+ repo-add.sh.in \
+ $(LIBRARY)
+
+LIBRARY = \
+ library/parse_options.sh
# Files that should be removed, but which Automake does not know.
MOSTLYCLEANFILES = $(bin_SCRIPTS) *.tmp
@@ -47,6 +51,7 @@ edit = sed \
-e 's|@SIZECMD[@]|$(SIZECMD)|g' \
-e 's|@SEDINPLACE[@]|$(SEDINPLACE)|g' \
-e 's|@DUPATH[@]|$(DUPATH)|g' \
+ -e 's|@SCRIPTNAME[@]|$@|g' \
-e 's|@configure_input[@]|Generated from $@.sh.in; do not edit by hand.|g'
## All the scripts depend on Makefile so that they are rebuilt when the
@@ -57,14 +62,14 @@ edit = sed \
$(OURSCRIPTS): Makefile
@echo ' ' GEN $@;
@rm -f $@ $@.tmp
- @test -f $(srcdir)/$@.sh.in && $(edit) $(srcdir)/$@.sh.in >$@.tmp || true
- @test -f $(srcdir)/$@.py.in && $(edit) $(srcdir)/$@.py.in >$@.tmp || true
+ @test -f $(srcdir)/$@.sh.in && m4 -P -I $(srcdir) $(srcdir)/$@.sh.in | $(edit) >$@.tmp || true
+ @test -f $(srcdir)/$@.py.in && m4 -P -I $(srcdir) $(srcdir)/$@.py.in | $(edit) >$@.tmp || true
@test -f $@.tmp || false
@chmod +x $@.tmp
@chmod a-w $@.tmp
@mv $@.tmp $@
-makepkg: $(srcdir)/makepkg.sh.in
+makepkg: $(srcdir)/makepkg.sh.in $(srcdir)/library/parse_options.sh
pacman-db-upgrade: $(srcdir)/pacman-db-upgrade.sh.in
pacman-key: $(srcdir)/pacman-key.sh.in
pacman-optimize: $(srcdir)/pacman-optimize.sh.in