Skip to content

Commit

Permalink
build: Do cmake, pc, and profile variable replacements in Makefile
Browse files Browse the repository at this point in the history
Keeps install dirs and corresponding variables better in sync.

Closes #198
  • Loading branch information
scop committed May 6, 2018
1 parent 22e9a02 commit 81ba2c7
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 16 deletions.
17 changes: 9 additions & 8 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,16 @@ cmakeconfigdir = $(datadir)/cmake/$(PACKAGE)/
cmakeconfig_DATA = bash-completion-config.cmake \
bash-completion-config-version.cmake

bash_completion.sh: bash_completion.sh.in Makefile
sed -e 's|@pkgdatadir[@]|$(pkgdatadir)|' <$(srcdir)/$@.in >$@
%: %.in Makefile
sed \
-e 's|@prefix[@]|$(prefix)|' \
-e 's|@compatdir[@]|$(compatdir)|' \
-e 's|@pkgdatadir[@]|$(pkgdatadir)|' \
-e 's|@VERSION[@]|$(VERSION)|' \
<$(srcdir)/$@.in >$@

CLEANFILES = bash_completion.sh bash-completion.pc
CLEANFILES = bash_completion.sh bash-completion.pc \
bash-completion-config.cmake bash-completion-config-version.cmake

EXTRA_DIST = CHANGES $(pkgdata_DATA) bash_completion.sh.in .dir-locals.el \
.editorconfig README.md CONTRIBUTING.md
Expand All @@ -28,9 +34,4 @@ install-data-hook:
sed -e 's|-/etc/bash_completion\.d|-$(compatdir)|' \
$(DESTDIR)$(pkgdatadir)/bash_completion > $$tmpfile && \
cat $$tmpfile > $(DESTDIR)$(pkgdatadir)/bash_completion && \
sed -e 's|\$${prefix}|$(prefix)|' \
$(DESTDIR)$(datadir)/cmake/$(PACKAGE)/bash-completion-config.cmake \
> $$tmpfile && \
cat $$tmpfile > \
$(DESTDIR)$(datadir)/cmake/$(PACKAGE)/bash-completion-config.cmake && \
rm $$tmpfile
4 changes: 2 additions & 2 deletions bash-completion-config.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ set (BASH_COMPLETION_VERSION "@VERSION@")

set (BASH_COMPLETION_PREFIX "@prefix@")
set (BASH_COMPLETION_COMPATDIR "@compatdir@")
set (BASH_COMPLETION_COMPLETIONSDIR "@datarootdir@/@PACKAGE@/completions")
set (BASH_COMPLETION_HELPERSDIR "@datarootdir@/@PACKAGE@/helpers")
set (BASH_COMPLETION_COMPLETIONSDIR "@pkgdatadir@/completions")
set (BASH_COMPLETION_HELPERSDIR "@pkgdatadir@/helpers")

set (BASH_COMPLETION_FOUND "TRUE")
4 changes: 2 additions & 2 deletions bash-completion.pc.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
prefix=@prefix@
compatdir=@compatdir@
completionsdir=@datarootdir@/@PACKAGE@/completions
helpersdir=@datarootdir@/@PACKAGE@/helpers
completionsdir=@pkgdatadir@/completions
helpersdir=@pkgdatadir@/helpers

Name: bash-completion
Description: programmable completion for the bash shell
Expand Down
5 changes: 1 addition & 4 deletions configure.ac
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
AC_PREREQ([2.60])
AC_INIT([bash-completion], [2.8])
AM_INIT_AUTOMAKE([foreign dist-xz no-dist-gzip -Wall -Werror])
AM_INIT_AUTOMAKE([foreign dist-xz no-dist-gzip -Wall -Wno-portability -Werror])
AC_PROG_LN_S
AC_PROG_MKDIR_P
AC_SUBST(compatdir, $sysconfdir/bash_completion.d)
Expand All @@ -10,8 +10,5 @@ completions/Makefile
doc/Makefile
helpers/Makefile
test/Makefile
bash-completion.pc
bash-completion-config.cmake
bash-completion-config-version.cmake
])
AC_OUTPUT

0 comments on commit 81ba2c7

Please sign in to comment.