| giuliomoro@301 | 1 # Bela | 
| giuliomoro@64 | 2 # Low-latency, real-time audio and sensor processing on BeagleBone Black | 
| l@260 | 3 # (c) 2016 Andrew McPherson, Victor Zappi, Giulio Moro, Liam Donovan | 
| giuliomoro@64 | 4 # Centre for Digital Music, Queen Mary University of London | 
| giuliomoro@64 | 5 | 
| giuliomoro@64 | 6 # This Makefile is intended for use on the BeagleBone Black itself | 
| giuliomoro@64 | 7 # and not for cross-compiling | 
| giuliomoro@64 | 8 | 
| giuliomoro@386 | 9 .DEFAULT_GOAL := Bela | 
| giuliomoro@386 | 10 | 
| giuliomoro@393 | 11 NO_PROJECT_TARGETS=coreclean distclean stop help iderun idestop iderunup idenostartup | 
| giuliomoro@385 | 12 NO_PROJECT_TARGETS_MESSAGE=PROJECT or EXAMPLE should be set for all targets except: $(NO_PROJECT_TARGETS) | 
| giuliomoro@385 | 13 # Type `$ make help` to get a description of the functionalities of this Makefile. | 
| giuliomoro@385 | 14 help: ## Show this help | 
| giuliomoro@385 | 15 	@echo 'Usage: make [target] CL=[command line options] [PROJECT=[projectName] | EXAMPLE=[exampleName]]' | 
| giuliomoro@386 | 16 	@printf "\n$(NO_PROJECT_TARGETS_MESSAGE)\n\n" | 
| giuliomoro@386 | 17 	@echo 'Targets: (default: $(.DEFAULT_GOAL))' | 
| giuliomoro@385 | 18 	@fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e  's/^\(.*\): .*##\(.*\)/\1:#\2/' | column -t -c 2 -s '#' | 
| l@260 | 19 | 
| giuliomoro@385 | 20 # PROJECT or EXAMPLE must be set for targets that are not included in NO_PROJECT_TARGETS | 
| giuliomoro@374 | 21 ifeq (,$(filter $(NO_PROJECT_TARGETS),$(MAKECMDGOALS))) | 
| giuliomoro@374 | 22   ifndef PROJECT | 
| giuliomoro@374 | 23     ifndef EXAMPLE | 
| giuliomoro@385 | 24       $(error $(NO_PROJECT_TARGETS_MESSAGE)) | 
| giuliomoro@374 | 25     endif | 
| giuliomoro@287 | 26   endif | 
| l@260 | 27 endif | 
| l@260 | 28 | 
| giuliomoro@374 | 29 # if we are building an example, just copy it to the projects/ folder | 
| giuliomoro@386 | 30 # and then treat it as a project | 
| giuliomoro@374 | 31 ifdef EXAMPLE | 
| giuliomoro@394 | 32   #you can alternatively specify PROJECT= along with EXAMPLE= | 
| giuliomoro@374 | 33   PROJECT?=exampleTempProject | 
| giuliomoro@374 | 34   PROJECT_DIR?=$(abspath projects/$(PROJECT)) | 
| andrewm@380 | 35   $(shell mkdir -p $(abspath projects)) | 
| giuliomoro@374 | 36   $(shell rm -rf $(PROJECT_DIR)) | 
| giuliomoro@374 | 37   $(shell cp -r examples/$(EXAMPLE) $(PROJECT_DIR)) | 
| giuliomoro@374 | 38 else | 
| giuliomoro@287 | 39   PROJECT_DIR := $(abspath projects/$(PROJECT)) | 
| giuliomoro@287 | 40 endif | 
| giuliomoro@287 | 41 | 
| giuliomoro@374 | 42 ifdef PROJECT | 
| giuliomoro@393 | 43   $(shell mkdir -p $(PROJECT_DIR)/build build/core) | 
| giuliomoro@287 | 44 endif | 
| giuliomoro@374 | 45 | 
| giuliomoro@331 | 46 OUTPUT_FILE?=$(PROJECT_DIR)/$(PROJECT) | 
| giuliomoro@331 | 47 COMMAND_LINE_OPTIONS?=$(CL) | 
| giuliomoro@331 | 48 RUN_COMMAND?=$(OUTPUT_FILE) $(COMMAND_LINE_OPTIONS) | 
| giuliomoro@396 | 49 RUN_IDE_COMMAND?=stdbuf -i0 -o0 -e0 $(RUN_COMMAND) | 
| l@389 | 50 BELA_STARTUP_SCRIPT?=/root/BeagleRT_startup.sh | 
| giuliomoro@359 | 51 BELA_AUDIO_THREAD_NAME?=bela-audio | 
| giuliomoro@377 | 52 SCREEN_NAME?=Bela | 
| giuliomoro@399 | 53 BELA_IDE_STARTUP_SCRIPT?=/root/Bela_node.sh | 
| giuliomoro@393 | 54 BELA_IDE_HOME?=/root/Bela/IDE | 
| giuliomoro@393 | 55 BELA_IDE_SCREEN_NAME?=Bela-IDE | 
| giuliomoro@393 | 56 BELA_IDE_RUN_COMMAND?=cd $(BELA_IDE_HOME) && screen -S $(BELA_IDE_SCREEN_NAME) -d -m node index.js | 
| giuliomoro@393 | 57 BELA_IDE_STOP_COMMAND?=screen -X -S $(BELA_IDE_SCREEN_NAME) quit > /dev/null | 
| giuliomoro@374 | 58 | 
| giuliomoro@64 | 59 RM := rm -rf | 
| giuliomoro@64 | 60 STATIC_LIBS := ./libprussdrv.a ./libNE10.a | 
| l@260 | 61 LIBS := -lrt -lnative -lxenomai -lsndfile | 
| l@260 | 62 | 
| giuliomoro@244 | 63 # refresh library cache and check if libpd is there | 
| giuliomoro@326 | 64 #TEST_LIBPD := $(shell ldconfig; ldconfig -p | grep "libpd\.so")  # safest but slower way of checking | 
| giuliomoro@326 | 65 LIBPD_PATH = /usr/lib/libpd.so | 
| giuliomoro@326 | 66 TEST_LIBPD := $(shell which $(LIBPD_PATH)) | 
| giuliomoro@326 | 67 ifneq ($(strip $(TEST_LIBPD)), ) | 
| giuliomoro@244 | 68 # if libpd is there, link it in | 
| giuliomoro@244 | 69   LIBS += -lpd -lpthread_rt | 
| giuliomoro@244 | 70 endif | 
| giuliomoro@64 | 71 | 
| giuliomoro@241 | 72 CPP_FLAGS := -O3 -march=armv7-a -mtune=cortex-a8 -mfloat-abi=hard -mfpu=neon -ftree-vectorize | 
| giuliomoro@241 | 73 C_FLAGS := $(CPP_FLAGS) | 
| giuliomoro@241 | 74 | 
| giuliomoro@241 | 75 ifndef COMPILER | 
| giuliomoro@241 | 76 # check whether clang is installed | 
| giuliomoro@385 | 77   TEST_COMPILER := $(shell which clang) | 
| giuliomoro@302 | 78   ifneq ($(strip $(TEST_COMPILER)), ) | 
| giuliomoro@385 | 79     #if it is installed, use it | 
| giuliomoro@302 | 80     COMPILER := clang | 
| giuliomoro@302 | 81   else | 
| giuliomoro@241 | 82     COMPILER := gcc | 
| giuliomoro@302 | 83   endif | 
| giuliomoro@241 | 84 endif | 
| giuliomoro@241 | 85 | 
| giuliomoro@241 | 86 ifeq ($(COMPILER), clang) | 
| giuliomoro@306 | 87   CC=clang | 
| giuliomoro@306 | 88   CXX=clang++ | 
| giuliomoro@302 | 89   CPP_FLAGS += -DNDEBUG | 
| giuliomoro@302 | 90   C_FLAGS += -DNDEBUG | 
| giuliomoro@241 | 91 else | 
| giuliomoro@241 | 92   CC=gcc | 
| giuliomoro@241 | 93   CXX=g++ | 
| giuliomoro@241 | 94   CPP_FLAGS += --fast-math | 
| giuliomoro@241 | 95   C_FLAGS += --fast-math | 
| giuliomoro@241 | 96 endif | 
| giuliomoro@241 | 97 | 
| l@260 | 98 INCLUDES := -I$(PROJECT_DIR) -I./include -I/usr/include/ne10 -I/usr/xenomai/include -I/usr/arm-linux-gnueabihf/include/xenomai/include -I/usr/arm-linux-gnueabihf/include/ne10 | 
| andrewm@68 | 99 | 
| l@260 | 100 ASM_SRCS := $(wildcard $(PROJECT_DIR)/*.S) | 
| l@260 | 101 ASM_OBJS := $(addprefix $(PROJECT_DIR)/build/,$(notdir $(ASM_SRCS:.S=.o))) | 
| l@260 | 102 ASM_DEPS := $(addprefix $(PROJECT_DIR)/build/,$(notdir $(ASM_SRCS:.S=.d))) | 
| giuliomoro@64 | 103 | 
| l@260 | 104 C_SRCS := $(wildcard $(PROJECT_DIR)/*.c) | 
| l@260 | 105 C_OBJS := $(addprefix $(PROJECT_DIR)/build/,$(notdir $(C_SRCS:.c=.o))) | 
| l@260 | 106 C_DEPS := $(addprefix $(PROJECT_DIR)/build/,$(notdir $(C_SRCS:.c=.d))) | 
| giuliomoro@64 | 107 | 
| l@260 | 108 CPP_SRCS := $(wildcard $(PROJECT_DIR)/*.cpp) | 
| l@260 | 109 CPP_OBJS := $(addprefix $(PROJECT_DIR)/build/,$(notdir $(CPP_SRCS:.cpp=.o))) | 
| l@260 | 110 CPP_DEPS := $(addprefix $(PROJECT_DIR)/build/,$(notdir $(CPP_SRCS:.cpp=.d))) | 
| giuliomoro@64 | 111 | 
| giuliomoro@383 | 112 PROJECT_OBJS = $(ASM_OBJS) $(C_OBJS) $(CPP_OBJS) | 
| giuliomoro@383 | 113 | 
| giuliomoro@301 | 114 # Core Bela sources | 
| giuliomoro@186 | 115 CORE_CPP_SRCS = $(filter-out core/default_main.cpp, $(wildcard core/*.cpp)) | 
| giuliomoro@186 | 116 CORE_OBJS := $(addprefix build/core/,$(notdir $(CORE_CPP_SRCS:.cpp=.o))) | 
| giuliomoro@186 | 117 CORE_CPP_DEPS := $(addprefix build/core/,$(notdir $(CORE_CPP_SRCS:.cpp=.d))) | 
| giuliomoro@64 | 118 | 
| andrewm@318 | 119 CORE_ASM_SRCS := $(wildcard core/*.S) | 
| andrewm@318 | 120 CORE_ASM_OBJS := $(addprefix build/core/,$(notdir $(CORE_ASM_SRCS:.S=.o))) | 
| andrewm@318 | 121 CORE_ASM_DEPS := $(addprefix build/core/,$(notdir $(CORE_ASM_SRCS:.S=.d))) | 
| andrewm@318 | 122 | 
| andrewm@318 | 123 | 
| giuliomoro@64 | 124 # Objects for a system-supplied default main() file, if the user | 
| giuliomoro@64 | 125 # only wants to provide the render functions. | 
| giuliomoro@64 | 126 DEFAULT_MAIN_CPP_SRCS := ./core/default_main.cpp | 
| giuliomoro@64 | 127 DEFAULT_MAIN_OBJS := ./build/core/default_main.o | 
| giuliomoro@64 | 128 DEFAULT_MAIN_CPP_DEPS := ./build/core/default_main.d | 
| andrewm@68 | 129 | 
| giuliomoro@334 | 130 Bela: ## Builds the Bela program with all the opimizations | 
| giuliomoro@334 | 131 Bela: $(OUTPUT_FILE) | 
| giuliomoro@334 | 132 | 
| giuliomoro@301 | 133 # all = build Bela | 
| giuliomoro@334 | 134 all: ## Same as Bela | 
| andrewm@69 | 135 all: SYNTAX_FLAG := | 
| giuliomoro@301 | 136 all: Bela | 
| andrewm@68 | 137 | 
| giuliomoro@301 | 138 # debug = buildBela debug | 
| giuliomoro@334 | 139 debug: ## Same as Bela but with debug flags and no optimizations | 
| giuliomoro@209 | 140 debug: CPP_FLAGS=-g | 
| giuliomoro@209 | 141 debug: C_FLAGS=-g | 
| giuliomoro@209 | 142 debug: all | 
| giuliomoro@209 | 143 | 
| andrewm@69 | 144 # syntax = check syntax | 
| giuliomoro@334 | 145 syntax: ## Only checks syntax | 
| andrewm@69 | 146 syntax: SYNTAX_FLAG := -fsyntax-only | 
| l@260 | 147 syntax: SYNTAX | 
| andrewm@69 | 148 | 
| giuliomoro@301 | 149 # Rule for Bela core C++ files | 
| giuliomoro@64 | 150 build/core/%.o: ./core/%.cpp | 
| l@260 | 151 	@echo 'Building $(notdir $<)...' | 
| giuliomoro@386 | 152 #	@echo 'Invoking: C++ Compiler $(CXX)' | 
| l@260 | 153 	@$(CXX) $(SYNTAX_FLAG) $(INCLUDES) $(CPP_FLAGS) -Wall -c -fmessage-length=0 -U_FORTIFY_SOURCE -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o "$@" "$<" | 
| l@260 | 154 	@echo ' ...done' | 
| giuliomoro@64 | 155 	@echo ' ' | 
| andrewm@68 | 156 | 
| andrewm@318 | 157 # Rule for Bela core ASM files | 
| andrewm@318 | 158 build/core/%.o: ./core/%.S | 
| andrewm@318 | 159 	@echo 'Building $(notdir $<)...' | 
| andrewm@318 | 160 #	@echo 'Invoking: GCC Assembler' | 
| andrewm@318 | 161 	@as  -o "$@" "$<" | 
| andrewm@318 | 162 	@echo ' ...done' | 
| andrewm@318 | 163 	@echo ' ' | 
| andrewm@318 | 164 | 
| giuliomoro@64 | 165 # Rule for user-supplied C++ files | 
| l@260 | 166 $(PROJECT_DIR)/build/%.o: $(PROJECT_DIR)/%.cpp | 
| l@260 | 167 	@echo 'Building $(notdir $<)...' | 
| l@389 | 168 #	@echo 'Invoking: C++ Compiler $(CXX)' | 
| l@260 | 169 	@$(CXX) $(SYNTAX_FLAG) $(INCLUDES) $(CPP_FLAGS) -Wall -c -fmessage-length=0 -U_FORTIFY_SOURCE -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o "$@" "$<" | 
| l@260 | 170 	@echo ' ...done' | 
| giuliomoro@64 | 171 	@echo ' ' | 
| andrewm@68 | 172 | 
| giuliomoro@64 | 173 # Rule for user-supplied C files | 
| l@260 | 174 $(PROJECT_DIR)/build/%.o: $(PROJECT_DIR)/%.c | 
| l@260 | 175 	@echo 'Building $(notdir $<)...' | 
| giuliomoro@386 | 176 #	@echo 'Invoking: C Compiler $(CC)' | 
| giuliomoro@287 | 177 	$(CC) $(SYNTAX_FLAG) $(INCLUDES) $(C_FLAGS) -Wall -c -fmessage-length=0 -U_FORTIFY_SOURCE -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o "$@" "$<" -std=c99 | 
| l@260 | 178 	@echo ' ...done' | 
| giuliomoro@64 | 179 	@echo ' ' | 
| andrewm@68 | 180 | 
| giuliomoro@64 | 181 # Rule for user-supplied assembly files | 
| l@260 | 182 $(PROJECT_DIR)/build/%.o: $(PROJECT_DIR)/%.S | 
| l@260 | 183 	@echo 'Building $(notdir $<)...' | 
| l@260 | 184 #	@echo 'Invoking: GCC Assembler' | 
| l@260 | 185 	@as  -o "$@" "$<" | 
| l@260 | 186 	@echo ' ...done' | 
| giuliomoro@64 | 187 	@echo ' ' | 
| giuliomoro@64 | 188 | 
| giuliomoro@64 | 189 # This is a nasty kludge: we want to be able to optionally link in a default | 
| giuliomoro@64 | 190 # main file if the user hasn't supplied one. We check for the presence of the main() | 
| giuliomoro@64 | 191 # function, and conditionally call one of two recursive make targets depending on whether | 
| giuliomoro@64 | 192 # we want to link in the default main file or not. The kludge is the mess of a shell script | 
| giuliomoro@64 | 193 # line below. Surely there's a better way to do this? | 
| giuliomoro@383 | 194 $(OUTPUT_FILE): $(CORE_ASM_OBJS) $(CORE_OBJS) $(PROJECT_OBJS) $(STATIC_LIBS) $(DEFAULT_MAIN_OBJS) | 
| giuliomoro@383 | 195 	$(eval DEFAULT_MAIN_CONDITIONAL := $(shell bash -c 'if [ `nm $(PROJECT_OBJS) | grep -w T | grep -w main | wc -l` == '0' ]; then echo "$(DEFAULT_MAIN_OBJS)"; else echo ""; fi')) | 
| l@387 | 196 	@echo 'Linking...' | 
| andrewm@318 | 197 	@$(CXX) $(SYNTAX_FLAG) -L/usr/xenomai/lib -L/usr/arm-linux-gnueabihf/lib -L/usr/arm-linux-gnueabihf/lib/xenomai -L/usr/lib/arm-linux-gnueabihf -pthread -Wpointer-arith -o "$(PROJECT_DIR)/$(PROJECT)" $(CORE_ASM_OBJS) $(CORE_OBJS) $(DEFAULT_MAIN_CONDITIONAL) $(ASM_OBJS) $(C_OBJS) $(CPP_OBJS) $(STATIC_LIBS) $(LIBS) | 
| l@387 | 198 	@echo ' ...done' | 
| l@387 | 199 | 
| l@260 | 200 # Other Targets: | 
| l@260 | 201 # This rule compiles c and c++ source files without output or linking | 
| l@260 | 202 SYNTAX: $(C_OBJS) $(CPP_OBJS) | 
| giuliomoro@64 | 203 | 
| giuliomoro@385 | 204 projectclean:## Remove the project's build objects & binary | 
| giuliomoro@326 | 205 	-$(RM) $(PROJECT_DIR)/build/* $(OUTPUT_FILE) | 
| giuliomoro@64 | 206 	-@echo ' ' | 
| giuliomoro@64 | 207 | 
| giuliomoro@386 | 208 clean: ## Same as projectclean | 
| giuliomoro@386 | 209 clean: projectclean | 
| giuliomoro@386 | 210 | 
| giuliomoro@386 | 211 coreclean: ## Remove the core's build objects | 
| giuliomoro@394 | 212 	-$(RM) build/core/* | 
| giuliomoro@386 | 213 | 
| giuliomoro@386 | 214 prompt: | 
| giuliomoro@386 | 215 	@printf "Warning: you are about to DELETE the projects/ folder and its content. This operation cannot be undone. Continue? (y/N) " | 
| giuliomoro@386 | 216 	@read REPLY; if [ $$REPLY !=  y ] && [ $$REPLY != Y ]; then echo "Aborting..."; exit 1; fi | 
| giuliomoro@386 | 217 | 
| giuliomoro@386 | 218 distclean: ## Restores the Bela folder to a pristine state: remove all the projects source and the built objects, including the core Bela objects. | 
| giuliomoro@386 | 219 distclean: prompt distcleannoprompt | 
| giuliomoro@386 | 220 | 
| giuliomoro@386 | 221 distcleannoprompt: ## Same as distclean, but does not prompt for confirmation. Use with care. | 
| giuliomoro@326 | 222 	-$(RM) build/source/* $(CORE_OBJS) $(CORE_CPP_DEPS) $(DEFAULT_MAIN_OBJS) $(DEFAULT_MAIN_CPP_DEPS) $(OUTPUT_FILE) | 
| giuliomoro@64 | 223 	-@echo ' ' | 
| giuliomoro@64 | 224 | 
| giuliomoro@302 | 225 runfg: run | 
| giuliomoro@334 | 226 run: ## Run PROJECT in the foreground | 
| giuliomoro@326 | 227 run: stop Bela | 
| giuliomoro@327 | 228 	@echo "Running $(RUN_COMMAND)" | 
| l@387 | 229 	@cd $(PROJECT_DIR) && sync& $(RUN_COMMAND) | 
| l@387 | 230 runide: ## Run PROJECT for IDE (foreground, without stop or build, suppressed output, no buffering) | 
| l@387 | 231 runide: Bela | 
| l@387 | 232 	@cd $(PROJECT_DIR) && sync& $(RUN_IDE_COMMAND) | 
| giuliomoro@334 | 233 runscreen: ## Run PROJECT in the background (detached screen) | 
| giuliomoro@302 | 234 runscreen: stop $(OUTPUT_FILE) | 
| giuliomoro@327 | 235 	@echo "Running $(RUN_COMMAND) in a screen" | 
| giuliomoro@327 | 236 	@cd $(PROJECT_DIR) && screen -S $(SCREEN_NAME) -d -m $(RUN_COMMAND) | 
| giuliomoro@334 | 237 runscreenfg: ## Run PROJECT in a screen in the foreground (can detach with ctrl-a ctrl-d) | 
| giuliomoro@313 | 238 runscreenfg: stop $(OUTPUT_FILE) | 
| giuliomoro@327 | 239 	@echo "Running $(RUN_COMMAND) in a screen" | 
| giuliomoro@327 | 240 	@cd $(PROJECT_DIR) && screen -S $(SCREEN_NAME) -m $(RUN_COMMAND) | 
| giuliomoro@313 | 241 FIFO_NAME=/tmp/belafifo | 
| giuliomoro@334 | 242 runscreenfifo: ## Same as runscreen, but stdout and stderr are piped to the foreground through a fifo | 
| giuliomoro@313 | 243 runscreenfifo: stop $(OUTPUT_FILE) | 
| giuliomoro@313 | 244 	@echo "Running $(RUN_COMMAND), piping output to $(FIFO_NAME)" | 
| giuliomoro@313 | 245 	@rm -rf $(FIFO_NAME) | 
| giuliomoro@313 | 246 	@mkfifo $(FIFO_NAME) | 
| giuliomoro@327 | 247 	@cd $(PROJECT_DIR) | 
| giuliomoro@315 | 248 	@screen -S $(SCREEN_NAME) -d -m stdbuf -e 0 -i 0 -o 0 bash -c "$(RUN_COMMAND) &>  $(FIFO_NAME)" | 
| giuliomoro@315 | 249 	@cat /tmp/belafifo | 
| giuliomoro@302 | 250 | 
| giuliomoro@331 | 251 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" | 
| giuliomoro@334 | 252 nostartup: ## No Bela project runs at startup | 
| giuliomoro@331 | 253 nostartup: | 
| andrewm@391 | 254 	@echo "Disabling Bela at startup..." | 
| giuliomoro@344 | 255 	@printf "#!/bin/sh\n#\n\n# This file is autogenerated by Bela. Do not edit!\n\n# Run on startup disabled -- nothing to do here\n" > $(BELA_STARTUP_SCRIPT) | 
| giuliomoro@331 | 256 | 
| giuliomoro@334 | 257 startuploop: ## Makes PROJECT run at startup and restarts it if it crashes | 
| giuliomoro@331 | 258 startuploop: Bela | 
| giuliomoro@331 | 259 	@echo "Enabling Bela at startup in a loop..." | 
| giuliomoro@331 | 260 	@$(STARTUP_COMMAND) 'bash -c "while sleep 0.5 ; do echo Running Bela...;' '; done"' > $(BELA_STARTUP_SCRIPT) | 
| giuliomoro@331 | 261 | 
| giuliomoro@334 | 262 startup: ## Makes PROJECT run at startup | 
| giuliomoro@331 | 263 startup: Bela | 
| giuliomoro@331 | 264 	@echo "Enabling Bela at startup..." | 
| giuliomoro@331 | 265 	@$(STARTUP_COMMAND) > $(BELA_STARTUP_SCRIPT) | 
| giuliomoro@331 | 266 | 
| giuliomoro@334 | 267 stop: ## Stops any Bela program that is currently running | 
| giuliomoro@302 | 268 stop: | 
| giuliomoro@302 | 269 	@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; | 
| giuliomoro@64 | 270 | 
| giuliomoro@393 | 271 iderun: ## Starts the on-board IDE | 
| giuliomoro@393 | 272 iderun: | 
| giuliomoro@393 | 273 	$(BELA_IDE_RUN_COMMAND) | 
| giuliomoro@393 | 274 | 
| giuliomoro@393 | 275 idestop: ## Stops the on-board IDE | 
| giuliomoro@393 | 276 	@echo TODO | 
| giuliomoro@393 | 277 	@exit 1 | 
| giuliomoro@393 | 278 | 
| giuliomoro@393 | 279 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) | 
| giuliomoro@393 | 280 | 
| giuliomoro@399 | 281 idestartup: ## Enables the IDE at startup | 
| giuliomoro@393 | 282 	@echo "Enabling the IDE at startup" | 
| giuliomoro@393 | 283 	$(BELA_IDE_STARTUP_COMMAND) | 
| giuliomoro@393 | 284 	@chmod +x $(BELA_IDE_STARTUP_SCRIPT) | 
| giuliomoro@393 | 285 | 
| giuliomoro@393 | 286 idenostartup: ## Disables the IDE at startup | 
| giuliomoro@393 | 287 	@echo "Disabling the IDE at startup" | 
| giuliomoro@393 | 288 	@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) | 
| giuliomoro@393 | 289 .PHONY: all clean distclean help projectclean nostartup startup startuploop debug run runfg runscreen runscreenfg runscreenfifo stop iderun idestop iderunup idenostartup |