comparison Makefile @ 393:814e85de67e1 prerelease

IDE can be started and set/unset startup from the Makefile
author Giulio Moro <giuliomoro@yahoo.it>
date Tue, 14 Jun 2016 16:26:34 +0100
parents e4510c9eee94
children b6b13f669174
comparison
equal deleted inserted replaced
386:e4510c9eee94 393:814e85de67e1
6 # This Makefile is intended for use on the BeagleBone Black itself 6 # This Makefile is intended for use on the BeagleBone Black itself
7 # and not for cross-compiling 7 # and not for cross-compiling
8 8
9 .DEFAULT_GOAL := Bela 9 .DEFAULT_GOAL := Bela
10 10
11 NO_PROJECT_TARGETS=coreclean distclean stop help 11 NO_PROJECT_TARGETS=coreclean distclean stop help iderun idestop iderunup idenostartup
12 NO_PROJECT_TARGETS_MESSAGE=PROJECT or EXAMPLE should be set for all targets except: $(NO_PROJECT_TARGETS) 12 NO_PROJECT_TARGETS_MESSAGE=PROJECT or EXAMPLE should be set for all targets except: $(NO_PROJECT_TARGETS)
13 # Type `$ make help` to get a description of the functionalities of this Makefile. 13 # Type `$ make help` to get a description of the functionalities of this Makefile.
14 help: ## Show this help 14 help: ## Show this help
15 @echo 'Usage: make [target] CL=[command line options] [PROJECT=[projectName] | EXAMPLE=[exampleName]]' 15 @echo 'Usage: make [target] CL=[command line options] [PROJECT=[projectName] | EXAMPLE=[exampleName]]'
16 @printf "\n$(NO_PROJECT_TARGETS_MESSAGE)\n\n" 16 @printf "\n$(NO_PROJECT_TARGETS_MESSAGE)\n\n"
37 else 37 else
38 PROJECT_DIR := $(abspath projects/$(PROJECT)) 38 PROJECT_DIR := $(abspath projects/$(PROJECT))
39 endif 39 endif
40 40
41 ifdef PROJECT 41 ifdef PROJECT
42 $(shell mkdir -p $(PROJECT_DIR)/build) 42 $(shell mkdir -p $(PROJECT_DIR)/build build/core)
43 endif 43 endif
44 44
45 OUTPUT_FILE?=$(PROJECT_DIR)/$(PROJECT) 45 OUTPUT_FILE?=$(PROJECT_DIR)/$(PROJECT)
46 COMMAND_LINE_OPTIONS?=$(CL) 46 COMMAND_LINE_OPTIONS?=$(CL)
47 RUN_COMMAND?=$(OUTPUT_FILE) $(COMMAND_LINE_OPTIONS) 47 RUN_COMMAND?=$(OUTPUT_FILE) $(COMMAND_LINE_OPTIONS)
48 BELA_STARTUP_SCRIPT?=/root/BeagleRT_startup.sh 48 BELA_STARTUP_SCRIPT?=/root/BeagleRT_startup.sh
49 BELA_AUDIO_THREAD_NAME?=bela-audio 49 BELA_AUDIO_THREAD_NAME?=bela-audio
50 SCREEN_NAME?=Bela 50 SCREEN_NAME?=Bela
51 51 BELA_IDE_STARTUP_SCRIPT?=/root/BeagleRT_node.sh
52 BELA_IDE_HOME?=/root/Bela/IDE
53 BELA_IDE_SCREEN_NAME?=Bela-IDE
54 BELA_IDE_RUN_COMMAND?=cd $(BELA_IDE_HOME) && screen -S $(BELA_IDE_SCREEN_NAME) -d -m node index.js
55 BELA_IDE_STOP_COMMAND?=screen -X -S $(BELA_IDE_SCREEN_NAME) quit > /dev/null
52 56
53 RM := rm -rf 57 RM := rm -rf
54 STATIC_LIBS := ./libprussdrv.a ./libNE10.a 58 STATIC_LIBS := ./libprussdrv.a ./libNE10.a
55 LIBS := -lrt -lnative -lxenomai -lsndfile 59 LIBS := -lrt -lnative -lxenomai -lsndfile
56 60
255 @echo "Enabling Bela at startup..." 259 @echo "Enabling Bela at startup..."
256 @$(STARTUP_COMMAND) > $(BELA_STARTUP_SCRIPT) 260 @$(STARTUP_COMMAND) > $(BELA_STARTUP_SCRIPT)
257 261
258 stop: ## Stops any Bela program that is currently running 262 stop: ## Stops any Bela program that is currently running
259 stop: 263 stop:
260 @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; 264 # @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;
261 265 @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"; fi; screen -X -S $(SCREEN_NAME) quit > /dev/null; exit 0;
262 .PHONY: all clean distclean help projectclean nostartup startup startuploop debug run runfg runscreen runscreenfg runscreenfifo stop 266
267 iderun: ## Starts the on-board IDE
268 iderun:
269 $(BELA_IDE_RUN_COMMAND)
270
271 idestop: ## Stops the on-board IDE
272 @echo TODO
273 @exit 1
274
275 BELA_IDE_STARTUP_COMMAND=printf "\#!/bin/sh\n\#\n\# This file is autogenerated by Bela. Do not edit!\n\necho Running the Bela IDE...\n$(BELA_IDE_RUN_COMMAND)\n" > $(BELA_IDE_STARTUP_SCRIPT)
276
277 iderunup: ## Enables the IDE at startup
278 @echo "Enabling the IDE at startup"
279 $(BELA_IDE_STARTUP_COMMAND)
280 @chmod +x $(BELA_IDE_STARTUP_SCRIPT)
281
282 idenostartup: ## Disables the IDE at startup
283 @echo "Disabling the IDE at startup"
284 @printf "#!/bin/sh\n#\n\n# This file is autogenerated by Bela. Do not edit!\n\n# The Bela IDE is disabled on startup.\n" > $(BELA_IDE_STARTUP_SCRIPT)
285 .PHONY: all clean distclean help projectclean nostartup startup startuploop debug run runfg runscreen runscreenfg runscreenfifo stop iderun idestop iderunup idenostartup