comparison Makefile @ 301:e4392164b458 prerelease

RENAMED BeagleRT to Bela AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA, scripts probably not working
author Giulio Moro <giuliomoro@yahoo.it>
date Fri, 27 May 2016 14:34:41 +0100
parents e63d35c6ae96
children b26e7c61e3b6
comparison
equal deleted inserted replaced
300:dbeed520b014 301:e4392164b458
1 # BeagleRT 1 # Bela
2 # Low-latency, real-time audio and sensor processing on BeagleBone Black 2 # Low-latency, real-time audio and sensor processing on BeagleBone Black
3 # (c) 2016 Andrew McPherson, Victor Zappi, Giulio Moro, Liam Donovan 3 # (c) 2016 Andrew McPherson, Victor Zappi, Giulio Moro, Liam Donovan
4 # Centre for Digital Music, Queen Mary University of London 4 # Centre for Digital Music, Queen Mary University of London
5 5
6 # This Makefile is intended for use on the BeagleBone Black itself 6 # This Makefile is intended for use on the BeagleBone Black itself
79 79
80 CPP_SRCS := $(wildcard $(PROJECT_DIR)/*.cpp) 80 CPP_SRCS := $(wildcard $(PROJECT_DIR)/*.cpp)
81 CPP_OBJS := $(addprefix $(PROJECT_DIR)/build/,$(notdir $(CPP_SRCS:.cpp=.o))) 81 CPP_OBJS := $(addprefix $(PROJECT_DIR)/build/,$(notdir $(CPP_SRCS:.cpp=.o)))
82 CPP_DEPS := $(addprefix $(PROJECT_DIR)/build/,$(notdir $(CPP_SRCS:.cpp=.d))) 82 CPP_DEPS := $(addprefix $(PROJECT_DIR)/build/,$(notdir $(CPP_SRCS:.cpp=.d)))
83 83
84 # Core BeagleRT sources 84 # Core Bela sources
85 CORE_CPP_SRCS = $(filter-out core/default_main.cpp, $(wildcard core/*.cpp)) 85 CORE_CPP_SRCS = $(filter-out core/default_main.cpp, $(wildcard core/*.cpp))
86 CORE_OBJS := $(addprefix build/core/,$(notdir $(CORE_CPP_SRCS:.cpp=.o))) 86 CORE_OBJS := $(addprefix build/core/,$(notdir $(CORE_CPP_SRCS:.cpp=.o)))
87 CORE_CPP_DEPS := $(addprefix build/core/,$(notdir $(CORE_CPP_SRCS:.cpp=.d))) 87 CORE_CPP_DEPS := $(addprefix build/core/,$(notdir $(CORE_CPP_SRCS:.cpp=.d)))
88 88
89 # Objects for a system-supplied default main() file, if the user 89 # Objects for a system-supplied default main() file, if the user
90 # only wants to provide the render functions. 90 # only wants to provide the render functions.
91 DEFAULT_MAIN_CPP_SRCS := ./core/default_main.cpp 91 DEFAULT_MAIN_CPP_SRCS := ./core/default_main.cpp
92 DEFAULT_MAIN_OBJS := ./build/core/default_main.o 92 DEFAULT_MAIN_OBJS := ./build/core/default_main.o
93 DEFAULT_MAIN_CPP_DEPS := ./build/core/default_main.d 93 DEFAULT_MAIN_CPP_DEPS := ./build/core/default_main.d
94 94
95 # all = build BeagleRT 95 # all = build Bela
96 all: SYNTAX_FLAG := 96 all: SYNTAX_FLAG :=
97 all: BeagleRT 97 all: Bela
98 98
99 # debug = buildBeagleRT debug 99 # debug = buildBela debug
100 debug: CPP_FLAGS=-g 100 debug: CPP_FLAGS=-g
101 debug: C_FLAGS=-g 101 debug: C_FLAGS=-g
102 debug: all 102 debug: all
103 103
104 # syntax = check syntax 104 # syntax = check syntax
105 syntax: SYNTAX_FLAG := -fsyntax-only 105 syntax: SYNTAX_FLAG := -fsyntax-only
106 syntax: SYNTAX 106 syntax: SYNTAX
107 107
108 # Rule for BeagleRT core C++ files 108 # Rule for Bela core C++ files
109 build/core/%.o: ./core/%.cpp 109 build/core/%.o: ./core/%.cpp
110 @echo 'Building $(notdir $<)...' 110 @echo 'Building $(notdir $<)...'
111 # @echo 'Invoking: C++ Compiler' 111 # @echo 'Invoking: C++ Compiler'
112 @$(CXX) $(SYNTAX_FLAG) $(INCLUDES) $(CPP_FLAGS) -Wall -c -fmessage-length=0 -U_FORTIFY_SOURCE -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o "$@" "$<" 112 @$(CXX) $(SYNTAX_FLAG) $(INCLUDES) $(CPP_FLAGS) -Wall -c -fmessage-length=0 -U_FORTIFY_SOURCE -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o "$@" "$<"
113 @echo ' ...done' 113 @echo ' ...done'
140 # This is a nasty kludge: we want to be able to optionally link in a default 140 # This is a nasty kludge: we want to be able to optionally link in a default
141 # main file if the user hasn't supplied one. We check for the presence of the main() 141 # main file if the user hasn't supplied one. We check for the presence of the main()
142 # function, and conditionally call one of two recursive make targets depending on whether 142 # function, and conditionally call one of two recursive make targets depending on whether
143 # we want to link in the default main file or not. The kludge is the mess of a shell script 143 # we want to link in the default main file or not. The kludge is the mess of a shell script
144 # line below. Surely there's a better way to do this? 144 # line below. Surely there's a better way to do this?
145 BeagleRT: $(CORE_OBJS) $(ASM_OBJS) $(C_OBJS) $(CPP_OBJS) $(STATIC_LIBS) $(DEFAULT_MAIN_OBJS) 145 Bela: $(CORE_OBJS) $(ASM_OBJS) $(C_OBJS) $(CPP_OBJS) $(STATIC_LIBS) $(DEFAULT_MAIN_OBJS)
146 $(eval DEFAULT_MAIN_CONDITIONAL := $(shell bash -c 'if [ `nm $(PROJECT_DIR)/build/*.o | grep -w T | grep -w main | wc -l` == '0' ]; then echo "$(DEFAULT_MAIN_OBJS)"; else echo ""; fi')) 146 $(eval DEFAULT_MAIN_CONDITIONAL := $(shell bash -c 'if [ `nm $(PROJECT_DIR)/build/*.o | grep -w T | grep -w main | wc -l` == '0' ]; then echo "$(DEFAULT_MAIN_OBJS)"; else echo ""; fi'))
147 @echo 'Invoking: C++ linker' 147 @echo 'Invoking: C++ linker'
148 @$(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_OBJS) $(DEFAULT_MAIN_CONDITIONAL) $(ASM_OBJS) $(C_OBJS) $(CPP_OBJS) $(STATIC_LIBS) $(LIBS) 148 @$(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_OBJS) $(DEFAULT_MAIN_CONDITIONAL) $(ASM_OBJS) $(C_OBJS) $(CPP_OBJS) $(STATIC_LIBS) $(LIBS)
149 @echo 'Finished building target: $@' 149 @echo 'Finished building target: $@'
150 150
155 # Remove the project's build objects & binary 155 # Remove the project's build objects & binary
156 projectclean: 156 projectclean:
157 -$(RM) $(PROJECT_DIR)/build/* $(PROJECT_DIR)/$(PROJECT) 157 -$(RM) $(PROJECT_DIR)/build/* $(PROJECT_DIR)/$(PROJECT)
158 -@echo ' ' 158 -@echo ' '
159 159
160 # Remove all the built objects, including the core BeagleRT objects 160 # Remove all the built objects, including the core Bela objects
161 distclean: 161 distclean:
162 -$(RM) build/source/* $(CORE_OBJS) $(CORE_CPP_DEPS) $(DEFAULT_MAIN_OBJS) $(DEFAULT_MAIN_CPP_DEPS) BeagleRT 162 -$(RM) build/source/* $(CORE_OBJS) $(CORE_CPP_DEPS) $(DEFAULT_MAIN_OBJS) $(DEFAULT_MAIN_CPP_DEPS) Bela
163 -@echo ' ' 163 -@echo ' '
164 OUTPUT_FILE="$(PROJECT_DIR)/$(PROJECT)" 164 OUTPUT_FILE="$(PROJECT_DIR)/$(PROJECT)"
165 165
166 $(OUTPUT_FILE): BeagleRT 166 $(OUTPUT_FILE): Bela
167 run: $(OUTPUT_FILE) 167 run: $(OUTPUT_FILE)
168 @echo "Running $(OUTPUT_FILE)" 168 @echo "Running $(OUTPUT_FILE)"
169 @$(OUTPUT_FILE) 169 @$(OUTPUT_FILE)
170 170
171 171
172 # Remove only the user-generated objects 172 # Remove only the user-generated objects
173 #clean: 173 #clean:
174 # -$(RM) build/source/* BeagleRT 174 # -$(RM) build/source/* Bela
175 # -@echo ' ' 175 # -@echo ' '
176 176
177 post-build: 177 post-build:
178 # Nothing to do here (for now) 178 # Nothing to do here (for now)
179 179