8000 Make Arduino.mk compatible with Flymake by rbarzic · Pull Request #211 · sudar/Arduino-Makefile · GitHub
[go: up one dir, main page]

Skip to content

Make Arduino.mk compatible with Flymake #211

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from
Closed

Conversation

rbarzic
Copy link
Contributor
@rbarzic rbarzic commented Jun 5, 2014

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

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
@sudar
Copy link
Owner
sudar commented Jun 6, 2014

Can you also update the README file and add a note about how to use the makefile with Flymake?

@sudar sudar added this to the 1.3.4 milestone Jun 6, 2014
@sej7278
Copy link
Collaborator
sej7278 commented Jun 6, 2014

wow that's some horrible behaviour from emacs, although there appears to be an easier fix:

(setq temporary-file-directory "~/.emacs.d/tmp/")

@rbarzic
Copy link
Contributor Author
rbarzic commented Jun 6, 2014

wow that's some horrible behaviour from emacs, although there appears to be an easier fix:
No ! That's possibly the worst fix you can find :-)
Now if you have two emacs opened with file with the same name (*) , they will overwrite each other tmp file....

(*) for example, two checkout of the same repository.

I'll do the README update as soon as I'm back in front of my personnal computer

@rbarzic
Copy link
Contributor Author
rbarzic commented Jun 6, 2014

unless of course it re-creates the complete directory path under the tmp dir - not sure flymake was doing that - I'll double check

@sudar
Copy link
Owner
sudar commented Jun 6, 2014

unless of course it re-creates the complete directory path under the tmp dir - not sure flymake was doing that - I'll double check

Double check this and if it works then we can don't have to merge this PR.

@rbarzic
Copy link
Contributor Author
rbarzic commented Jun 9, 2014

Readme.md file updated as requested
I don't think playing with the location of the directory used by flymake is a good thing. Flymake is language agnostic - we should not require a global configuration change just for one specific language/file type. There is a fork that allows to change the directory used by flymake more easily but it is not yet the official version provided with emacs and does not solve the problem for people dealing with several languages in the same emacs session

Ronan

@sej7278
Copy link
Collaborator
sej7278 commented Jun 9, 2014

there's still a typo in README.md

New: Automake.mk is now compatible with Flymake mode

does this actually work though - i can't get anything to build if 2 ino files are in the same directory if i take the check out, or is that what the local Makefile check_syntax is for?

@rbarzic
Copy link
Contributor Author
rbarzic commented Jun 10, 2014

Hi sej7278

Can you point to the typo error in the Readme file ? I can't see it (but English is not my mother tongue)
Regarding your comment about building a project with 2 ino files in the same directory : this is issue #49 and the present pull-request does nothing to help that. When Flymake mode is enable in Emacs while you are editing an ino file, Emacs will call the local Makefile with the check_syntax target and CHK_SOURCES set to point to a temporary file (with .ino extension). For this to work, we need the Makefile to compute all the compiler-related variables without the multiple file detection code...

@sej7278
Copy link
Collaborator
sej7278 commented Jun 10, 2014

this is the typo, shouldn't it say Arduino.mk not Automake.mk ?

New: Automake.mk is now compatible with Flymake mode

@rbarzic
Copy link
Contributor Author
rbarzic commented Jun 10, 2014

Fixed (it was actually in the HISTORY.md file :-) )

@sudar sudar closed this in 05a0c7d Jun 10, 2014
@sudar
Copy link
Owner
sudar commented Jun 10, 2014

Just merged it. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0