summaryrefslogtreecommitdiff
path: root/contrib/Makefile.am
blob: a3d2d42b96c6197b762e983c2df25055cc84113a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# enforce that all scripts have a --help and --version option
AUTOMAKE_OPTIONS = std-options

bin_SCRIPTS \
  $(OURSCRIPTS)

OURSCRIPTS \
  bacman \
  paccache \
  pacdiff \
  paclist \
  paclog-pkglist \
  pacscripts \
  pacsearch \
  pacsysclean

OURFILES \
  bash_completion \
  zsh_completion

EXTRA_DIST \
  PKGBUILD.vim \
  bacman.in \
  bash_completion.in \
  paccache.in \
  paclog-pkglist.in \
  pacdiff.in \
  paclist.in \
  pacscripts.in \
  pacsearch.in \
  pacsysclean.in \
  vimprojects \
  zsh_completion.in \
  README

# Files that should be removed, but which Automake does not know.
MOSTLYCLEANFILES $(OURSCRIPTS) $(OURFILES) *.tmp

if USE_GIT_VERSION
GIT_VERSION := $(shell sh -c 'git describe --abbrev=4 --dirty | sed s/^v//')
REAL_PACKAGE_VERSION $(GIT_VERSION)
else
REAL_PACKAGE_VERSION $(PACKAGE_VERSION)
endif

edit = sed \
  -e 's|@sysconfdir[@]|$(sysconfdir)|g' \
  -e 's|@localstatedir[@]|$(localstatedir)|g' \
  -e 's|@PACKAGE_VERSION[@]|$(REAL_PACKAGE_VERSION)|g' \
  -e 's|@SIZECMD[@]|$(SIZECMD)|g' \
  -e '1s|!/bin/bash|!$(BASH_SHELL)|g'

$(OURSCRIPTS): Makefile
  $(AM_V_at)$(RM) $@ $@.tmp
  $(AM_V_GEN)$(edit) $(srcdir)/$@.in >$@.tmp
  $(AM_V_at)chmod +x,a-w $@.tmp
  $(AM_V_at)mv $@.tmp $@

$(OURFILES): Makefile
  $(AM_V_at)$(RM) $@ $@.tmp
  $(AM_V_GEN)$(edit) $(srcdir)/$@.in >$@.tmp
  $(AM_V_at)chmod a-w $@.tmp
  $(AM_V_at)mv $@.tmp $@

all-am: $(OURSCRIPTS) $(OURFILES)

install-data-local:
  $(MKDIR_P) $(DESTDIR)$(sysconfdir)/bash_completion.d/
  $(INSTALL_DATA) bash_completion $(DESTDIR)$(sysconfdir)/bash_completion.d/pacman
  $(MKDIR_P) $(DESTDIR)$(datarootdir)/zsh/site-functions/
  $(INSTALL_DATA) zsh_completion $(DESTDIR)$(datarootdir)/zsh/site-functions/_pacman

uninstall-local:
  $(RM) $(DESTDIR)$(sysconfdir)/bash_completion.d/pacman
  $(RM) $(DESTDIR)$(datarootdir)/zsh/site-functions/_pacman

bacman: $(srcdir)/bacman.in
bash_completion: $(srcdir)/bash_completion.in
paccache: $(srcdir)/paccache.in
pacdiff: $(srcdir)/pacdiff.in
paclist: $(srcdir)/paclist.in
paclog-pkglist: $(srcdir)/paclog-pkglist.in
pacscripts: $(srcdir)/pacscripts.in
pacsearch: $(srcdir)/pacsearch.in
pacsysclean: $(srcdir)/pacsysclean.in
zsh_completion: $(srcdir)/zsh_completion.in

# vim:set ts=2 sw=2 noet: