LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 07-02-2007, 03:01 PM   #1
makaveli_0000
LQ Newbie
 
Registered: Nov 2006
Posts: 11

Rep: Reputation: 0
Using user input to create target using Makefile


I want to be able to take a user specified file as an input variable and use this to create a target file using a Makefile.

For instance, if a user types:

make test,

I want this Makefile to take 'test' and create an executable test.out.

Questions:

1. What is the proper syntax to use to get collect the second argument from a command line string?

2. Is it possible to have the Makefile target be a variable?
E.g

$(SOURCE_FILE): $(SOURCE_FILE).o
gcc -o $(SOURCE_FILE).out $(SOURCE_FILE).o?

If not, any tips on how I can accomplish this?

Thanks in advance?

Klaus
 
  


Reply



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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Belkin Wirless G RTL8185L make[1]: *** No rule to make target `Makefile'. Stop. SilverRock Linux - Wireless Networking 2 02-11-2007 07:25 AM
duplicated definition for a target in Makefile George2 Programming 2 05-07-2006 04:01 AM
strange target name containing % in Makefile George2 Programming 2 04-25-2006 06:28 AM
Trying to install kwvdial ,no target specified an no makefile found mtnhigh Linux - Software 0 09-27-2004 01:38 PM
No rule to make target `/mkspecs/default/qmake.conf', needed by `Makefile'. Stop Julianus Linux - General 0 12-21-2003 07:17 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 04:37 PM.

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