# HG changeset patch # User Giulio Moro # Date 1465053426 -3600 # Node ID cfdf0003e6e8e1d196420fdd9dfed0223df48fc9 # Parent 276a8517da13ea27f6343af2f527356118746a0e Makefile can now do startup and startuploop diff -r 276a8517da13 -r cfdf0003e6e8 Makefile --- 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