Unix Programming - Make file help needed

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > January 2004 > Make file help needed





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Make file help needed
Chandramouli Ramakrishnan

2004-01-23, 5:21 pm

Hai,

I would like to create a make file.
the .cpp reside at ~/bank/cpp/
and .h reside at ~/bank/h/

Make file "mymakefile" looks like this
****************************************
*******
objects = start.o access.o business.o database.o
myheadpath = ~/bank/h/

bank : $(objects)
--------g++ -o bank $(objects)

start.o : $(myheadpath)business.h

access.o : $(myheadpath)access.h $(myheadpath)data.h

business.o : $(myheadpath)business.h $(myheadpath)exception.h /
$(myheadpath)access.h $(myheadpath)database.h

database.o : $(myheadpath)database.h $(myheadpath)exception.h /
$(myheadpath)access.h

clean :
--------rm $(objects) bank
****************************************
************
Can any one of try to remove the $(myheadpath) in all of my
prerequistes by giving me a short cut method.

Thanks in advance
chan
Mark A. Odell

2004-01-23, 5:21 pm

channumouli@yahoo.com (Chandramouli Ramakrishnan) wrote in
news:662f18aa.0401012218.177d7c12@posting.google.com:
quote:

> Hai,
>
> I would like to create a make file.
> the .cpp reside at ~/bank/cpp/
> and .h reside at ~/bank/h/
>
> Make file "mymakefile" looks like this
> ****************************************
*******
> objects = start.o access.o business.o database.o
> myheadpath = ~/bank/h/
>
> bank : $(objects)
> --------g++ -o bank $(objects)
>
> start.o : $(myheadpath)business.h
>
> access.o : $(myheadpath)access.h $(myheadpath)data.h
>
> business.o : $(myheadpath)business.h $(myheadpath)exception.h /
> $(myheadpath)access.h $(myheadpath)database.h
>
> database.o : $(myheadpath)database.h $(myheadpath)exception.h /
> $(myheadpath)access.h
>
> clean :
> --------rm $(objects) bank
> ****************************************
************
> Can any one of try to remove the $(myheadpath) in all of my
> prerequistes by giving me a short cut method.



Read up on VPATH and vpath in the Gnu docs for make. It should help. Also,
remember to tell gcc where your include files live with -I flags when
compiling each file.

--
- Mark ->
--
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com