LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Closed Thread
 
Search this Thread
Old 01-25-2005, 05:30 PM   #1
elite_duke
LQ Newbie
 
Registered: Feb 2004
Posts: 9

Rep: Reputation: 0
Makefile & Executable


Ok I'm really newb to this,

I wrote a program, say robot.cc, and i want to write a makefile for it, so that when i type

robot [filename]

where filename is an input file, it will compile the robot.cc and take in the input file with name "filename", and if filename is not present, then just run

./a.out instead of ./a.out filename

i know it looks something like

robot $X:
g++ robot.cc
./a.out $X

but doesnt seem to work

Thanks in advance.
 
Old 01-25-2005, 05:41 PM   #2
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris10, Solaris 11, Mint, OL
Posts: 9,482

Rep: Reputation: 354Reputation: 354Reputation: 354Reputation: 354
I'm not sure understanding what you are trying to achive, but are you sure a Makefile is really the way to do it ?
 
Old 01-25-2005, 05:45 PM   #3
elite_duke
LQ Newbie
 
Registered: Feb 2004
Posts: 9

Original Poster
Rep: Reputation: 0
yeah i think so.

so basically when i type the following the commanding line:

robot test.input

this line will compile robot.cc, and execute a.out with test.input, that's it, i just dont know the syntax

if the following is typed

robot

then it's equvalent of executing ./a.out

Thanks.
 
Old 01-25-2005, 05:56 PM   #4
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris10, Solaris 11, Mint, OL
Posts: 9,482

Rep: Reputation: 354Reputation: 354Reputation: 354Reputation: 354
When you type robot, how do you want the Makefile to be used ?
Usually a Makefile is processed by the make command.

Or is it "make robot" what you meant ?
 
Old 01-25-2005, 05:57 PM   #5
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,964
Blog Entries: 11

Rep: Reputation: 865Reputation: 865Reputation: 865Reputation: 865Reputation: 865Reputation: 865Reputation: 865
Please do not post the same thread in more than one forum. Picking the most relevant forum and posting it once there makes it easier for other members to help you and keeps the discussion all in one place.

http://www.linuxquestions.org/rules.php

http://www.linuxquestions.org/questi...hreadid=282211

This thread has been reported for closure

Last edited by Tinkster; 01-25-2005 at 05:58 PM.
 
Old 01-25-2005, 08:04 PM   #6
elite_duke
LQ Newbie
 
Registered: Feb 2004
Posts: 9

Original Poster
Rep: Reputation: 0
what is the best way to script make robot?
 
  


Closed Thread


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
[bsdmake/pmake] Makefile Fun & Games darklogik_org Programming 2 02-13-2005 01:34 PM
Makefile & Executable elite_duke Linux - Newbie 4 01-26-2005 10:05 AM
How can I use "Makefile.in" for building an executable program? wuzhong Linux - Networking 1 10-06-2004 10:00 AM
Non executable stack with Linux -- && 64bit CPU needed? lelolas Linux - Security 5 07-25-2004 09:25 PM
Sendmail & How to reject mail with executable attachments WorldBuilder Linux - Networking 3 02-04-2004 03:27 PM


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

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration