changeset 313:c770cdf3d8b2 prerelease

Makefile can run in fifo, takes command line arguments with CL=
author Giulio Moro <giuliomoro@yahoo.it>
date Fri, 27 May 2016 18:55:34 +0100
parents 132fc61893af
children 611306d840b3
files Makefile
diffstat 1 files changed, 15 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile	Fri May 27 18:00:57 2016 +0100
+++ b/Makefile	Fri May 27 18:55:34 2016 +0100
@@ -25,7 +25,6 @@
   PROJECT_DIR?=$(abspath projects/$(PROJECT))
   $(shell rm -rf $(PROJECT_DIR))
   $(shell cp -r examples/$(EXAMPLE) $(PROJECT_DIR))
-  EXAMPLE:=that
 endif
 
 SCREEN_NAME?=BeagleRT
@@ -47,7 +46,6 @@
 CPP_FLAGS := -O3 -march=armv7-a -mtune=cortex-a8 -mfloat-abi=hard -mfpu=neon -ftree-vectorize 
 C_FLAGS := $(CPP_FLAGS)
 
-COMPILER=clang
 ifndef COMPILER
 # check whether clang is installed
 #    TEST_COMPILER := $(shell which clang)
@@ -170,18 +168,24 @@
 OUTPUT_FILE="$(PROJECT_DIR)/$(PROJECT)"
 
 $(OUTPUT_FILE): Bela
+COMMAND_LINE_OPTIONS=$(CL)
+RUN_COMMAND=$(OUTPUT_FILE) $(COMMAND_LINE_OPTIONS)
 runfg: run
 run: stop $(OUTPUT_FILE)
-	echo "Running $(OUTPUT_FILE)"
-	$(OUTPUT_FILE)
-
+	echo "Running $(RUN_COMMAND)"
+	$(RUN_COMMAND)
 runscreen: stop $(OUTPUT_FILE)
-runscreen:
-	echo "Running $(OUTPUT_FILE) in a screen"
-	screen -S $(SCREEN_NAME) -d -m $(OUTPUT_FILE)
-runscreenfg:
-	echo "Running $(OUTPUT_FILE) in a screen"
-	screen -S $(SCREEN_NAME) -m $(OUTPUT_FILE)
+	echo "Running $(RUN_COMMAND) in a screen"
+	screen -S $(SCREEN_NAME) -d -m $(RUN_COMMAND)
+runscreenfg: stop $(OUTPUT_FILE)
+	echo "Running $(RUN_COMMAND) in a screen"
+	screen -S $(SCREEN_NAME) -m $(RUN_COMMAND)
+FIFO_NAME=/tmp/belafifo
+runscreenfifo: stop $(OUTPUT_FILE)
+	@echo "Running $(RUN_COMMAND), piping output to $(FIFO_NAME)"
+	@rm -rf $(FIFO_NAME)
+	@mkfifo $(FIFO_NAME)
+	@screen -S $(SCREEN_NAME) -d -m stdbuf -e 0 -i 0 -o 0 bash -c "$(RUN_COMMAND) | tee $(FIFO_NAME)"
 
 BELA_AUDIO_THREAD_NAME=beaglert-audio 
 stop: