Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


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

Rep: Reputation: 0
Makefile & Executable

Ok I'm really newb to this,

I wrote a program, say, 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 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:
./a.out $X

but doesnt seem to work

Thanks in advance.
Old 01-25-2005, 05:52 PM   #2
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 927Reputation: 927Reputation: 927Reputation: 927Reputation: 927Reputation: 927Reputation: 927Reputation: 927
Why do you want to force a recompile of the
on every run in the first place?

Old 01-25-2005, 08:02 PM   #3
LQ Newbie
Registered: Feb 2004
Posts: 9

Original Poster
Rep: Reputation: 0
not everytime, just compile once, the next time robot is called, assume no changes in *.cc, it will be robot instead of ./a.out
Old 01-26-2005, 01:48 AM   #4
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Ubuntu/WSL
Posts: 9,787

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
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-26-2005, 10:05 AM   #5
Registered: Aug 2003
Location: Omaha, NE, USA
Distribution: PCLinuxOS 2007
Posts: 808

Rep: Reputation: 30
I guess we more experienced folks are just a bit confused about what you are trying to do.

A makefile is used by the "make" command to compile source code into an executable program. (Yeah, it *can* do more, but that's its basic intent. ) So you type

$ make robot

and the instructions in the makefile will take and produce an executable program, presumably named "robot". Then, you run "robot" by typing

$ robot [filename]

and "robot" will do whatever it's supposed to do with "filename".

If this isn't what you are trying to do, we need a little more clarification.


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 Programming 5 01-25-2005 08:04 PM
How can I use "" 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 > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:00 PM.

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