autoclean.sh: abide by POSIX shebang
[pacman-ng.git] / scripts / Makefile.am
blob328fbff245795755ebce9b4fc2adf69b2da846de
1 # enforce that all scripts have a --help and --version option
2 AUTOMAKE_OPTIONS = std-options
4 SUBDIRS = po
6 bin_SCRIPTS = \
7         $(OURSCRIPTS)
9 OURSCRIPTS = \
10         makepkg \
11         pacman-db-upgrade \
12         pacman-key \
13         pacman-optimize \
14         pkgdelta \
15         rankmirrors \
16         repo-add
18 EXTRA_DIST = \
19         makepkg.sh.in \
20         pacman-db-upgrade.sh.in \
21         pacman-key.sh.in \
22         pacman-optimize.sh.in \
23         pkgdelta.sh.in \
24         rankmirrors.sh.in \
25         repo-add.sh.in \
26         $(LIBRARY)
28 LIBRARY = \
29         library/output_format.sh \
30         library/parse_options.sh
32 # Files that should be removed, but which Automake does not know.
33 MOSTLYCLEANFILES = $(bin_SCRIPTS)
35 if USE_GIT_VERSION
36 GIT_VERSION := $(shell sh -c 'git describe --abbrev=4 --dirty | sed s/^v//')
37 REAL_PACKAGE_VERSION = $(GIT_VERSION)
38 else
39 REAL_PACKAGE_VERSION = $(PACKAGE_VERSION)
40 endif
42 #### Taken from the autoconf scripts Makefile.am ####
43 edit = sed \
44         -e 's|@localedir[@]|$(localedir)|g' \
45         -e 's|@sysconfdir[@]|$(sysconfdir)|g' \
46         -e 's|@localstatedir[@]|$(localstatedir)|g' \
47         -e 's|@pkgdatadir[@]|$(pkgdatadir)|g' \
48         -e 's|@prefix[@]|$(prefix)|g' \
49         -e '1s|!/bin/bash|!$(BASH_SHELL)|g' \
50         -e 's|@PACKAGE_VERSION[@]|$(REAL_PACKAGE_VERSION)|g' \
51         -e 's|@PACKAGE_BUGREPORT[@]|$(PACKAGE_BUGREPORT)|g' \
52         -e 's|@PACKAGE_NAME[@]|$(PACKAGE_NAME)|g' \
53         -e 's|@BUILDSCRIPT[@]|$(BUILDSCRIPT)|g' \
54         -e 's|@SIZECMD[@]|$(SIZECMD)|g' \
55         -e 's|@SEDINPLACE[@]|$(SEDINPLACE)|g' \
56         -e 's|@DUPATH[@]|$(DUPATH)|g' \
57         -e 's|@SCRIPTNAME[@]|$@|g' \
58         -e 's|@configure_input[@]|Generated from $@.sh.in; do not edit by hand.|g'
60 ## All the scripts depend on Makefile so that they are rebuilt when the
61 ## prefix etc. changes. Use chmod -w to prevent people from editing the
62 ## wrong file by accident.
63 $(OURSCRIPTS): Makefile
64         $(AM_V_at)$(RM) $@
65         $(AM_V_GEN)test -f $(srcdir)/$@.sh.in && m4 -P -I $(srcdir) $(srcdir)/$@.sh.in | $(edit) >$@
66         $(AM_V_at)chmod +x,a-w $@
68 makepkg: \
69         $(srcdir)/makepkg.sh.in \
70         $(srcdir)/library/parse_options.sh
72 pacman-db-upgrade: \
73         $(srcdir)/pacman-db-upgrade.sh.in \
74         $(srcdir)/library/output_format.sh
76 pacman-key: \
77         $(srcdir)/pacman-key.sh.in \
78         $(srcdir)/library/output_format.sh \
79         $(srcdir)/library/parse_options.sh
81 pacman-optimize: \
82         $(srcdir)/pacman-optimize.sh.in \
83         $(srcdir)/library/output_format.sh
85 pkgdelta: \
86         $(srcdir)/pkgdelta.sh.in \
87         $(srcdir)/library/output_format.sh
89 rankmirrors: $(srcdir)/rankmirrors.sh.in
91 repo-add: \
92         $(srcdir)/repo-add.sh.in \
93         $(srcdir)/library/output_format.sh
95 repo-remove: $(srcdir)/repo-add.sh.in
96         $(RM) repo-remove
97         $(LN_S) repo-add repo-remove
99 repo-elephant: $(srcdir)/repo-add.sh.in
100         $(RM) repo-elephant
101         $(LN_S) repo-add repo-elephant
103 install-data-hook:
104         cd $(DESTDIR)$(bindir) && \
105                 $(RM) repo-elephant && \
106                 ( $(LN_S) repo-add repo-elephant || \
107                 ln repo-add repo-elephant || \
108                 cp repo-add repo-elephant )
109         cd $(DESTDIR)$(bindir) && \
110                 $(RM) repo-remove && \
111                 ( $(LN_S) repo-add repo-remove || \
112                 ln repo-add repo-remove || \
113                 cp repo-add repo-remove )
115 uninstall-hook:
116         cd $(DESTDIR)$(bindir) && \
117                 $(RM) repo-remove repo-elephant
119 # vim:set ts=2 sw=2 noet: