Skip to content

Commit

Permalink
Remove use of "echo" and "cat" from flags/... generation
Browse files Browse the repository at this point in the history
According to the dune metadata format [1], extra whitespace and newlines
are not significant in a list, so remove the fragile use of "cat" from
flags/ generation, replacing it with a single invocation of "sed".

[1] https://dune.readthedocs.io/en/latest/project-layout-specification.html#metadata-format
  • Loading branch information
mato committed May 16, 2019
1 parent 7904eee commit 0bb2f6f
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -105,18 +105,21 @@ flags/libs.tmp: flags/libs.tmp.in

flags/libs: flags/libs.tmp Makeconf
env PKG_CONFIG_PATH="$(shell opam config var prefix)/lib/pkgconfig" \
pkg-config $(PKG_CONFIG_DEPS) --libs >> flags/libs.tmp
echo "("`cat flags/libs.tmp`")" \
| sed -e 's!@@PKG_CONFIG_EXTRA_LIBS@@!$(PKG_CONFIG_EXTRA_LIBS)!' \
> flags/libs
pkg-config $(PKG_CONFIG_DEPS) --libs >> $<
sed -e '1i (' \
-e 's!@@PKG_CONFIG_EXTRA_LIBS@@!$(PKG_CONFIG_EXTRA_LIBS)!' \
-e '$$a )' \
$< > $@

flags/cflags.tmp: flags/cflags.tmp.in
opam config subst $@

flags/cflags: flags/cflags.tmp Makeconf
env PKG_CONFIG_PATH="$(shell opam config var prefix)/lib/pkgconfig" \
pkg-config $(PKG_CONFIG_DEPS) --cflags >> flags/cflags.tmp
echo "("`cat flags/cflags.tmp`")" > flags/cflags
pkg-config $(PKG_CONFIG_DEPS) --cflags >> $<
sed -e '1i (' \
-e '$$a )' \
$< > $@

install: all
./install.sh
Expand Down

0 comments on commit 0bb2f6f

Please sign in to comment.