aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorMitch Riedstra <mitch@riedstra.us>2018-03-09 01:38:22 -0500
committerMitch Riedstra <mitch@riedstra.us>2018-03-09 01:44:31 -0500
commit263a4c6409add73550c561b7c84ea5410b4173a0 (patch)
tree0bd5050aa379c106fb3152bf5ab6f5c47100492e /Makefile
parentfdb56b003c9e0a00ded2878b0c174a7780bb39b2 (diff)
downloadvis-263a4c6409add73550c561b7c84ea5410b4173a0.tar.gz
vis-263a4c6409add73550c561b7c84ea5410b4173a0.tar.xz
Added OS check in target 'vis-single-payloud.inc'
Reading through the Github issues, it sounds as if this was meant for Linux and the if statement reflects that. If that's not the case it can be changed. FreeBSD's `od` has a different format compared to the GNU Coreutils version. The output format is also a little bit different. For some reason both `sed` and `gsed` on FreeBSD can't find the end of file if commands have been previously passed with `-e` so I pipe from sed into sed again. Added `-f -` to both tar commands to make it obvious as to where the output is going.
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile24
1 files changed, 21 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index 2026c24..51eb407 100644
--- a/Makefile
+++ b/Makefile
@@ -72,9 +72,27 @@ vis-single-payload.inc: $(EXECUTABLES) lua/*
echo '#ifndef VIS_SINGLE_PAYLOAD_H' > $@
echo '#define VIS_SINGLE_PAYLOAD_H' >> $@
echo 'static unsigned char vis_single_payload[] = {' >> $@
- tar --mtime='2014-07-15 01:23Z' --owner=0 --group=0 --numeric-owner --mode='a+rX-w' -c \
- $(EXECUTABLES) $$(find lua -name '*.lua' | LC_ALL=C sort) | xz -T 1 | \
- od -t x1 -A none -v | sed 's/\([0-9a-f]\+\)/0x\1,/g;$$s/,$$/ };/' >> $@
+ if [ "$$(uname)" = "Linux" ] ; then \
+ tar --mtime='2014-07-15 01:23Z' --owner=0 --group=0 --numeric-owner \
+ --mode='a+rX-w' \
+ -c $(EXECUTABLES) $$(find lua -name '*.lua' | LC_ALL=C sort) \
+ -f - \
+ | xz -T 1 \
+ | od -t x1 -A none -v \
+ | sed 's/\([0-9a-f]\+\)/0x\1,/g;$$s/,$$/ };/' >> $@ ; \
+ elif [ "$$(uname)" = "FreeBSD" ] ; then \
+ gtar --mtime='2014-07-15 01:23Z' --owner=0 --group=0 \
+ --numeric-owner --mode='a+rX-w' \
+ -c $(EXECUTABLES) $$(find lua -name '*.lua' | LC_ALL=C sort) \
+ -f - \
+ | xz -T 1 \
+ | od -t x1 -v \
+ | sed -Ee's/^[0-9a-fA-F]+//' \
+ -e's/([0-9a-f]+)/0x\1,/g' \
+ -e'/^[ ]*$$/d' \
+ | sed -Ee'$$ s/,[^0-9a-f]*$$/ };/' \
+ >> $@ ;\
+ fi
echo '#endif' >> $@
vis-single: vis-single.c vis-single-payload.inc