Link to home
Start Free TrialLog in
Avatar of Idarhillgaar
IdarhillgaarFlag for Ireland

asked on

How to create a Makefile that sorts out lots of dependencies

Hi everybody,

My problem is that I can't compile the test class because the header it uses also uses several headers that again uses their headers etc.
the Library I'm working on is called ghmm (www.ghmm.org) the main directory for ghmm where the configuration etc is, is /ghmm/
Where the headers and their sources are locted is at /ghmm/ghmm/
The Test files are located, this is also where my files are stored /ghmm/tests/

Cheers
Idar
Avatar of ahoffmann
ahoffmann
Flag of Germany image

# asuming C or C++ source files:
gcc -MM list of your C-files >>Makefile
ASKER CERTIFIED SOLUTION
Avatar of manish_regmi
manish_regmi

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Idarhillgaar

ASKER

Hi guys, I solved it here, my problem was that the link did now know where to look

Solved:
test.c
     gcc -o output.run test.o -lstdc++ ../ghmm/.libs/libghmm.a -lm -lpthread

test.o: test.c
   gcc -c test.o output.run -I..   (the class must then help the make file find the library by ie #include <ghmm/sequences.h>
 

clean:
       rm test.o output.run

thanks though, Manish you were closest to my final solution - thanks
> .. you were closest to my final solution ..
.. which (suggestion and solution) has nothing to do with the initial question :-/
just simpler thats all - implemented before I saw your solution though