List Info

Thread: Re: Makefile 'abort' command? / 'elseif' to go with ifeq/else/endif? (Make newbie)




Re: Makefile 'abort' command? / 'elseif' to go with ifeq/else/endif? (Make newbie)
user name
2007-01-22 01:34:05
"LiquidEyes" <newsliquideyes.net> wrote:
> 2. Is there a way to abort Make prematurely? (The
equivalent of #error in 
> C.)

Do a simple call to false. The false command allways returns
an error. The
error will cause make to halt unless you did call with
"make -k", then
make will try to continue with other targets that doesn't
depend on the
aborted target.

> ifneq ($(COMPILERSUPPORTED),yes)
>  echo Compiler '$(COMPILERNAME)' not supported.
>  # I want to abort here instead of proceeding with the
build!
> else
>  echo Building with $(COMPILERNAME)...
> endif
> ###############################################
> 
> The only thing I can think of is to deliberately call a
system command that 
> I know will return an error... but that seems a bit of
a fudge.

I my opinion it is "the right" way to do it:

ifneq ($(COMPILERSUPPORTED),yes)
  echo Compiler '$(COMPILERNAME)' not supported.
  false
else
  echo Building with $(COMPILERNAME)...
endif

regards Henrik
-- 
The address in the header is only to prevent spam. My real
address is:
hc8(at)uthyres.com Examples of addresses which go to
spammers:
rootvariousus.net rootlocalhost

_______________________________________________
help-gnu-utils mailing list
help-gnu-utilsgnu.org

http://lists.gnu.org/mailman/listinfo/help-gnu-utils

Re: Makefile 'abort' command? / 'elseif' to go with ifeq/else/endif? (Make newbie)
user name
2007-01-22 02:19:16
Thanks for the reply Henrik. I guess 'false' is a Unix/Linux
command? I 
couldn't find a Windows equivalent so I rolled my own. Works
a treat!
Cheers,
Andy

"Henrik Carlqvist" <Henrik.Carlqvistdeadspam.com> wrote in message 
news:pan.2007.01.22.07.34.05.284020deadspam.com...
> "LiquidEyes" <newsliquideyes.net> wrote:
>> 2. Is there a way to abort Make prematurely? (The
equivalent of #error in
>> C.)
>
> Do a simple call to false. The false command allways
returns an error. The
> error will cause make to halt unless you did call with
"make -k", then
> make will try to continue with other targets that
doesn't depend on the
> aborted target.
>
>> ifneq ($(COMPILERSUPPORTED),yes)
>>  echo Compiler '$(COMPILERNAME)' not supported.
>>  # I want to abort here instead of proceeding with
the build!
>> else
>>  echo Building with $(COMPILERNAME)...
>> endif
>> ###############################################
>>
>> The only thing I can think of is to deliberately
call a system command 
>> that
>> I know will return an error... but that seems a bit
of a fudge.
>
> I my opinion it is "the right" way to do it:
>
> ifneq ($(COMPILERSUPPORTED),yes)
>  echo Compiler '$(COMPILERNAME)' not supported.
>  false
> else
>  echo Building with $(COMPILERNAME)...
> endif
>
> regards Henrik
> -- 
> The address in the header is only to prevent spam. My
real address is:
> hc8(at)uthyres.com Examples of addresses which go to
spammers:
> rootvariousus.net rootlocalhost
> 


_______________________________________________
help-gnu-utils mailing list
help-gnu-utilsgnu.org

http://lists.gnu.org/mailman/listinfo/help-gnu-utils

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )