comparison Makefile @ 424:9614e2f4b76e prerelease

Makefile now supports a QUIET flag which silences some of the outputs (currently only the one from STOP). QUIET is enabled by default for runide (or any of the QUIET_TARGETS). Added target for stop to runide
author Giulio Moro <giuliomoro@yahoo.it>
date Thu, 16 Jun 2016 14:34:18 +0100
parents 9182fa7e802a
children 4c2588930b0a
comparison
equal deleted inserted replaced
423:9182fa7e802a 424:9614e2f4b76e
8 8
9 .DEFAULT_GOAL := Bela 9 .DEFAULT_GOAL := Bela
10 10
11 NO_PROJECT_TARGETS=help coreclean distclean stop nostartup idestart idestop idestartup idenostartup connect ideconnect 11 NO_PROJECT_TARGETS=help coreclean distclean stop nostartup idestart idestop idestartup idenostartup connect ideconnect
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 # list of targets that automatically activate the QUIET=true flag
14 QUIET_TARGETS=runide
15
13 # Type `$ make help` to get a description of the functionalities of this Makefile. 16 # Type `$ make help` to get a description of the functionalities of this Makefile.
14 help: ## Show this help 17 help: ## Show this help
15 @echo 'Usage: make [target] CL=[command line options] [PROJECT=[projectName] | EXAMPLE=[exampleName]]' 18 @echo 'Usage: make [target] CL=[command line options] [PROJECT=[projectName] | EXAMPLE=[exampleName]]'
16 @printf "\n$(NO_PROJECT_TARGETS_MESSAGE)\n\n" 19 @printf "\n$(NO_PROJECT_TARGETS_MESSAGE)\n\n"
17 @echo 'Targets: (default: $(.DEFAULT_GOAL))' 20 @echo 'Targets: (default: $(.DEFAULT_GOAL))'
55 # A bug in this version of screen forces us to use two screen names which beginning substrings do not match (Bela, Bela-IDE would cause problems) 58 # A bug in this version of screen forces us to use two screen names which beginning substrings do not match (Bela, Bela-IDE would cause problems)
56 BELA_IDE_SCREEN_NAME?=IDE-Bela 59 BELA_IDE_SCREEN_NAME?=IDE-Bela
57 BELA_IDE_RUN_COMMAND?=cd $(BELA_IDE_HOME) && screen -S $(BELA_IDE_SCREEN_NAME) -d -m /usr/local/bin/node index.js 60 BELA_IDE_RUN_COMMAND?=cd $(BELA_IDE_HOME) && screen -S $(BELA_IDE_SCREEN_NAME) -d -m /usr/local/bin/node index.js
58 BELA_IDE_STOP_COMMAND?=screen -X -S $(BELA_IDE_SCREEN_NAME) quit > /dev/null 61 BELA_IDE_STOP_COMMAND?=screen -X -S $(BELA_IDE_SCREEN_NAME) quit > /dev/null
59 62
63 ifneq (,$(filter $(QUIET_TARGETS),$(MAKECMDGOALS)))
64 QUIET=true
65 endif
66 QUIET?=false
67
60 RM := rm -rf 68 RM := rm -rf
61 STATIC_LIBS := ./libprussdrv.a ./libNE10.a 69 STATIC_LIBS := ./libprussdrv.a ./libNE10.a
62 LIBS := -lrt -lnative -lxenomai -lsndfile 70 LIBS := -lrt -lnative -lxenomai -lsndfile
63 71
64 # refresh library cache and check if libpd is there 72 # refresh library cache and check if libpd is there
226 runfg: run 234 runfg: run
227 run: ## Run PROJECT in the foreground 235 run: ## Run PROJECT in the foreground
228 run: stop Bela 236 run: stop Bela
229 @echo "Running $(RUN_COMMAND)" 237 @echo "Running $(RUN_COMMAND)"
230 @sync& cd $(PROJECT_DIR) && $(RUN_COMMAND) 238 @sync& cd $(PROJECT_DIR) && $(RUN_COMMAND)
231 runide: ## Run PROJECT for IDE (foreground, without stop or build, suppressed output, no buffering) 239 runide: ## Run PROJECT for IDE (foreground, no buffering)
232 runide: Bela 240 runide: stop Bela
233 @sync& cd $(PROJECT_DIR) && $(RUN_IDE_COMMAND) 241 @sync& cd $(PROJECT_DIR) && $(RUN_IDE_COMMAND)
234 runscreen: ## Run PROJECT in the background (detached screen) 242 runscreen: ## Run PROJECT in the background (detached screen)
235 runscreen: stop $(OUTPUT_FILE) 243 runscreen: stop $(OUTPUT_FILE)
236 @echo "Running $(RUN_COMMAND) in a screen" 244 @echo "Running $(RUN_COMMAND) in a screen"
237 @cd $(PROJECT_DIR) && screen -S $(SCREEN_NAME) -d -m $(RUN_COMMAND) 245 @cd $(PROJECT_DIR) && screen -S $(SCREEN_NAME) -d -m $(RUN_COMMAND)
265 @echo "Enabling Bela at startup..." 273 @echo "Enabling Bela at startup..."
266 @$(STARTUP_COMMAND) > $(BELA_STARTUP_SCRIPT) 274 @$(STARTUP_COMMAND) > $(BELA_STARTUP_SCRIPT)
267 275
268 stop: ## Stops any Bela program that is currently running 276 stop: ## Stops any Bela program that is currently running
269 stop: 277 stop:
270 @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; 278 @PID=`grep $(BELA_AUDIO_THREAD_NAME) /proc/xenomai/stat | cut -d " " -f 5 | sed s/\s//g`; if [ -z $$PID ]; then [ $(QUIET) = true ] || echo "No process to kill"; else [ $(QUIET) = true ] || echo "Killing old Bela process $$PID"; kill -2 $$PID; fi; screen -X -S $(SCREEN_NAME) quit > /dev/null; exit 0;
271 279
272 connect: ## Connects to the running Bela program (if any), can detach with ctrl-a ctrl-d. 280 connect: ## Connects to the running Bela program (if any), can detach with ctrl-a ctrl-d.
273 @screen -r -S $(SCREEN_NAME) 281 @screen -r -S $(SCREEN_NAME)
274 282
275 idestart: ## Starts the on-board IDE 283 idestart: ## Starts the on-board IDE