help-make
[Top][All Lists]
Advanced

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

Re: Envrionment Variable Problems


From: Woodrow Douglass
Subject: Re: Envrionment Variable Problems
Date: Thu, 31 Jan 2008 13:26:19 -0500

Hey thanks, it was that exact problem with my rule. I just re-fixed it so the object file would end up where it should be and all is well!


Thank you very much for your help!

-Woody

On Jan 31, 2008 12:39 PM, Paul Smith <address@hidden> wrote:
On Thu, 2008-01-31 at 09:21 -0800, wdouglass wrote:
> Defined in the make system i am working with is the following environment
> variable:
>
> ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) $(GENDEPFLAGS)

This is not an environment variable; it's a make variable.  It's an
important distinction.

> Under certain conditions (specifically relative addressing of .c files that
> aren't in the same directory as the makefile), Make drops the first part of
> this variable, leaving me with just $(CFLAGS) and $(GENDEPFLAGS), and my
> compile fails because it doesn't get -mmcu. Has anyone run into a problem
> like this? if not, does any know any general way of debugging a complex
> makefile system? the best i've got is attempting to trace through using
> 'make -n' which is tedious and not very helpful.

Offhand I'd say that when the files you're compiling are being built
they're NOT using the rule you expected, but rather the built-in rule
make has for building .o files from .c files.  That rule does reference
$(CFLAGS).  Not sure how the $(GENDEPFLAGS) fits in.

Remember that in a pattern rule the stem (the part that matches %) must
be stringwise identical between the target and prerequisite.  So, a rule
like this:

       %.o : %.c

will allow you to build foo.o from foo.c, and also will allow you to
build bar/baz/biz/foo.o from bar/baz/biz/foo.c, but it will NOT match an
attempt to build foo.o from bar/foo.c (etc.)


You don't provide any critical details such as (a) what version of GNU
make you're using, (b) what operating system/version you're running it
on, (c) what the compile rule looks like, (d) what the target and
prerequisite names are for compiles that work and compiles that don't,
etc. so there's not much else we can say: the above is just a guess.

If you have a sufficiently new version of GNU make you can add in
$(info ...) or $(warning ...) functions to print information about
what's going on.  You can use "make -d".

--
-----------------------------------------------------------------------------
 Paul D. Smith <address@hidden>                 http://make.mad-scientist.us
 "Please remain calm--I may be mad, but I am a professional."--Mad Scientist






reply via email to

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