From bdc68a7f797cf9a33175cc1510215d609af2afad Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Mon, 29 Oct 2018 18:28:53 +0100 Subject: 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 --- Makefile | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'Makefile') 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 */' >> $@ -- cgit v1.2.3