endif
# Check if verbosity is ON for build process
-VERBOSE_DEFAULT := 0
CMD_PREFIX_DEFAULT := @
-ifdef VERBOSE
- ifeq ("$(origin VERBOSE)", "command line")
- VB := $(VERBOSE)
- else
- VB := $(VERBOSE_DEFAULT)
- endif
+ifeq ($(V), 1)
+ CMD_PREFIX :=
else
- VB := $(VERBOSE_DEFAULT)
-endif
-ifeq ($(VB), 1)
- override V :=
-else
- override V := $(CMD_PREFIX_DEFAULT)
+ CMD_PREFIX := $(CMD_PREFIX_DEFAULT)
endif
# Setup path of directories
define dynamic_flags
-I$(shell dirname $(2)) -D__OBJNAME__=$(subst -,_,$(shell basename $(1) .o))
endef
-merge_objs = $(V)mkdir -p `dirname $(1)`; \
+merge_objs = $(CMD_PREFIX)mkdir -p `dirname $(1)`; \
echo " MERGE $(subst $(build_dir)/,,$(1))"; \
$(merge) $(mergeflags) $(2) -o $(1)
-merge_deps = $(V)mkdir -p `dirname $(1)`; \
+merge_deps = $(CMD_PREFIX)mkdir -p `dirname $(1)`; \
echo " MERGE-DEP $(subst $(build_dir)/,,$(1))"; \
cat $(2) > $(1)
-copy_file = $(V)mkdir -p `dirname $(1)`; \
+copy_file = $(CMD_PREFIX)mkdir -p `dirname $(1)`; \
echo " COPY $(subst $(build_dir)/,,$(1))"; \
cp -f $(2) $(1)
-inst_file = $(V)mkdir -p `dirname $(1)`; \
+inst_file = $(CMD_PREFIX)mkdir -p `dirname $(1)`; \
echo " INSTALL $(subst $(install_dir)/,,$(1))"; \
cp -f $(2) $(1)
-inst_file_list = $(V)if [ ! -z "$(4)" ]; then \
+inst_file_list = $(CMD_PREFIX)if [ ! -z "$(4)" ]; then \
mkdir -p $(1)/$(3); \
for file in $(4) ; do \
rel_file=`echo $$file | sed -e 's@$(2)/$(3)/@@'`; \
cp -f $$file $$dest_file; \
done \
fi
-inst_header_dir = $(V)mkdir -p $(1); \
+inst_header_dir = $(CMD_PREFIX)mkdir -p $(1); \
echo " INSTALL $(subst $(install_dir)/,,$(1))"; \
cp -rf $(2) $(1)
-compile_cpp = $(V)mkdir -p `dirname $(1)`; \
+compile_cpp = $(CMD_PREFIX)mkdir -p `dirname $(1)`; \
echo " CPP $(subst $(build_dir)/,,$(1))"; \
$(cpp) $(cppflags) $(2) | grep -v "\#" > $(1)
-compile_cc_dep = $(V)mkdir -p `dirname $(1)`; \
+compile_cc_dep = $(CMD_PREFIX)mkdir -p `dirname $(1)`; \
echo " CC-DEP $(subst $(build_dir)/,,$(1))"; \
echo -n `dirname $(1)`/ > $(1) && \
$(cc) $(cflags) $(call dynamic_flags,$(1),$(2)) \
-MM $(2) >> $(1) || rm -f $(1)
-compile_cc = $(V)mkdir -p `dirname $(1)`; \
+compile_cc = $(CMD_PREFIX)mkdir -p `dirname $(1)`; \
echo " CC $(subst $(build_dir)/,,$(1))"; \
$(cc) $(cflags) $(call dynamic_flags,$(1),$(2)) -c $(2) -o $(1)
-compile_as_dep = $(V)mkdir -p `dirname $(1)`; \
+compile_as_dep = $(CMD_PREFIX)mkdir -p `dirname $(1)`; \
echo " AS-DEP $(subst $(build_dir)/,,$(1))"; \
echo -n `dirname $(1)`/ > $(1) && \
$(as) $(asflags) $(call dynamic_flags,$(1),$(2)) \
-MM $(2) >> $(1) || rm -f $(1)
-compile_as = $(V)mkdir -p `dirname $(1)`; \
+compile_as = $(CMD_PREFIX)mkdir -p `dirname $(1)`; \
echo " AS $(subst $(build_dir)/,,$(1))"; \
$(as) $(asflags) $(call dynamic_flags,$(1),$(2)) -c $(2) -o $(1)
-compile_ld = $(V)mkdir -p `dirname $(1)`; \
+compile_ld = $(CMD_PREFIX)mkdir -p `dirname $(1)`; \
echo " LD $(subst $(build_dir)/,,$(1))"; \
$(ld) $(3) $(ldflags) -Wl,-T$(2) -o $(1)
-compile_ar = $(V)mkdir -p `dirname $(1)`; \
+compile_ar = $(CMD_PREFIX)mkdir -p `dirname $(1)`; \
echo " AR $(subst $(build_dir)/,,$(1))"; \
$(ar) $(arflags) $(1) $(2)
-compile_objcopy = $(V)mkdir -p `dirname $(1)`; \
+compile_objcopy = $(CMD_PREFIX)mkdir -p `dirname $(1)`; \
echo " OBJCOPY $(subst $(build_dir)/,,$(1))"; \
$(objcopy) -S -O binary $(2) $(1)
# Rule for "make clean"
.PHONY: clean
clean:
- $(V)mkdir -p $(build_dir)
+ $(CMD_PREFIX)mkdir -p $(build_dir)
$(if $(V), @echo " RM $(build_dir)/*.o")
- $(V)find $(build_dir) -type f -name "*.o" -exec rm -rf {} +
+ $(CMD_PREFIX)find $(build_dir) -type f -name "*.o" -exec rm -rf {} +
$(if $(V), @echo " RM $(build_dir)/*.a")
- $(V)find $(build_dir) -type f -name "*.a" -exec rm -rf {} +
+ $(CMD_PREFIX)find $(build_dir) -type f -name "*.a" -exec rm -rf {} +
$(if $(V), @echo " RM $(build_dir)/*.elf")
- $(V)find $(build_dir) -type f -name "*.elf" -exec rm -rf {} +
+ $(CMD_PREFIX)find $(build_dir) -type f -name "*.elf" -exec rm -rf {} +
$(if $(V), @echo " RM $(build_dir)/*.bin")
- $(V)find $(build_dir) -type f -name "*.bin" -exec rm -rf {} +
+ $(CMD_PREFIX)find $(build_dir) -type f -name "*.bin" -exec rm -rf {} +
# Rule for "make distclean"
.PHONY: distclean
distclean: clean
- $(V)mkdir -p $(build_dir)
+ $(CMD_PREFIX)mkdir -p $(build_dir)
$(if $(V), @echo " RM $(build_dir)/*.dep")
- $(V)find $(build_dir) -type f -name "*.dep" -exec rm -rf {} +
+ $(CMD_PREFIX)find $(build_dir) -type f -name "*.dep" -exec rm -rf {} +
ifeq ($(build_dir),$(CURDIR)/build)
$(if $(V), @echo " RM $(build_dir)")
- $(V)rm -rf $(build_dir)
+ $(CMD_PREFIX)rm -rf $(build_dir)
endif
ifeq ($(install_dir),$(CURDIR)/install)
$(if $(V), @echo " RM $(install_dir)")
- $(V)rm -rf $(install_dir)
+ $(CMD_PREFIX)rm -rf $(install_dir)
endif