aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRonan Barzic <rbarzic@gmail.com>2014-06-05 22:56:17 +0200
committerSudar <sudar@sudarmuthu.com>2014-06-10 16:05:08 +0530
commit05a0c7d37722183390f6c2f8699a569589049006 (patch)
tree8ee51d3325f2258118d03cb010638694e7c7889f
parenta4dc43b58f5f3766c4594472a28b7180fd65e160 (diff)
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
-rw-r--r--Arduino.mk25
-rw-r--r--HISTORY.md1
-rw-r--r--README.md28
3 files changed, 44 insertions, 10 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)),)
-
- # 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)
+# 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)
+ 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