LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 03-06-2010, 08:54 AM   #1
gayleard
LQ Newbie
 
Registered: Dec 2000
Location: Trinity College Dublin
Posts: 1

Rep: Reputation: 0
Makefile - passing argument to make?


I have a number of projects, say test1, test2, test3, ...
I want to make and install all of them in exactly the same way;
so I would like to say
make test2
make install test2
with the same Makefile.

In othe words, I would like to pass the argument test2 (or just 2)
to the Makefile, so this is taken as the target for make
or make install.

This must be a common wish;
but I don't see any appropriate option with "man make"
on my Fedora-12 system.

Any help gratefully received.
 
Old 03-06-2010, 06:14 PM   #2
irmin
Member
 
Registered: Jan 2010
Location: the universe
Distribution: Slackware (modified), Slackware64 (modified), openSuSE (modified)
Posts: 342

Rep: Reputation: 62
There are several options to perform your task:

create a rule install-% for % in test1,test2,test3:
Code:
install-test1:
# install test1

install-test2:
# install test2

install-test3:
# install test3
Or create a rule "install-%:" (in gmake) and refer to the name by $@.

One last options would be to set a variable on calling make:
Code:
make TARGETS=test1 install
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] (Something like...) passing an argument to a MATLAB script Mike_V Programming 1 12-21-2009 04:04 PM
Passing an argument to a kommander dialog almatic Programming 1 04-12-2007 09:43 AM
simple argument passing tostay2003 Linux - Software 7 09-13-2006 04:11 PM
segfault when passing array[] as argument froboozle Programming 11 06-28-2005 03:06 PM
passing function pointer as argument worldmagic Programming 7 08-04-2004 03:33 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 01:52 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration