Add stylecheck to the examples directory

This commit is contained in:
Frantisek Burian
2014-01-11 13:25:23 +01:00
parent ffe9376c55
commit 1b98ef8bfc
2 changed files with 32 additions and 2 deletions

View File

@@ -62,12 +62,22 @@ examples: $(EXAMPLE_DIRS)
clean: $(EXAMPLE_DIRS:=.clean) clean: $(EXAMPLE_DIRS:=.clean)
$(Q)$(MAKE) -C libopencm3 clean $(Q)$(MAKE) -C libopencm3 clean
stylecheck: $(EXAMPLE_DIRS:=.stylecheck)
styleclean: $(EXAMPLE_DIRS:=.styleclean)
%.clean: %.clean:
$(Q)if [ -d $* ]; then \ $(Q)if [ -d $* ]; then \
printf " CLEAN $*\n"; \ printf " CLEAN $*\n"; \
$(MAKE) -C $* clean OPENCM3_DIR=$(OPENCM3_DIR) || exit $?; \ $(MAKE) -C $* clean OPENCM3_DIR=$(OPENCM3_DIR) || exit $?; \
fi; 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

View File

@@ -39,6 +39,10 @@ OBJCOPY := $(PREFIX)-objcopy
OBJDUMP := $(PREFIX)-objdump OBJDUMP := $(PREFIX)-objdump
GDB := $(PREFIX)-gdb GDB := $(PREFIX)-gdb
STFLASH = $(shell which st-flash) STFLASH = $(shell which st-flash)
STYLECHECK := /checkpatch.pl
STYLECHECKFLAGS := --no-tree -f --terse --mailback
STYLECHECKFILES := $(shell find . -name '*.[ch]')
############################################################################### ###############################################################################
# Source files # Source files
@@ -163,6 +167,22 @@ clean:
@#printf " CLEAN\n" @#printf " CLEAN\n"
$(Q)$(RM) *.o *.d *.elf *.bin *.hex *.srec *.list *.map $(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 %.stlink-flash: %.bin
@printf " FLASH $<\n" @printf " FLASH $<\n"
$(Q)$(STFLASH) write $(*).bin 0x8000000 $(Q)$(STFLASH) write $(*).bin 0x8000000
@@ -208,6 +228,6 @@ else
$(*).elf $(*).elf
endif endif
.PHONY: images clean .PHONY: images clean stylecheck styleclean
-include $(OBJS:.o=.d) -include $(OBJS:.o=.d)