Mercurial > hg > beaglert
changeset 553:e545ce04cf2c prerelease
Updated Makefile to take LDFLAGS=, LDLIBS=, CFLAGS=, CPPFLAGS=
author | Giulio Moro <giuliomoro@yahoo.it> |
---|---|
date | Fri, 24 Jun 2016 17:13:45 +0100 |
parents | c6ccaf53381a |
children | 3b0c860ef209 |
files | Makefile |
diffstat | 1 files changed, 18 insertions(+), 26 deletions(-) [+] |
line wrap: on
line diff
--- a/Makefile Fri Jun 24 15:18:07 2016 +0100 +++ b/Makefile Fri Jun 24 17:13:45 2016 +0100 @@ -9,11 +9,11 @@ ## EXAMPLE= -- name of the folder in examples/ to be copied to projects/ and built ## PROJECT= -- name of the folder in projects/ to be built ## CL= -- list of command line options to pass to the program when running -## INCLUDES= -- list of additional include paths to pass to the compiler -## CPP_FLAGS= -- list of additional flags passed to the C++ compiler -## C_FLAGS= -- list of additional flags passed to the C compiler +## CPPFLAGS= -- list of additional flags passed to the C++ compiler +## CFLAGS= -- list of additional flags passed to the C compiler ## COMPILER= -- compiler to use (clang or gcc) -## LIBS= -- libs to link in +## LDFLAGS= -- linker flags (e.g.: -L. ) +## LDLIBS= -- libs to link in (e.g.: -lm ) ## AT= -- used instead of @ to silence the output. Defaults AT=@, use AT= for a very verbose output ### ##available targets: # @@ -81,7 +81,7 @@ RM := rm -rf STATIC_LIBS := ./libprussdrv.a ./libNE10.a -override LIBS += -lrt -lnative -lxenomai -lsndfile +LIBS = -lrt -lnative -lxenomai -lsndfile # refresh library cache and check if libpd is there #TEST_LIBPD := $(shell ldconfig; ldconfig -p | grep "libpd\.so") # safest but slower way of checking @@ -91,10 +91,9 @@ # if libpd is there, link it in LIBS += -lpd -lpthread_rt endif -DEFAULT_CPP_FLAGS := -O3 -march=armv7-a -mtune=cortex-a8 -mfloat-abi=hard -mfpu=neon -ftree-vectorize -override CPP_FLAGS := $(DEFAULT_CPP_FLAGS) $(CPP_FLAGS) -override C_FLAGS := $(DEFAULT_CPP_FLAGS) $(C_FLAGS) - +INCLUDES := -I$(PROJECT_DIR) -I./include -I/usr/include/ne10 -I/usr/xenomai/include -I/usr/arm-linux-gnueabihf/include/xenomai/include +DEFAULT_CPPFLAGS := -O3 -march=armv7-a -mtune=cortex-a8 -mfloat-abi=hard -mfpu=neon -ftree-vectorize +DEFAULT_CFLAGS := $(DEFAULT_CPPFLAGS) ifndef COMPILER # check whether clang is installed @@ -110,20 +109,17 @@ ifeq ($(COMPILER), clang) CC=clang CXX=clang++ - CPP_FLAGS += -DNDEBUG - C_FLAGS += -DNDEBUG + DEFAULT_CPPFLAGS += -DNDEBUG + DEFAULT_CFLAGS += -DNDEBUG else ifeq ($(COMPILER), gcc) CC=gcc CXX=g++ - CPP_FLAGS += --fast-math - C_FLAGS += --fast-math + DEFAULT_CPPFLAGS += --fast-math + DEFAULT_CFLAGS += --fast-math endif endif -DEFAULT_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 -override INCLUDES += $(DEFAULT_INCLUDES) - ASM_SRCS := $(wildcard $(PROJECT_DIR)/*.S) ASM_OBJS := $(addprefix $(PROJECT_DIR)/build/,$(notdir $(ASM_SRCS:.S=.o))) ASM_DEPS := $(addprefix $(PROJECT_DIR)/build/,$(notdir $(ASM_SRCS:.S=.d))) @@ -170,8 +166,8 @@ # debug = buildBela debug debug: ## Same as Bela but with debug flags and no optimizations -debug: CPP_FLAGS=-g -debug: C_FLAGS=-g +debug: DEFAULT_CPPFLAGS=-g +debug: DEFAULT_CFLAGS=-g debug: all # syntax = check syntax @@ -183,7 +179,7 @@ build/core/%.o: ./core/%.cpp $(AT) echo 'Building $(notdir $<)...' # $(AT) echo 'Invoking: C++ Compiler $(CXX)' - $(AT) $(CXX) $(SYNTAX_FLAG) $(INCLUDES) $(CPP_FLAGS) -Wall -c -fmessage-length=0 -U_FORTIFY_SOURCE -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o "$@" "$<" + $(AT) $(CXX) $(SYNTAX_FLAG) $(INCLUDES) $(DEFAULT_CPPFLAGS) -Wall -c -fmessage-length=0 -U_FORTIFY_SOURCE -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o "$@" "$<" $(CPPFLAGS) $(AT) echo ' ...done' $(AT) echo ' ' @@ -199,7 +195,7 @@ $(PROJECT_DIR)/build/%.o: $(PROJECT_DIR)/%.cpp $(AT) echo 'Building $(notdir $<)...' # $(AT) echo 'Invoking: C++ Compiler $(CXX)' - $(AT) $(CXX) $(SYNTAX_FLAG) $(INCLUDES) $(CPP_FLAGS) -Wall -c -fmessage-length=0 -U_FORTIFY_SOURCE -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o "$@" "$<" + $(AT) $(CXX) $(SYNTAX_FLAG) $(INCLUDES) $(DEFAULT_CPPFLAGS) -Wall -c -fmessage-length=1 -U_FORTIFY_SOURCE -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o "$@" "$<" $(CPPFLAGS) $(AT) echo ' ...done' $(AT) echo ' ' @@ -207,7 +203,7 @@ $(PROJECT_DIR)/build/%.o: $(PROJECT_DIR)/%.c $(AT) echo 'Building $(notdir $<)...' # $(AT) echo 'Invoking: C Compiler $(CC)' - $(AT) $(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 + $(AT) $(CC) $(SYNTAX_FLAG) $(INCLUDES) $(DEFAULT_CFLAGS) -Wall -c -fmessage-length=0 -U_FORTIFY_SOURCE -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o "$@" "$<" -std=c99 $(CFLAGS) $(AT) echo ' ...done' $(AT) echo ' ' @@ -231,7 +227,7 @@ $(eval DEFAULT_PD_CONDITIONAL :=\ $(shell bash -c '{ ls $(PROJECT_DIR)/*.pd &>/dev/null && [ `nm $(PROJECT_OBJS) 2>/dev/null | grep -w T | grep "render.*BelaContext" | wc -l` -eq 0 ]; } && echo '$(DEFAULT_PD_OBJS)' || : ' )) $(AT) echo 'Linking...' - $(AT) $(CXX) $(SYNTAX_FLAG) $(LDFLAGS) -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) $(DEFAULT_PD_CONDITIONAL) $(ASM_OBJS) $(C_OBJS) $(CPP_OBJS) $(STATIC_LIBS) $(LIBS) + $(AT) $(CXX) $(SYNTAX_FLAG) $(LDFLAGS) -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) $(DEFAULT_PD_CONDITIONAL) $(ASM_OBJS) $(C_OBJS) $(CPP_OBJS) $(STATIC_LIBS) $(LIBS) $(LDLIBS) $(AT) echo ' ...done' # Other Targets: @@ -256,10 +252,6 @@ -$(RM) build/source/* $(CORE_OBJS) $(CORE_CPP_DEPS) $(DEFAULT_MAIN_OBJS) $(DEFAULT_MAIN_CPP_DEPS) $(OUTPUT_FILE) -@echo ' ' -$(warning C_FLAGS $(C_FLAGS)) -$(warning CPP_FLAGS $(CPP_FLAGS)) -$(warning LIBS $(LIBS)) -$(warning INCLUDES $(INCLUDES)) runfg: run run: ## Run PROJECT in the foreground run: stop Bela