Go Down

Topic: A "simple" makefile for Arduino (Read 13 times) previous topic - next topic

Graynomad

I take it mine didn't work either. I converted it from a MAC version for Windows (Vista but that shouldn't matter).

IIRC I had to compile one sketch in the IDE to create all the core .o files and then the .a file. I could not get the makefile to compile the cores itself.

______
Rob
Rob Gray aka the GRAYnomad www.robgray.com

Marius

Rob,
No, I am afraid not. There are issues with paths on most of these makefiles. But the most common problem is the included files or defines for the compiled file is not found.
I did manage to get the cores compiled. There again it was a path issue on the version I used. Yours however had the path correct but could not find a rule to compile for adruino_pins.o. Which means it could not see the file, I think.
I will use a smaller project to test on today. I am sure that there must be something small with the windows setup. Once I have made some sense (i hope ) of it all, I will give some feedback. I will be taking a small break soon so it might be a week or so from now.
Rather people think you to be a fool than you open your mouth and confirm it.

Marius

Guys,
It would seem that the borrowed sketch that I am trying to compile suffers from the decease that the Adruino IDE causes. People do not code properly.  Things are not defined in all the correct places etc etc. I think a good enhancement to the Aruino IDE would be enforcing correct header file usage. And this has been my gripe with the Arduino IDE from the word go. I started coding in such a manner that I could not move my sketch to another IDE. It was a mess and hence the decision to use Visual C++ with a makefile for borrowed sketches and Eclipse for project from scratch.

So most of the Makefiles that I have tested over the last two days would probably work fine if the code was written in any decent manner. I am going to attempt to fix the code and then report back.
Rather people think you to be a fool than you open your mouth and confirm it.

MikeSmith


Mike,
I tried the makefile you suggested. Man how confusing. I always believed that the creators of makefiles are not from here. Now I am convinced. A normal guy like me will have no hope to fix any problems. As it is, it does not work for me. I get this error no matter what I try.

Code: [Select]

C:\arduino-0022\projects\Firmware>make
/usr/bin/sh: cd: C:/arduino-0022/projects/Firmware/../../../..: No such file or directory
makefile:56: *** ERROR: cannot determine sketchbook location - please specify on the commandline with SKETCHBOOK=<path>.  Stop.


And when I specify on the command line I get the same.

It will be really magic if we could get a makefile that compiles Arduino sketches form a decent editor.



Marius,

As it stands the Makefile will not work on Windows due to a number of issues:

* There seems to be no built-in interface to the Windows filesystem indexing tools, so there is no way for the tools to find Arduino on your system.
* The sketch processor relies on awk and sed, as well as the behaviour of the shell. These are standard tools on developer-friendly systems like Linux and Mac OS, but Windows has no direct equivalents, so you end up needing to install cygwin.
* WinAVR does not know how to handle paths generated by the cygwin version of make.

Short version - Windows is not a good place for this sort of software development. If you want better Arduino tools integration, consider running Linux in a VM.

bperrybap



Mike,
I tried the makefile you suggested. Man how confusing. I always believed that the creators of makefiles are not from here. Now I am convinced. A normal guy like me will have no hope to fix any problems. As it is, it does not work for me. I get this error no matter what I try.

Code: [Select]

C:\arduino-0022\projects\Firmware>make
/usr/bin/sh: cd: C:/arduino-0022/projects/Firmware/../../../..: No such file or directory
makefile:56: *** ERROR: cannot determine sketchbook location - please specify on the commandline with SKETCHBOOK=<path>.  Stop.


And when I specify on the command line I get the same.

It will be really magic if we could get a makefile that compiles Arduino sketches form a decent editor.



Marius,

As it stands the Makefile will not work on Windows due to a number of issues:

* There seems to be no built-in interface to the Windows filesystem indexing tools, so there is no way for the tools to find Arduino on your system.
* The sketch processor relies on awk and sed, as well as the behaviour of the shell. These are standard tools on developer-friendly systems like Linux and Mac OS, but Windows has no direct equivalents, so you end up needing to install cygwin.
* WinAVR does not know how to handle paths generated by the cygwin version of make.

Short version - Windows is not a good place for this sort of software development. If you want better Arduino tools integration, consider running Linux in a VM.


I can't speak about Windows7 but I use the Arduino supplied unix bin utils with my own makefiles and
bash shell scripts on XP.
(Haven't yet tried the specific makefiles referenced above)
make, awk, sed, find, sh, and tons of other unix tools are shipped with the arduino package for windows
so there is no need to install cygwin or anything else.
I will admit I had all kinds of issues on Vista and eventually had to disable the silly UAC to
finally get some of the tools work correctly. Especially SVN and patch.

After two years of suffering with Vista, I upgraded back to XP for any windows needs,
which I now run in a VirtualBox VM on Linux.

What I've done just lately is have a windows batch file wrapper that locates the arduino unix tools or
WinAVR on the machine than sets up a few environment variables then calls make or sh depending
on what I need and leave windows behind. Works pretty good.
The key to automatically locating the Arduino tools is to put the makefile in the arduino tree.
Then the tools can be located from a relative path.
But I also have an enviornment variable that can be used to directly point to the unix tools.

The biggest issue I've run into is stupid windows file/directory names.
"Documents and Settings" and "My Documents" were  just plain dumb names.
The use of <SPACE> in file names is really tough to flush out. It requires escaping. While painful,
it eventually it can be made to work so the resulting makefiles or scripts
can work on Windoze as well as *nix systems.
Then there is a nasty issue of paths longer than about 254 characters. While lots of places
claim higher, (and it shouldn't be an issue) there are multiple places where this creates issues.

To work around that there are some other techniques you have to use.
Sometimes you have to cd to a directory and use relative paths.
Sometimes you may have to create a subst drive and map the longer path
to a drive.

There are times where I literally spent the better part of a few weeks
chasing down some stupid windows tool issue.

Yep, Windoze sucks for any sort of real development especially for development environments
that have to build in multiple OS environments.

--- bill

Go Up