[lug] OT: Makefile oddity
Michael J. Hammel
mjhammel at graphics-muse.org
Fri Apr 19 12:13:55 MDT 2002
Thus spoke D. Stimits
> Ok, I can later use ${SOMETHING}, even if it is just echo. But, I was
> coming up with problems of dual attempts to build targets in a project
> split into separate directories. So I ran with -d for debug mode. Turns
> out that:
> include Makefile.something
>
> ...is doing the right thing, and after that, it is calling "include" a
> target! It then tries to figure out how to build Makefile.something,
This seems about right, and one of the reasons I eventually moved my
projects (many years preceeding auto-conf) to imake. Imake will handle
this situation quite well, as it uses a preprocessor to manage the #includes.
I use included files in many places, many of which include variables that
are set using external scripts (GIMPINCS = `gimptool --cflags` for
example).
> Perhaps I need some sort of dummy rule that will force make to see
> target "include" as always up-to-date? I want to include separate files
> for subdirectory definitions, but I want it to only add definitions, I
You need to force make to preprocess the includes first, then process the
Makefile a second time, the way imake does with Imakefiles. Not sure if
you can do that with make, but possibly if you integrate it with m4 or
something (not that I know much about m4).
> do not want it to end up doing multiple evaluations of everything under
> the mistaken assumption that "include Makefile.whatever" is a target and
> source file. Has anyone here seen this problem before or found a way to
> deal with it?
imake - It's not just for X. And there is a decent text on it from
O'Reilly: Managing Portability with imake.
The easiest way to handle imake is to make use of the imake templates
delivered with a stock XFree86 installation and use the "xmkmf" script.
However, you can write your own templates and skip the X stuff altogether.
Note that learning imake is a lot less difficult than trying to learn
auto-conf if you already know Makefile formats.
--
Michael J. Hammel The Graphics Muse
mjhammel at graphics-muse.org http://www.graphics-muse.com
------------------------------------------------------------------------------
You should not confuse your career with your life. -- Unknown.
More information about the LUG
mailing list