aboutsummaryrefslogtreecommitdiff
path: root/make
diff options
context:
space:
mode:
authorSelene ToyKeeper2023-11-03 08:40:42 -0600
committerSelene ToyKeeper2023-11-03 08:40:42 -0600
commit82013a73328ca6e2901d58661e37ccc9b5fe4aac (patch)
treecb91185a9952e5daac49b66607e95f739e9ea94e /make
parentrenamed cfg.h -> anduril.h inside source files (diff)
downloadanduril-82013a73328ca6e2901d58661e37ccc9b5fe4aac.tar.gz
anduril-82013a73328ca6e2901d58661e37ccc9b5fe4aac.tar.bz2
anduril-82013a73328ca6e2901d58661e37ccc9b5fe4aac.zip
fixed compile scripts and added a "./make" wrapper for convenience
(instead of a Makefile, which isn't really needed for this project)
Diffstat (limited to '')
-rwxr-xr-xmake79
1 files changed, 79 insertions, 0 deletions
diff --git a/make b/make
new file mode 100755
index 0000000..79a6d96
--- /dev/null
+++ b/make
@@ -0,0 +1,79 @@
+#!/bin/bash
+# Anduril / FSM "make" script
+# Copyright (C) 2023 Selene ToyKeeper
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+# replaces system "make" command,
+# because this project doesn't need make's features;
+# it just needs a little wrapper script for common tasks
+
+# enable "**" for recursive glob (requires bash)
+shopt -s globstar
+
+# figure out which operation was requested
+MODE="$1"
+
+function help() {
+ cat << ENDOFHELP
+Anduril make: a build helper tool for Anduril flashlight firmware
+Usage: ./make TASK
+... where TASK is:
+
+ help Show this help text
+ (nothing) Compile all build targets
+ flash FILE Flash firmare FILE to a hardware device
+ clean Delete generated files
+ todo Show tasks noted in source code files
+ models Generate the MODELS file
+ release Zip up all .hex files to prep for publishing a release
+
+... or TASK can be the partial name of a build target.
+
+Examples:
+
+ # get rid of old clutter files
+ ./make clean
+ # compile all anduril build targets
+ ./make anduril
+ # compile all builds matching "emisar" AND "nofet"
+ ./make emisar nofet
+ # compile all builds matching "q8" (i.e. Sofirn BLF Q8)
+ ./make q8
+ # Flash the Q8 firmware built in the previous command
+ # (copy/paste the file path printed by the build script)
+ ./make flash hex/sofirn-blf-q8.hex
+ENDOFHELP
+}
+
+# sub-command parser / dispatcher
+function main() {
+ case "$MODE" in
+ -h|--help|help|/?|/h|/help)
+ help
+ ;;
+ clean)
+ echo 'rm -vf **/*.hex **/*~ **/*.elf **/*.o'
+ rm -vf **/*.hex **/*~ **/*.elf **/*.o
+ ;;
+ flash)
+ echo "Not implemented yet."
+ #./bin/flash.sh "$@"
+ ;;
+ models)
+ ./bin/models.py > MODELS
+ cat MODELS
+ ;;
+ release)
+ echo "Not implemented yet."
+ ;;
+ todo)
+ grep -E 'TODO:|FIXME:' **/*.[ch]
+ ;;
+ *)
+ ./bin/build-all.sh "$@"
+ ;;
+ esac
+}
+
+main "$@"
+