Mercurial > hg > beaglert
comparison Makefile @ 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 | 868cfb137fe5 |
comparison
equal
deleted
inserted
replaced
306:132fc61893af | 313:c770cdf3d8b2 |
---|---|
23 ifdef EXAMPLE | 23 ifdef EXAMPLE |
24 PROJECT?=exampleTempProject | 24 PROJECT?=exampleTempProject |
25 PROJECT_DIR?=$(abspath projects/$(PROJECT)) | 25 PROJECT_DIR?=$(abspath projects/$(PROJECT)) |
26 $(shell rm -rf $(PROJECT_DIR)) | 26 $(shell rm -rf $(PROJECT_DIR)) |
27 $(shell cp -r examples/$(EXAMPLE) $(PROJECT_DIR)) | 27 $(shell cp -r examples/$(EXAMPLE) $(PROJECT_DIR)) |
28 EXAMPLE:=that | |
29 endif | 28 endif |
30 | 29 |
31 SCREEN_NAME?=BeagleRT | 30 SCREEN_NAME?=BeagleRT |
32 | 31 |
33 #TODO: run these lines only if the command is not syntax or | 32 #TODO: run these lines only if the command is not syntax or |
45 endif | 44 endif |
46 | 45 |
47 CPP_FLAGS := -O3 -march=armv7-a -mtune=cortex-a8 -mfloat-abi=hard -mfpu=neon -ftree-vectorize | 46 CPP_FLAGS := -O3 -march=armv7-a -mtune=cortex-a8 -mfloat-abi=hard -mfpu=neon -ftree-vectorize |
48 C_FLAGS := $(CPP_FLAGS) | 47 C_FLAGS := $(CPP_FLAGS) |
49 | 48 |
50 COMPILER=clang | |
51 ifndef COMPILER | 49 ifndef COMPILER |
52 # check whether clang is installed | 50 # check whether clang is installed |
53 # TEST_COMPILER := $(shell which clang) | 51 # TEST_COMPILER := $(shell which clang) |
54 ifneq ($(strip $(TEST_COMPILER)), ) | 52 ifneq ($(strip $(TEST_COMPILER)), ) |
55 if it is installed, use it | 53 if it is installed, use it |
168 -$(RM) build/source/* $(CORE_OBJS) $(CORE_CPP_DEPS) $(DEFAULT_MAIN_OBJS) $(DEFAULT_MAIN_CPP_DEPS) Bela | 166 -$(RM) build/source/* $(CORE_OBJS) $(CORE_CPP_DEPS) $(DEFAULT_MAIN_OBJS) $(DEFAULT_MAIN_CPP_DEPS) Bela |
169 -@echo ' ' | 167 -@echo ' ' |
170 OUTPUT_FILE="$(PROJECT_DIR)/$(PROJECT)" | 168 OUTPUT_FILE="$(PROJECT_DIR)/$(PROJECT)" |
171 | 169 |
172 $(OUTPUT_FILE): Bela | 170 $(OUTPUT_FILE): Bela |
171 COMMAND_LINE_OPTIONS=$(CL) | |
172 RUN_COMMAND=$(OUTPUT_FILE) $(COMMAND_LINE_OPTIONS) | |
173 runfg: run | 173 runfg: run |
174 run: stop $(OUTPUT_FILE) | 174 run: stop $(OUTPUT_FILE) |
175 echo "Running $(OUTPUT_FILE)" | 175 echo "Running $(RUN_COMMAND)" |
176 $(OUTPUT_FILE) | 176 $(RUN_COMMAND) |
177 | |
178 runscreen: stop $(OUTPUT_FILE) | 177 runscreen: stop $(OUTPUT_FILE) |
179 runscreen: | 178 echo "Running $(RUN_COMMAND) in a screen" |
180 echo "Running $(OUTPUT_FILE) in a screen" | 179 screen -S $(SCREEN_NAME) -d -m $(RUN_COMMAND) |
181 screen -S $(SCREEN_NAME) -d -m $(OUTPUT_FILE) | 180 runscreenfg: stop $(OUTPUT_FILE) |
182 runscreenfg: | 181 echo "Running $(RUN_COMMAND) in a screen" |
183 echo "Running $(OUTPUT_FILE) in a screen" | 182 screen -S $(SCREEN_NAME) -m $(RUN_COMMAND) |
184 screen -S $(SCREEN_NAME) -m $(OUTPUT_FILE) | 183 FIFO_NAME=/tmp/belafifo |
184 runscreenfifo: stop $(OUTPUT_FILE) | |
185 @echo "Running $(RUN_COMMAND), piping output to $(FIFO_NAME)" | |
186 @rm -rf $(FIFO_NAME) | |
187 @mkfifo $(FIFO_NAME) | |
188 @screen -S $(SCREEN_NAME) -d -m stdbuf -e 0 -i 0 -o 0 bash -c "$(RUN_COMMAND) | tee $(FIFO_NAME)" | |
185 | 189 |
186 BELA_AUDIO_THREAD_NAME=beaglert-audio | 190 BELA_AUDIO_THREAD_NAME=beaglert-audio |
187 stop: | 191 stop: |
188 @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; | 192 @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; |
189 # Remove only the user-generated objects | 193 # Remove only the user-generated objects |