aboutsummaryrefslogtreecommitdiff
path: root/board/Makefile
diff options
context:
space:
mode:
authorNicholas Tay <nick@windblume.net>2022-05-10 00:40:10 +1000
committerNicholas Tay <nick@windblume.net>2022-05-10 00:47:38 +1000
commit6a1e6a7d6b6a3d987f2fccb3c06f4f5da071f504 (patch)
tree3899a31897c01323fb5d896b08412aa45e939885 /board/Makefile
parent5270088f730a7e30155a642dcd5c4e9a80055d7a (diff)
downloadclak-6a1e6a7d6b6a3d987f2fccb3c06f4f5da071f504.tar.gz
clak-6a1e6a7d6b6a3d987f2fccb3c06f4f5da071f504.tar.bz2
clak-6a1e6a7d6b6a3d987f2fccb3c06f4f5da071f504.zip
Dynamic load boards as DLL (windows only for now)
The .h files are pretty weird, should look at other C projects to see how they load plugins. This function pointer business with typedefs is kinda weird, not sure where they should live.
Diffstat (limited to 'board/Makefile')
-rw-r--r--board/Makefile32
1 files changed, 32 insertions, 0 deletions
diff --git a/board/Makefile b/board/Makefile
new file mode 100644
index 0000000..24cb10c
--- /dev/null
+++ b/board/Makefile
@@ -0,0 +1,32 @@
+BOARDS = mxblue quack
+
+CC = gcc
+CFLAGS += -std=c99 -Wall -Wextra -Wshadow -Werror -pedantic -shared
+
+ifeq ($(OS),Windows_NT)
+ OUTEXT = dll
+else
+ OUTEXT = so
+endif
+
+default: all
+all: $(BOARDS)
+
+# TODO: use "BOARDS" variable to generate this.
+# TODO: have some preset for 'simple' board type? also in the c file.
+mxblue: mxblue.$(OUTEXT)
+quack: quack.$(OUTEXT)
+mxblue.$(OUTEXT): mxblue/board.c mxblue/sound.h
+ $(CC) $(CFLAGS) mxblue/board.c -o mxblue.$(OUTEXT)
+quack.$(OUTEXT): quack/board.c quack/sound.h
+ $(CC) $(CFLAGS) quack/board.c -o quack.$(OUTEXT)
+mxblue/sound.h:
+ xxd -i mxblue/board_down.wav mxblue/sound.h
+quack/sound.h:
+ xxd -i quack/board_down.wav quack/sound.h
+
+clean:
+ rm -f *.o
+ rm -f *.dll
+ rm -f *.so
+ rm -f */sound.h \ No newline at end of file