- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- How to Pass Variables to Makefile
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-18-2008 11:41 PM
тАО03-18-2008 11:41 PM
How to Pass Variables to Makefile
In the command prompt when i just call make i starts executing blindly and no variables i passing for this make. But i need an option like to conditionally compile upon users choice.Please tell me how to establish this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-19-2008 02:06 AM
тАО03-19-2008 02:06 AM
Re: How to Pass Variables to Makefile
You did not specify if you are using
GNU make or standard HP-UX.
Several possibilities:
a) For example, in a properly written
Makefile, the variable CFLAGS is included
in each command that runs the C compiler,
so a file myfile.c would be compiled as:
# cc -c $(CFLAGS) myfile.c
Whatever value is set for CFLAGS, it affects
each compilation.
When you run make, you can override it.
For example
# make CFLAGS='-g -O'
b) In HP-UX, there is make(1) flag "-e":
Environment variables override assignments
within Makefiles
c) HP-UX make(1) supports ifdef
test in Makefile. An example:
ifdef UNAME
SYSTEM = $(UNAME)
else
SYSTEM = "UNSUPPORTED"
endif
Cheers,
VK2COT
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-19-2008 10:02 AM
тАО03-19-2008 10:02 AM
Re: How to Pass Variables to Makefile
As VK2COT alluded, you can't do this with HP's make, you must use gmake.
>But i need an option like to conditionally compile upon users choice.
You might be able to do this by explicitly mentioning a target. This allows you to build only parts of the makefile.
>VK2COT: c) HP-UX make(1) supports ifdef
test in Makefile.
I'm not sure where you got this but it isn't in the man page.
The only new feature I see is "conditional macro definition" but this probably won't help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-19-2008 11:09 AM
тАО03-19-2008 11:09 AM
Re: How to Pass Variables to Makefile
> isn't in the man page.
Nor, apparently, in reality:
dyi # cat makefile
ifdef UNAME
SYSTEM = $(UNAME)
else
SYSTEM = "UNSUPPORTED"
endif
dyi # make
Make: Must be a separator on rules line 2. Stop.
dyi # gmake
gmake: *** No targets. Stop.
dyi # uname -a
HP-UX dyi B.11.31 U ia64 4235313755 unlimited-user license
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-19-2008 02:04 PM
тАО03-19-2008 02:04 PM
Re: How to Pass Variables to Makefile
Ahh, wrong statement by me (option c) in previous post).
GNU make supports two types of If test, ifdef
and ifeq (and the negative versions ifndef,
ifneq), not the HP-UX native one!
gmake != HP-UX make
Cheers,
VK2COT