Mercurial > hg > beaglert
changeset 331:cfdf0003e6e8 prerelease
Makefile can now do startup and startuploop
author | Giulio Moro <giuliomoro@yahoo.it> |
---|---|
date | Sat, 04 Jun 2016 16:17:06 +0100 |
parents | 276a8517da13 |
children | ccd084cf22ac |
files | Makefile |
diffstat | 1 files changed, 18 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/Makefile Sat Jun 04 15:23:52 2016 +0100 +++ b/Makefile Sat Jun 04 16:17:06 2016 +0100 @@ -26,10 +26,11 @@ $(shell rm -rf $(PROJECT_DIR)) $(shell cp -r examples/$(EXAMPLE) $(PROJECT_DIR)) endif -OUTPUT_FILE=$(PROJECT_DIR)/$(PROJECT) -COMMAND_LINE_OPTIONS=$(CL) -RUN_COMMAND=$(OUTPUT_FILE) $(COMMAND_LINE_OPTIONS) - +OUTPUT_FILE?=$(PROJECT_DIR)/$(PROJECT) +COMMAND_LINE_OPTIONS?=$(CL) +RUN_COMMAND?=$(OUTPUT_FILE) $(COMMAND_LINE_OPTIONS) +BELA_STARTUP_SCRIPT?=/root/BeagleRT_startup.sh +BELA_AUDIO_THREAD_NAME?=beaglert-audio SCREEN_NAME?=BeagleRT #TODO: run these lines only if the command is not syntax or @@ -204,7 +205,19 @@ @screen -S $(SCREEN_NAME) -d -m stdbuf -e 0 -i 0 -o 0 bash -c "$(RUN_COMMAND) &> $(FIFO_NAME)" @cat /tmp/belafifo -BELA_AUDIO_THREAD_NAME=beaglert-audio +STARTUP_COMMAND=printf "\#!/bin/sh\n\#\n\# This file is autogenerated by Bela. Do not edit!\n\necho Running Bela...\nscreen -S $(SCREEN_NAME) -d -m %s $(RUN_COMMAND) %s\n" +nostartup: + @echo "Disabling BeagleRT at startup..." + @printf "#!/bin/sh\n#\n\n# This file is autogenerated by Bela. Do not edit!\n\n# Run on startup disabled -- nothing to do here" > $BELA_STARTUP_SCRIPT + +startuploop: Bela + @echo "Enabling Bela at startup in a loop..." + @$(STARTUP_COMMAND) 'bash -c "while sleep 0.5 ; do echo Running Bela...;' '; done"' > $(BELA_STARTUP_SCRIPT) + +startup: Bela + @echo "Enabling Bela at startup..." + @$(STARTUP_COMMAND) > $(BELA_STARTUP_SCRIPT) + stop: @PID=`grep $(BELA_AUDIO_THREAD_NAME) /proc/xenomai/stat | cut -d " " -f 5 | sed s/\s//g`; if [ -z $$PID ]; then echo "No process to kill"; else echo "Killing old Bela process $$PID"; kill -2 $$PID; fi; screen -X -S $(SCREEN_NAME) quit > /dev/null; exit 0; # Remove only the user-generated objects