Create style call in Makefile

This commit is contained in:
Ben V. Brown
2021-01-17 10:57:24 +11:00
parent 7ecc7e4d12
commit 1b0b665072
3 changed files with 22 additions and 5 deletions

View File

@@ -31,7 +31,12 @@ SOURCE_CORE_DIR = ./Core/Src
SOURCE_DRIVERS_DIR = ./Core/Drivers
INC_PD_DRIVERS_DIR = ./Core/Drivers/FUSB302
SOURCE_MIDDLEWARES_DIR = ./Middlewares
# Find-all's used for formatting
ALL_INCLUDES = $(shell find ./ -type f -name '*.h') \
$(shell find ./ -type f -name '*.hpp')
ALL_SOURCE = $(shell find ./ -type f -name '*.c') \
$(shell find ./ -type f -name '*.cpp')
# Device dependent settings
ifeq ($(model),$(filter $(model),TS100 TS80 TS80P))
$(info Building for Miniware )
@@ -316,6 +321,15 @@ clean :
rm -Rf $(OUTPUT_DIR_BASE)
rm -Rf $(HEXFILE_DIR)
style:
@for src in $(ALL_SOURCE) $(ALL_INCLUDES); do \
echo "Formatting $$src..." ; \
clang-format -i "$$src" ; \
done
@echo "Done"
.PHONY: style
# pull in dependency info for *existing* .o files
-include $(OUT_OBJS:.o=.d)
-include $(OUT_OBJS_CPP:.o=.d)