Wouter van Ooijen wrote:
>> How about:
>>
>> echo "no valid CHIP defined in your Makefile"
>>
>> That's how I'd do it in UNIX anyway.
>
> That's ~ 1/3 of the solution: the message to the user. Next 1/3: 'echo'
> is not a makefile command, so I must make a dummy target and specify
> "echo" as command to make that target?
That would probably be a "phony target" in makespeak. The disadvantage is
that if you make your targets dependent on this phony target, the check
gets run for every target calculation. But I guess there's not much you can
do about this.
> How do I make sure that that target is the first one to be build?
This is determined by the order of dependence. You should make sure that
every target that depends on the variables depends on that phony target
where they get checked.
> And then the last 1/3: how do I stop the makefile execution?
You could go with combining Zik's and Peter's suggestions and invoke a
command that echoes your error message and returns a non-zero value, or you
can use "$(error message)". (The latter seems to be easier :)
While I second Peter's suggestion to RTM, I also know that the makefile
syntax is not really intuitive, and the manual only helps some. I'm
actually looking (with a low priority) for better alternatives. So far I've
looked at Ant and Jam
.
Ant is Java-based and I'm not sure whether it'll be easier in the end -- I
have yet to see a C-type build setup with Ant. It seems to be very
universal -- with the associated (dis)advantages.
Jam seems to be something that is worthwhile looking into, but I haven't
yet had the time. It seems to be specifically targeted towards C/C++, even
though it probably can be (ab)used for other purposes, too.
Gerhard
--
http://www.piclist.com PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist