Add stylecheck to the examples directory
This commit is contained in:
12
Makefile
12
Makefile
@@ -62,12 +62,22 @@ examples: $(EXAMPLE_DIRS)
|
||||
clean: $(EXAMPLE_DIRS:=.clean)
|
||||
$(Q)$(MAKE) -C libopencm3 clean
|
||||
|
||||
stylecheck: $(EXAMPLE_DIRS:=.stylecheck)
|
||||
styleclean: $(EXAMPLE_DIRS:=.styleclean)
|
||||
|
||||
|
||||
%.clean:
|
||||
$(Q)if [ -d $* ]; then \
|
||||
printf " CLEAN $*\n"; \
|
||||
$(MAKE) -C $* clean OPENCM3_DIR=$(OPENCM3_DIR) || exit $?; \
|
||||
fi;
|
||||
|
||||
%.styleclean:
|
||||
$(Q)$(MAKE) -C $* styleclean OPENCM3_DIR=$(OPENCM3_DIR)
|
||||
|
||||
.PHONY: build lib examples $(EXAMPLE_DIRS) install clean
|
||||
%.stylecheck:
|
||||
$(Q)$(MAKE) -C $* stylecheck OPENCM3_DIR=$(OPENCM3_DIR)
|
||||
|
||||
|
||||
.PHONY: build lib examples $(EXAMPLE_DIRS) install clean stylecheck styleclean
|
||||
|
||||
|
||||
@@ -39,6 +39,10 @@ OBJCOPY := $(PREFIX)-objcopy
|
||||
OBJDUMP := $(PREFIX)-objdump
|
||||
GDB := $(PREFIX)-gdb
|
||||
STFLASH = $(shell which st-flash)
|
||||
STYLECHECK := /checkpatch.pl
|
||||
STYLECHECKFLAGS := --no-tree -f --terse --mailback
|
||||
STYLECHECKFILES := $(shell find . -name '*.[ch]')
|
||||
|
||||
|
||||
###############################################################################
|
||||
# Source files
|
||||
@@ -163,6 +167,22 @@ clean:
|
||||
@#printf " CLEAN\n"
|
||||
$(Q)$(RM) *.o *.d *.elf *.bin *.hex *.srec *.list *.map
|
||||
|
||||
stylecheck: $(STYLECHECKFILES:=.stylecheck)
|
||||
styleclean: $(STYLECHECKFILES:=.styleclean)
|
||||
|
||||
# the cat is due to multithreaded nature - we like to have consistent chunks of text on the output
|
||||
%.stylecheck: %
|
||||
$(Q)$(SCRIPT_DIR)$(STYLECHECK) $(STYLECHECKFLAGS) $* > $*.stylecheck; \
|
||||
if [ -s $*.stylecheck ]; then \
|
||||
cat $*.stylecheck; \
|
||||
else \
|
||||
rm -f $*.stylecheck; \
|
||||
fi;
|
||||
|
||||
%.styleclean:
|
||||
$(Q)rm -f $*.stylecheck;
|
||||
|
||||
|
||||
%.stlink-flash: %.bin
|
||||
@printf " FLASH $<\n"
|
||||
$(Q)$(STFLASH) write $(*).bin 0x8000000
|
||||
@@ -208,6 +228,6 @@ else
|
||||
$(*).elf
|
||||
endif
|
||||
|
||||
.PHONY: images clean
|
||||
.PHONY: images clean stylecheck styleclean
|
||||
|
||||
-include $(OBJS:.o=.d)
|
||||
Reference in New Issue
Block a user