[csw-maintainers] GAR: Checking for certain variables inside a category file

Dagobert Michelsen dam at opencsw.org
Tue Oct 13 19:03:29 CEST 2009


Hi Maciej,

Am 13.10.2009 um 18:38 schrieb Maciej (Matchek) Blizinski:
> On Tue, Oct 13, 2009 at 5:28 PM, Dagobert Michelsen  
> <dam at opencsw.org> wrote:
>>> I'd like to implement checks for FILES and LOCAL_SRC: if  
>>> undefined, I
>>> want GAR to display an error with an explanation. I need to do this
>>> inside a target. Which target to use?
>>
>> No. You can just put
>>
>> ifeq ($(FILES),)
>> $(error Please set FILE to ...)
>> endif
>>
>> in your categories/loose/category.mk. Or are there other reasons
>> you want to do that inside a target?
>
> No, no other reasons. My code looks like this:
>
> http://dpaste.com/106704/
>
> I'm getting this error:
>
> gar/categories/loose/category.mk:12: *** commands commence before
> first target.  Stop.

It means
> This means the first thing in the makefile seems to be part of a  
> command script: it begins with a TAB character and doesn't appear to  
> be a legal make command (such as a variable assignment). Command  
> scripts must always be associated with a target.

You have plenty of rules before this in your included gar.mk.
Just remove the tab before the $(error).

Take a look at gar.mk where I do exact what you want:

> ifneq ($(abspath /),/)
> $(error Your version of 'make' is too old: $(MAKE_VERSION). Please  
> make sure you are using at least 3.81)
> endif



Best regards

   -- Dago



More information about the maintainers mailing list