aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorTeddy Wing2018-10-29 18:28:53 +0100
committerTeddy Wing2018-10-29 18:34:18 +0100
commitbdc68a7f797cf9a33175cc1510215d609af2afad (patch)
treec9df94dfdd4dccf338723e6aa322c4daa67f48f0 /Makefile
parent1a2d90d94859b9e3b6e150e328dbd4efcd68f569 (diff)
downloadDomeKey-bdc68a7f797cf9a33175cc1510215d609af2afad.tar.bz2
Add `sounds.h`, C array versions of sound files
This enables us to compile the sound files into our binary. Makefile: Add a target to build the `sounds.h` file, by running `xxd -i` on both sound files. Thanks to Matteo Italia (https://stackoverflow.com/users/214671/matteo-italia) on Stack Overflow for describing how to use `xxd -i` to create a C array from a binary file: https://stackoverflow.com/questions/8707183/script-tool-to-convert-file-to-c-c-source-code-array/8707241#8707241 An to John Marshall (https://stackoverflow.com/users/280577/john-marshall) on Stack Overflow for showing me the Make `foreach` function: https://stackoverflow.com/questions/7918511/make-execute-an-action-for-each-prerequisite/7921168#7921168
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile9
1 files changed, 9 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index cc62af2..0955ce3 100644
--- a/Makefile
+++ b/Makefile
@@ -28,3 +28,12 @@ clean:
.PHONY: run
run: build
$(DEBUG_PRODUCT) --daemon
+
+DomeKey/sounds.h: sounds/*.mp3
+ : > $@
+ echo '#ifndef SOUNDS_H' >> $@
+ echo '#define SOUNDS_H' >> $@
+ echo >> $@
+ $(foreach f,$^,xxd -include $(f) >> $@;)
+ echo >> $@
+ echo '#endif /* SOUNDS_H */' >> $@