diff options
author | Teddy Wing | 2018-10-29 18:28:53 +0100 |
---|---|---|
committer | Teddy Wing | 2018-10-29 18:34:18 +0100 |
commit | bdc68a7f797cf9a33175cc1510215d609af2afad (patch) | |
tree | c9df94dfdd4dccf338723e6aa322c4daa67f48f0 /Makefile | |
parent | 1a2d90d94859b9e3b6e150e328dbd4efcd68f569 (diff) | |
download | DomeKey-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-- | Makefile | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -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 */' >> $@ |