Mercurial > hg > beaglert
comparison Makefile @ 302:b26e7c61e3b6 prerelease
Makefile can now stop processes 'make stop'
author | Giulio Moro <giuliomoro@yahoo.it> |
---|---|
date | Fri, 27 May 2016 17:28:24 +0100 |
parents | e4392164b458 |
children | d2b7df6b355b |
comparison
equal
deleted
inserted
replaced
301:e4392164b458 | 302:b26e7c61e3b6 |
---|---|
10 | 10 |
11 # if the PROJECT variable is not set, throw an error and exit | 11 # if the PROJECT variable is not set, throw an error and exit |
12 # otherwise, we could have unexpected data loss when calling clean without it | 12 # otherwise, we could have unexpected data loss when calling clean without it |
13 ifndef PROJECT | 13 ifndef PROJECT |
14 ifndef EXAMPLE | 14 ifndef EXAMPLE |
15 $(error PROJECT or EXAMPLE should be set) | 15 $(warning PROJECT or EXAMPLE should be set in order to build) |
16 endif | 16 endif |
17 endif | 17 endif |
18 | 18 |
19 ifndef EXAMPLE | 19 ifndef EXAMPLE |
20 PROJECT_DIR := $(abspath projects/$(PROJECT)) | 20 PROJECT_DIR := $(abspath projects/$(PROJECT)) |
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 | 28 EXAMPLE:=that |
29 endif | 29 endif |
30 | |
31 SCREEN_NAME?=BeagleRT | |
30 | 32 |
31 $(shell mkdir -p $(PROJECT_DIR)/build) | 33 $(shell mkdir -p $(PROJECT_DIR)/build) |
32 RM := rm -rf | 34 RM := rm -rf |
33 STATIC_LIBS := ./libprussdrv.a ./libNE10.a | 35 STATIC_LIBS := ./libprussdrv.a ./libNE10.a |
34 LIBS := -lrt -lnative -lxenomai -lsndfile | 36 LIBS := -lrt -lnative -lxenomai -lsndfile |
42 endif | 44 endif |
43 | 45 |
44 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 |
45 C_FLAGS := $(CPP_FLAGS) | 47 C_FLAGS := $(CPP_FLAGS) |
46 | 48 |
49 COMPILER=clang | |
47 ifndef COMPILER | 50 ifndef COMPILER |
48 # check whether clang is installed | 51 # check whether clang is installed |
49 # TEST_COMPILER := $(shell which clang) | 52 # TEST_COMPILER := $(shell which clang) |
50 # ifneq ($(strip $(TEST_COMPILER)), ) | 53 ifneq ($(strip $(TEST_COMPILER)), ) |
51 # if it is installed, use it | 54 if it is installed, use it |
52 # COMPILER := clang | 55 COMPILER := clang |
53 # else | 56 else |
54 COMPILER := gcc | 57 COMPILER := gcc |
55 # endif | 58 endif |
56 endif | 59 endif |
57 | 60 |
58 ifeq ($(COMPILER), clang) | 61 ifeq ($(COMPILER), clang) |
59 CC=clang | 62 CC=/root/clang/bin/clang |
60 CXX=clang++ | 63 CXX=/root/clang/bin/clang++ |
61 CPP_FLAGS += | 64 CPP_FLAGS += -DNDEBUG |
62 C_FLAGS += | 65 C_FLAGS += -DNDEBUG |
63 else | 66 else |
64 CC=gcc | 67 CC=gcc |
65 CXX=g++ | 68 CXX=g++ |
66 CPP_FLAGS += --fast-math | 69 CPP_FLAGS += --fast-math |
67 C_FLAGS += --fast-math | 70 C_FLAGS += --fast-math |
102 debug: all | 105 debug: all |
103 | 106 |
104 # syntax = check syntax | 107 # syntax = check syntax |
105 syntax: SYNTAX_FLAG := -fsyntax-only | 108 syntax: SYNTAX_FLAG := -fsyntax-only |
106 syntax: SYNTAX | 109 syntax: SYNTAX |
110 | |
111 | |
107 | 112 |
108 # Rule for Bela core C++ files | 113 # Rule for Bela core C++ files |
109 build/core/%.o: ./core/%.cpp | 114 build/core/%.o: ./core/%.cpp |
110 @echo 'Building $(notdir $<)...' | 115 @echo 'Building $(notdir $<)...' |
111 # @echo 'Invoking: C++ Compiler' | 116 # @echo 'Invoking: C++ Compiler' |
162 -$(RM) build/source/* $(CORE_OBJS) $(CORE_CPP_DEPS) $(DEFAULT_MAIN_OBJS) $(DEFAULT_MAIN_CPP_DEPS) Bela | 167 -$(RM) build/source/* $(CORE_OBJS) $(CORE_CPP_DEPS) $(DEFAULT_MAIN_OBJS) $(DEFAULT_MAIN_CPP_DEPS) Bela |
163 -@echo ' ' | 168 -@echo ' ' |
164 OUTPUT_FILE="$(PROJECT_DIR)/$(PROJECT)" | 169 OUTPUT_FILE="$(PROJECT_DIR)/$(PROJECT)" |
165 | 170 |
166 $(OUTPUT_FILE): Bela | 171 $(OUTPUT_FILE): Bela |
172 runfg: run | |
167 run: $(OUTPUT_FILE) | 173 run: $(OUTPUT_FILE) |
168 @echo "Running $(OUTPUT_FILE)" | 174 @echo "Running $(OUTPUT_FILE)" |
169 @$(OUTPUT_FILE) | 175 @$(OUTPUT_FILE) |
170 | 176 |
171 | 177 runscreen: stop $(OUTPUT_FILE) |
178 runscreen: | |
179 @echo "Running $(OUTPUT_FILE) in a screen" | |
180 | |
181 BELA_AUDIO_THREAD_NAME=beaglert-audio | |
182 stop: | |
183 @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; | |
172 # Remove only the user-generated objects | 184 # Remove only the user-generated objects |
173 #clean: | 185 #clean: |
174 # -$(RM) build/source/* Bela | 186 # -$(RM) build/source/* Bela |
175 # -@echo ' ' | 187 # -@echo ' ' |
176 | 188 |