comparison Makefile @ 446:566bb80c2d14 prerelease

Makefile has option for RUN_FROM=/full/path
author Giulio Moro <giuliomoro@yahoo.it>
date Sun, 19 Jun 2016 12:43:43 +0100
parents cdf77b9e66bf
children fdb30affab1c
comparison
equal deleted inserted replaced
445:2b09be3fb0f2 446:566bb80c2d14
46 $(shell mkdir -p $(PROJECT_DIR)/build build/core) 46 $(shell mkdir -p $(PROJECT_DIR)/build build/core)
47 endif 47 endif
48 48
49 OUTPUT_FILE?=$(PROJECT_DIR)/$(PROJECT) 49 OUTPUT_FILE?=$(PROJECT_DIR)/$(PROJECT)
50 COMMAND_LINE_OPTIONS?=$(CL) 50 COMMAND_LINE_OPTIONS?=$(CL)
51 RUN_FROM?=$(PROJECT_DIR)
51 RUN_COMMAND?=$(OUTPUT_FILE) $(COMMAND_LINE_OPTIONS) 52 RUN_COMMAND?=$(OUTPUT_FILE) $(COMMAND_LINE_OPTIONS)
52 RUN_IDE_COMMAND?=stdbuf -i0 -o0 -e0 $(RUN_COMMAND) 53 RUN_IDE_COMMAND?=stdbuf -i0 -o0 -e0 $(RUN_COMMAND)
53 BELA_STARTUP_SCRIPT?=/root/Bela_startup.sh 54 BELA_STARTUP_SCRIPT?=/root/Bela_startup.sh
54 BELA_AUDIO_THREAD_NAME?=bela-audio 55 BELA_AUDIO_THREAD_NAME?=bela-audio
55 SCREEN_NAME?=Bela 56 SCREEN_NAME?=Bela
233 234
234 runfg: run 235 runfg: run
235 run: ## Run PROJECT in the foreground 236 run: ## Run PROJECT in the foreground
236 run: stop Bela 237 run: stop Bela
237 @echo "Running $(RUN_COMMAND)" 238 @echo "Running $(RUN_COMMAND)"
238 @sync& cd $(PROJECT_DIR) && $(RUN_COMMAND) 239 @sync& cd $(RUN_FROM) && $(RUN_COMMAND)
239 runide: ## Run PROJECT for IDE (foreground, no buffering) 240 runide: ## Run PROJECT for IDE (foreground, no buffering)
240 runide: stop Bela 241 runide: stop Bela
241 @sync& cd $(PROJECT_DIR) && $(RUN_IDE_COMMAND) 242 @sync& cd $(RUN_FROM) && $(RUN_IDE_COMMAND)
242 runscreen: ## Run PROJECT in the background (detached screen) 243 runscreen: ## Run PROJECT in the background (detached screen)
243 runscreen: stop $(OUTPUT_FILE) 244 runscreen: stop $(OUTPUT_FILE)
244 @echo "Running $(RUN_COMMAND) in a screen" 245 @echo "Running $(RUN_COMMAND) in a screen"
245 @cd $(PROJECT_DIR) && screen -S $(SCREEN_NAME) -d -m $(RUN_COMMAND) 246 @cd $(RUN_FROM) && screen -S $(SCREEN_NAME) -d -m $(RUN_COMMAND)
246 runscreenfg: ## Run PROJECT in a screen in the foreground (can detach with ctrl-a ctrl-d) 247 runscreenfg: ## Run PROJECT in a screen in the foreground (can detach with ctrl-a ctrl-d)
247 runscreenfg: stop $(OUTPUT_FILE) 248 runscreenfg: stop $(OUTPUT_FILE)
248 @echo "Running $(RUN_COMMAND) in a screen" 249 @echo "Running $(RUN_COMMAND) in a screen"
249 @cd $(PROJECT_DIR) && screen -S $(SCREEN_NAME) -m $(RUN_COMMAND) 250 @cd $(RUN_FROM) && screen -S $(SCREEN_NAME) -m $(RUN_COMMAND)
250 FIFO_NAME=/tmp/belafifo 251 FIFO_NAME=/tmp/belafifo
251 runscreenfifo: ## Same as runscreen, but stdout and stderr are piped to the foreground through a fifo 252 runscreenfifo: ## Same as runscreen, but stdout and stderr are piped to the foreground through a fifo
252 runscreenfifo: stop $(OUTPUT_FILE) 253 runscreenfifo: stop $(OUTPUT_FILE)
253 @echo "Running $(RUN_COMMAND), piping output to $(FIFO_NAME)" 254 @echo "Running $(RUN_COMMAND), piping output to $(FIFO_NAME)"
254 @rm -rf $(FIFO_NAME) 255 @rm -rf $(FIFO_NAME)
255 @mkfifo $(FIFO_NAME) 256 @mkfifo $(FIFO_NAME)
256 @cd $(PROJECT_DIR) 257 @cd $(RUN_FROM) && screen -S $(SCREEN_NAME) -d -m stdbuf -e 0 -i 0 -o 0 bash -c "$(RUN_COMMAND) &> $(FIFO_NAME)"
257 @screen -S $(SCREEN_NAME) -d -m stdbuf -e 0 -i 0 -o 0 bash -c "$(RUN_COMMAND) &> $(FIFO_NAME)"
258 @cat /tmp/belafifo 258 @cat /tmp/belafifo
259 259
260 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" 260 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"
261 nostartup: ## No Bela project runs at startup 261 nostartup: ## No Bela project runs at startup
262 nostartup: 262 nostartup: