terminal to make variable

A

alternative451

I,
I have a litlle problem with a complex makefile and i was looking for
a solution
i want get a variable from terminal to makefile.

make file:
IFDEF VAR_NAME
~~
~~
~~
ENDIF

prompt
make compile VAR_NAME = ....

BUT make never receive the variable.
tanks to your help sorry for my english
 
A

Antoninus Twink

I have a litlle problem with a complex makefile and i was looking for
a solution i want get a variable from terminal to makefile.

make file:
IFDEF VAR_NAME
~~
make compile VAR_NAME = ....

BUT make never receive the variable.

You'll need to provide more information, like the relevant part of your
Makefile, and possibly also the version of make you're using.

Most likely guess: you need to give ifdef the name of the variable, not
its contents, e.g. FOO, not $(FOO).

Consider the following example:



# begin Makefile

all :
ifdef FOO
@echo defined
else
@echo undefined
endif

#end Makefile



$ make
undefined
$ make FOO=bar
defined
 
K

Keith Thompson

I have a litlle problem with a complex makefile and i was looking for
a solution
i want get a variable from terminal to makefile.

make file:
IFDEF VAR_NAME
~~
~~
~~
ENDIF

prompt

BUT make never receive the variable.
tanks to your help sorry for my english

Your question isn't about C, so I'm not sure why you're posting it
here. Try a newsgroup that deals with your OS, perhaps
comp.unix.programmer, or perhaps a forum that deals with the make tool
you're using.
 
F

Flash Gordon

Malcolm McLean wrote, On 25/10/08 16:40:
Makefiles are so last century.

They are also so this century. As is speaking.
cc *.c -lm
for all your compiling needs.

Or use a sensible solution for non-trivial problems and ask about it in
an appropriate group. Your solution certainly would not work for any
serious project I have worked on.
 
P

Phil Carmody

Flash Gordon said:
Malcolm McLean wrote, On 25/10/08 16:40:

They are also so this century. As is speaking.


Or use a sensible solution for non-trivial problems and ask about it in
an appropriate group. Your solution certainly would not work for any
serious project I have worked on.

There's a two-character fix for that.

cc */*.c -lm

Phil
 
F

Flash Gordon

Phil Carmody wrote, On 25/10/08 18:51:
There's a two-character fix for that.

cc */*.c -lm

No, that is not a fix. In fact from my perspective it has all of the
problems of Malcolm's suggestion. To save any more guesses such a simple
solution cannot work because third-party libraries provided as source
don't have all sources at one level and include source files we
explicitly do not want compiled. Yes, those third-party libraries *do*
have to be included in the build processes for good reasons.
 
P

Phil Carmody

Flash Gordon said:
Phil Carmody wrote, On 25/10/08 18:51:

No, that is not a fix. In fact from my perspective it has all of the
problems of Malcolm's suggestion.

WOOOOOOOOOOOOOOOOOOOOOSH!!!!!!!!!!!

Where's my hat?

Phil
 
F

Flash Gordon

Phil Carmody wrote, On 25/10/08 21:13:
WOOOOOOOOOOOOOOOOOOOOOSH!!!!!!!!!!!

Where's my hat?

Ming the Merciless stole it, do you want me to get it back for you? :)
Yes, that's it, that post was Ming impersonating me!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top