comparison Makefile @ 387:47612dcb44de prerelease

add 'runide' target to Makefile
author Liam Donovan <l.b.donovan@qmul.ac.uk>
date Tue, 14 Jun 2016 18:08:46 +0100
parents fb5547fe6d99
children fe2f8e00096b
comparison
equal deleted inserted replaced
385:fb5547fe6d99 387:47612dcb44de
41 endif 41 endif
42 42
43 OUTPUT_FILE?=$(PROJECT_DIR)/$(PROJECT) 43 OUTPUT_FILE?=$(PROJECT_DIR)/$(PROJECT)
44 COMMAND_LINE_OPTIONS?=$(CL) 44 COMMAND_LINE_OPTIONS?=$(CL)
45 RUN_COMMAND?=$(OUTPUT_FILE) $(COMMAND_LINE_OPTIONS) 45 RUN_COMMAND?=$(OUTPUT_FILE) $(COMMAND_LINE_OPTIONS)
46 RUN_IDE_COMMAND?=stdbuf -i0 -o0 -e0 $(OUTPUT_FILE) $(COMMAND_LINE_OPTIONS)
46 BELA_STARTUP_SCRIPT?=/root/BeagleRT_startup.sh 47 BELA_STARTUP_SCRIPT?=/root/BeagleRT_startup.sh
47 BELA_AUDIO_THREAD_NAME?=bela-audio 48 BELA_AUDIO_THREAD_NAME?=bela-audio
48 SCREEN_NAME?=Bela 49 SCREEN_NAME?=Bela
49 50
50 51
73 else 74 else
74 COMPILER := gcc 75 COMPILER := gcc
75 endif 76 endif
76 endif 77 endif
77 78
78 $(warning $(COMPILER))
79 ifeq ($(COMPILER), clang) 79 ifeq ($(COMPILER), clang)
80 CC=clang 80 CC=clang
81 CXX=clang++ 81 CXX=clang++
82 CPP_FLAGS += -DNDEBUG 82 CPP_FLAGS += -DNDEBUG
83 C_FLAGS += -DNDEBUG 83 C_FLAGS += -DNDEBUG
184 # function, and conditionally call one of two recursive make targets depending on whether 184 # function, and conditionally call one of two recursive make targets depending on whether
185 # we want to link in the default main file or not. The kludge is the mess of a shell script 185 # we want to link in the default main file or not. The kludge is the mess of a shell script
186 # line below. Surely there's a better way to do this? 186 # line below. Surely there's a better way to do this?
187 $(OUTPUT_FILE): $(CORE_ASM_OBJS) $(CORE_OBJS) $(PROJECT_OBJS) $(STATIC_LIBS) $(DEFAULT_MAIN_OBJS) 187 $(OUTPUT_FILE): $(CORE_ASM_OBJS) $(CORE_OBJS) $(PROJECT_OBJS) $(STATIC_LIBS) $(DEFAULT_MAIN_OBJS)
188 $(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')) 188 $(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'))
189 @echo 'Invoking: C++ linker' 189 @echo 'Linking...'
190 @$(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) 190 @$(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)
191 @echo 'Finished building target: $@' 191 @echo ' ...done'
192 @sync 192
193 # Other Targets: 193 # Other Targets:
194 # This rule compiles c and c++ source files without output or linking 194 # This rule compiles c and c++ source files without output or linking
195 SYNTAX: $(C_OBJS) $(CPP_OBJS) 195 SYNTAX: $(C_OBJS) $(CPP_OBJS)
196 196
197 projectclean:## Remove the project's build objects & binary 197 projectclean:## Remove the project's build objects & binary
204 204
205 runfg: run 205 runfg: run
206 run: ## Run PROJECT in the foreground 206 run: ## Run PROJECT in the foreground
207 run: stop Bela 207 run: stop Bela
208 @echo "Running $(RUN_COMMAND)" 208 @echo "Running $(RUN_COMMAND)"
209 @cd $(PROJECT_DIR) && $(RUN_COMMAND) 209 @cd $(PROJECT_DIR) && sync& $(RUN_COMMAND)
210 runide: ## Run PROJECT for IDE (foreground, without stop or build, suppressed output, no buffering)
211 runide: Bela
212 @cd $(PROJECT_DIR) && sync& $(RUN_IDE_COMMAND)
210 runscreen: ## Run PROJECT in the background (detached screen) 213 runscreen: ## Run PROJECT in the background (detached screen)
211 runscreen: stop $(OUTPUT_FILE) 214 runscreen: stop $(OUTPUT_FILE)
212 @echo "Running $(RUN_COMMAND) in a screen" 215 @echo "Running $(RUN_COMMAND) in a screen"
213 @cd $(PROJECT_DIR) && screen -S $(SCREEN_NAME) -d -m $(RUN_COMMAND) 216 @cd $(PROJECT_DIR) && screen -S $(SCREEN_NAME) -d -m $(RUN_COMMAND)
214 runscreenfg: ## Run PROJECT in a screen in the foreground (can detach with ctrl-a ctrl-d) 217 runscreenfg: ## Run PROJECT in a screen in the foreground (can detach with ctrl-a ctrl-d)