- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Set make file variable depending on Target
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
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
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
08-14-2015 04:33 AM
08-14-2015 04:33 AM
Set make file variable depending on Target
Hoe to update Variable in target of a makefile:
CC=aCC
all:
<Builds source>
update_cc:
<Here I want CC="cadvice +wall aCC">
Change_CC: update_cc all
---------------------------------------
In above make, if I call >> make Change_CC, It shuold build with "cadvice +wall aCC". Otherwise alll should be same
- Tags:
- make
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-14-2015 04:50 PM - edited 08-14-2015 04:50 PM
08-14-2015 04:50 PM - edited 08-14-2015 04:50 PM
Re: Set makefile variable depending on target
>How to update variable in target of a makefile
I don't think you can, those lines are passed to the shell.
>I want CC="cadvise +wall aCC"
The simplest way to do this is set the variable on the command line:
make CC="cadvise +wall aCC"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2015 12:59 PM
08-15-2015 12:59 PM
Re: Set make file variable depending on Target
Are you talking about using what the GNU "make" folks call a
'sub-"make"'? For example (tested on a Mac, using "GNU Make 3.81", but
I don't think that there's anything exotic or GNU-specific here):
mba$ cat Makefile
def:
$(CC) $(CFLAGS) -o test test.c
alt:
@$(MAKE) CFLAGS='-O0 -g'
mba$ rm test
mba$ make
cc -o test test.c
mba$ rm test
mba$ make alt
cc -O0 -g -o test test.c
Remove the "@" on the "alt" action line to see what's happening.
I set CFLAGS, but setting CC should work, too.