GIDForums  

Go Back   GIDForums > Computer Programming Forums > C Programming Language
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 13-Jan-2008, 12:27
takachi takachi is offline
Awaiting Email Confirmation
 
Join Date: Dec 2007
Posts: 101
takachi is an unknown quantity at this point

I need some help with my makefile program


I have a program which is built of main.c utils.h and utils.c.
utils contains all the functions I've used. I wrote this makefile:

Code:
#file: makefile a.out: utils.o main.o gcc utils.o main.o main.o: main.c utils.h gcc -c main.c utils.o: utils.c utils.h gcc -c utils.c
however when I write the command make the computer prints:
make: `a.out' is up to date.

can someone explain what is wrong with this makefile and how a working one should look like?
  #2  
Old 13-Jan-2008, 13:25
davekw7x davekw7x is offline
Outstanding Member
 
Join Date: Feb 2004
Location: Left Coast, USA
Posts: 5,309
davekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to behold

Re: I need some help with my makefile program


Quote:
Originally Posted by takachi
when I write the command make the computer prints:
make: `a.out' is up to date.

Maybe it's telling you that a.out is up to date. (In other words none of the other files has been changed since the last time a.out was created/modified.)

The whole idea is that the make program only does as much work as it needs to do. If target files have later timestamps than their dependencies, those rules are not executed.

Do the files main.o and utils.o and a.out exist in that directory?
What are the timestamps for utils.c, main.c, utils.o, main.o, a.out?
(Just do "ls -l" at the command line and look at the times listed for each file.)

Try pasting the following lines at the bottom of your Makefile:


Code:
clean: rm -f main.o utils.o a.out

Then enter the following on your command line:

Code:
make clean

Then

Code:
make

Experiment with touching one or both of the source files and/or deleting one or both of the .o files and/or deleting a.out. Try make after each thing that you try.

Regards,

Dave
  #3  
Old 14-Jan-2008, 05:43
takachi takachi is offline
Awaiting Email Confirmation
 
Join Date: Dec 2007
Posts: 101
takachi is an unknown quantity at this point

Re: I need some help with my makefile program


thank you for your help.
 
 

Recent GIDBlogNot selected for officer school by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Two-Tier data dissemination code installation problem nidhibansal1984 Computer Software Forum - Linux 6 16-Sep-2007 10:13
malloc/free usage, and general good programming behavior lavaka C Programming Language 7 14-Jun-2007 19:50
Text-Based Roulette Game mfm1983 C++ Forum 5 29-Nov-2006 12:20
BOOKEEPING program, HELP!! yabud C Programming Language 10 17-Nov-2006 03:48
Pipeline freeze simulation darklightred C++ Forum 6 27-Jul-2006 19:37

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 22:31.


vBulletin, Copyright © 2000 - 2010, Jelsoft Enterprises Ltd.