Operating System - HP-UX
1752721 Members
7219 Online
108789 Solutions
New Discussion юеВ

Make: use of := and shell under HP-UX

 
SOLVED
Go to solution
David Webb (MAX)
Occasional Contributor

Make: use of := and shell under HP-UX

Once again I am struggling with a GNU makefile and converting it to run under HP-UX. In a GNU makefile I can create a variable as follows:

# Get information about our OS
OSTYPE := $(shell uname -s)

Under HP-UX this bombs. I found some documentation indicating that the := relates to a conditional variable under HP-UX, i.e. completely different to the way GNU make uses it.

Is there a simple way to convert this GNU code to HP-UX?

Thanks in advance.

Dave
5 REPLIES 5
Steven E. Protter
Exalted Contributor

Re: Make: use of := and shell under HP-UX

Shalom dave,

Try the uname command.

OSTYPE=$(uname -a)

You will adjust it for what you need in the variable.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
A. Clay Stephenson
Acclaimed Contributor
Solution

Re: Make: use of := and shell under HP-UX

The gmake convention is that "=" is a recursive assignment whereas ":=" is a static assignment. The conditional assignment is "?=". Probably the easist method is to install gmake but in this case, you should be able to
simply: OSTYPE=`uname -s`
If it ain't broke, I can fix that.
A. Clay Stephenson
Acclaimed Contributor

Re: Make: use of := and shell under HP-UX

Gmake is nice and all that but it's kinda like the "improvements" to cron that Linux has made. If you are planning to be portable, don't mess with stuff that has been in place for decades. Any makefiles that I use, use standard (meaning "classic") syntax that work under standard make and gmake equally well. There are things that gmakes does to make certain tasks easier but those things come at the expense of portability.
If it ain't broke, I can fix that.
David Webb (MAX)
Occasional Contributor

Re: Make: use of := and shell under HP-UX

Thanks for responses.

Using

OSTYPE = `uname -s'

seems to do what I need. Sorry it's so simple, I thought I had tried all the possibilities of simple things like this, but obviously not.

Thanks again.

Dave
David Webb (MAX)
Occasional Contributor

Re: Make: use of := and shell under HP-UX

I meant to say:

Using

OSTYPE = `uname -s`

worked (last apostrophe).

Thanks again.

Dave