avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] Makefile problem and solution


From: Dave Hylands
Subject: Re: [avr-gcc-list] Makefile problem and solution
Date: Wed, 27 Sep 2006 01:47:06 -0700

Hi Eric,

I've been keeping an eye on this thread and I've already worked in the
different compiler flag to generate dependencies with relative paths into
the Makefile Template. Thanks to you both for highlighting this issue and
thanks Dave for providing a solution! It's very appreciate.

There are really a few key elements to making sure your dependency
files only contain relative paths:

1 - Make sure that the source files are passed to gcc using relative
paths. For files that are in the same directory as the Makefile, this
is generally done without thinking about it.

2 - Make sure that make's vpath's (if used) are specified using
relative paths. This will in turn cause the arguments passed to gcc to
be relative.

3 - Make sure that relative include paths are specified using the -I
directives used to specify search directories for header files.

4 - Make sure that the .o file is specified using a relative
directory, since the path to the .o file also winds up in the
dependency list. This also typically happens for free, since most
people put the .o files in the same directory or a subdirectory of the
source files.

5 - Finally, the -MMD option says to exclude system header files.
These are one potential source of absolute paths. I find that that I
never edit the system header files so excluding them gets rid of a
bunch of checks that won't buy most people anything, and gets rid of
one potential source of absolute paths.

I use (and recommend) MFile when teaching people new to software
development how to create makefiles, but I typically deal with
cross-platform multi-directory development environments, and once you
get to know a tool (like make) you discover that you want to do things
your way, so now I always hand-craft my makefiles. Not recommended for
everyone :)

--
Dave Hylands
Vancouver, BC, Canada
http://www.DaveHylands.com/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]