From cc93d7b0b22613512f120b4008587c6ad7058803 Mon Sep 17 00:00:00 2001 From: Simon John Date: Tue, 27 May 2014 11:25:23 +0100 Subject: [PATCH 1/2] Add missing newlines at end of some echo's (issue #207) Whilst doing that, i noticed that there were some missing targets to "make help" so added those in and re-ordered and re-worded some of the targets to make more sense e.g. all of the upload's are together, all of the assemblers are together etc. --- Arduino.mk | 56 ++++++++++++++++++++++++++++++------------------------ HISTORY.md | 2 ++ 2 files changed, 33 insertions(+), 25 deletions(-) diff --git a/Arduino.mk b/Arduino.mk index 04e5a8e..7f2e8db 100644 --- a/Arduino.mk +++ b/Arduino.mk @@ -1257,10 +1257,10 @@ monitor: $(MONITOR_CMD) $(call get_monitor_port) $(MONITOR_BAUDRATE) disasm: $(OBJDIR)/$(TARGET).lss - @$(ECHO) "The compiled ELF file has been disassembled to $(OBJDIR)/$(TARGET).lss" + @$(ECHO) "The compiled ELF file has been disassembled to $(OBJDIR)/$(TARGET).lss\n\n" symbol_sizes: $(OBJDIR)/$(TARGET).sym - @$(ECHO) "A symbol listing sorted by their size have been dumped to $(OBJDIR)/$(TARGET).sym" + @$(ECHO) "A symbol listing sorted by their size have been dumped to $(OBJDIR)/$(TARGET).sym\n\n" verify_size: ifeq ($(strip $(HEX_MAXIMUM_SIZE)),) @@ -1270,37 +1270,43 @@ endif See http://www.arduino.cc/en/Guide/Troubleshooting#size for tips on reducing it."; false; fi generate_assembly: $(OBJDIR)/$(TARGET).s - @$(ECHO) "Compiler-generated assembly for the main input source has been dumped to $(OBJDIR)/$(TARGET).s" + @$(ECHO) "Compiler-generated assembly for the main input source has been dumped to $(OBJDIR)/$(TARGET).s\n\n" generated_assembly: generate_assembly - @$(ECHO) "\"generated_assembly\" target is deprecated. Use \"generate_assembly\" target instead" + @$(ECHO) "\"generated_assembly\" target is deprecated. Use \"generate_assembly\" target instead\n\n" help_vars: @$(CAT) $(ARDMK_DIR)/arduino-mk-vars.md help: @$(ECHO) "\nAvailable targets:\n\ - make - no upload\n\ - make upload - upload\n\ - make clean - remove all our dependencies\n\ - make depends - update dependencies\n\ - make reset - reset the Arduino by tickling DTR on the serial port\n\ - make raw_upload - upload without first resetting\n\ - make show_boards - list all the boards defined in boards.txt\n\ - make monitor - connect to the Arduino's serial port\n\ - make size - show the size of the compiled output (relative to\n\ - resources, if you have a patched avr-size)\n\ - make disasm - generate a .lss file in build-cli that contains\n\ - disassembly of the compiled file interspersed\n\ - with your original source code.\n\ - make verify_size - Verify that the size of the final file is less than\n\ - the capacity of the micro controller.\n\ - make eeprom - upload the eep file\n\ - make raw_eeprom - upload the eep file without first resetting\n\ - make burn_bootloader - burn bootloader and fuses\n\ - make set_fuses - set fuses without burning bootloader\n\ - make help_vars - print all variables that can be overridden\n\ - make help - show this help\n\ + make - compile the code\n\ + make upload - upload\n\ + make ispload - upload using an ISP\n\ + make raw_upload - upload without first resetting\n\ + make eeprom - upload the eep file\n\ + make raw_eeprom - upload the eep file without first resetting\n\ + make clean - remove all our dependencies\n\ + make depends - update dependencies\n\ + make reset - reset the Arduino by tickling DTR or changing baud\n\ + rate on the serial port.\n\ + make show_boards - list all the boards defined in boards.txt\n\ + make monitor - connect to the Arduino's serial port\n\ + make size - show the size of the compiled output (relative to\n\ + resources, if you have a patched avr-size).\n\ + make verify_size - verify that the size of the final file is less than\n\ + the capacity of the micro controller.\n\ + make symbol_sizes - generate a .sym file containing symbols and their\n\ + sizes.\n\ + make disasm - generate a .lss file that contains disassembly\n\ + of the compiled file interspersed with your\n\ + original source code.\n\ + make generate_assembly - generate a .s file containing the compiler\n\ + generated assembly of the main sketch.\n\ + make burn_bootloader - burn bootloader and fuses\n\ + make set_fuses - set fuses without burning bootloader\n\ + make help_vars - print all variables that can be overridden\n\ + make help - show this help\n\ " @$(ECHO) "Please refer to $(ARDMK_DIR)/Arduino.mk for more details.\n" diff --git a/HISTORY.md b/HISTORY.md index fe5b408..8f2f613 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -10,6 +10,8 @@ I tried to give credit whenever possible. If I have missed anyone, kindly add it - Add: Try to guess port from wildcards if not specified. (Issue #197) (https://github.com/tuzz) - Fix: Check that on windows ARDUINO_DIR (and MPIDE_DIR) is a relative path. (Issue #201 and #202) (https://github.com/sej7278) - Add: List board name as well as tag in `make show_boards`. (Issue #204) (https://github.com/sej7278) +- Fix: Add missing newlines at end of some echo's (Issue #207) (https://github.com/sej7278) +- Fix: Add missing/reorder/reword targets in `make help` (https://github.com/sej7278) ### 1.3.3 (2014-04-12) - Fix: Make a new manpage for ard-reset-arduino. Fixes issue #188 (https://github.com/sej7278) From 05a0c7d37722183390f6c2f8699a569589049006 Mon Sep 17 00:00:00 2001 From: Ronan Barzic Date: Thu, 5 Jun 2014 22:56:17 +0200 Subject: [PATCH 2/2] Make Arduino.mk compatible with Flymake If Flymake is configured to parse .ino files the same way as for c/c++ files, it creates a temporary file (_flymake.ino) in the same directory as the original file. It fails with the current Arduino.mk because of the check for multiple .ino files. This fix removes the check only when flymake is calling the Makefile (Flymake will call make with the variable CHK_SOURCES set to the temporary file name) To make Flymake working with .ino file : Add : check-syntax: $(CXX_NAME) -c -include Arduino.h -x c++ $(CXXFLAGS) $(CPPFLAGS) -fsyntax-only $(CHK_SOURCES) in the project Makefile after the inclusion of the Arduino.mk file Edit the flymake configuration : M-x customize-option RET flymake-allowed-file-name-masks RET (using auto completion !) Add the line : ("\\.ino\\'" flymake-simple-make-init) Then click on "Apply and Save" button Fix #211 --- Arduino.mk | 23 ++++++++++++++--------- HISTORY.md | 1 + README.md | 28 ++++++++++++++++++++++++++++ 3 files changed, 43 insertions(+), 9 deletions(-) diff --git a/Arduino.mk b/Arduino.mk index 7f2e8db..6439c04 100644 --- a/Arduino.mk +++ b/Arduino.mk @@ -651,18 +651,23 @@ ifeq ($(words $(LOCAL_SRCS)), 0) $(error At least one source file (*.ino, *.pde, *.cpp, *c, *cc, *.S) is needed) endif -ifeq ($(strip $(NO_CORE)),) +# CHK_SOURCES is used by flymake +# flymake creates a tmp file in the same directory as the file under edition +# we must skip the verification in this particular case +ifeq ($(strip $(CHK_SOURCES)),) + ifeq ($(strip $(NO_CORE)),) - # Ideally, this should just check if there are more than one file - ifneq ($(words $(LOCAL_PDE_SRCS) $(LOCAL_INO_SRCS)), 1) - ifeq ($(words $(LOCAL_PDE_SRCS) $(LOCAL_INO_SRCS)), 0) - $(call show_config_info,No .pde or .ino files found. If you are compiling .c or .cpp files then you need to explicitly include Arduino header files) - else - #TODO: Support more than one file. https://github.com/sudar/Arduino-Makefile/issues/49 - $(error Need exactly one .pde or .ino file. This makefile doesn't support multiple .ino/.pde files yet) + # Ideally, this should just check if there are more than one file + ifneq ($(words $(LOCAL_PDE_SRCS) $(LOCAL_INO_SRCS)), 1) + ifeq ($(words $(LOCAL_PDE_SRCS) $(LOCAL_INO_SRCS)), 0) + $(call show_config_info,No .pde or .ino files found. If you are compiling .c or .cpp files then you need to explicitly include Arduino header files) + else + #TODO: Support more than one file. https://github.com/sudar/Arduino-Makefile/issues/49 + $(error Need exactly one .pde or .ino file. This makefile doesn't support multiple .ino/.pde files yet) + endif endif - endif + endif endif # core sources diff --git a/HISTORY.md b/HISTORY.md index 8f2f613..c838a6b 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -12,6 +12,7 @@ I tried to give credit whenever possible. If I have missed anyone, kindly add it - Add: List board name as well as tag in `make show_boards`. (Issue #204) (https://github.com/sej7278) - Fix: Add missing newlines at end of some echo's (Issue #207) (https://github.com/sej7278) - Fix: Add missing/reorder/reword targets in `make help` (https://github.com/sej7278) +- New: Arduino.mk is now compatible with Flymake mode (https://github.com/rbarzic) ### 1.3.3 (2014-04-12) - Fix: Make a new manpage for ard-reset-arduino. Fixes issue #188 (https://github.com/sej7278) diff --git a/README.md b/README.md index 7f4b8e8..d3f3171 100644 --- a/README.md +++ b/README.md @@ -150,6 +150,34 @@ To upload compiled files, `avrdude` is used. This Makefile tries to find `avrdud It is possible to use [`colorgcc`](https://github.com/colorgcc/colorgcc) with this makefile. Check out [this comment](http://hardwarefun.com/tutorials/compiling-arduino-sketches-using-makefile#comment-1408) to find usage instructions. +## Emacs/Flymake support + +On-the-fly syntax checking in Emacs using the [Flymake](http://www.emacswiki.org/emacs/FlyMake) minor mode is now possible. + +First, the flymake mode must be configured to recognize ino files : + +Edit the flymake configuration : + +``` + M-x customize-option RET + flymake-allowed-file-name-masks RET +``` + +Add the line : + +``` + ("\\.ino\\'" flymake-simple-make-init) +``` + +Then click on "Apply and Save" button + +Then, the following line must be added to the project Makefile : + +``` + check-syntax: + $(CXX_NAME) -c -include Arduino.h -x c++ $(CXXFLAGS) $(CPPFLAGS) -fsyntax-only $(CHK_SOURCES) +``` + ## Versioning The current version of the makefile is `1.3.3`. You can find the full history in the [HISTORY.md](HISTORY.md) file