make file needed
i got one root folder containing my main.cpp and four folders named cmnlib(for static library), include(for headers), sourcefiles(.cpp), dbdes(mydatabase). i want to create a make file and it will first create object files from the .cpp files into sourcefiles folder and then it will create a libLibrary.a to cmnlib folder and then finally it will create the executable in the root folder using main.cpp and the libLibrary.a . can you please provide me with an example?
Thanks.
serkan sendur
Postaholic
2,062 posts since Jan 2008
Reputation Points: 854
Solved Threads: 127
i found it :
all: program
BookObj : SourceFiles/Books.cpp
xlC -c SourceFiles/Books.cpp -l vista -L/sbx/asc/slib -I/user/serkans/myprog/BookLibraryTrial/include -I/sbx/asc/vista -o SourceFiles/Books.o
AuthorObj : SourceFiles/author.cpp
xlC -c SourceFiles/author.cpp -l vista -L/sbx/asc/slib -I/user/serkans/myprog/BookLibraryTrial/include -I/sbx/asc/vista -o SourceFiles/author.o
BookLibrary: BookObj AuthorObj
ar cq cmnlib/libLibrary.a SourceFiles/Books.o SourceFiles/author.o
program: BookLibrary main.cpp
xlC main.cpp cmnlib/libLibrary.a -l vista -L/sbx/asc/slib -I/sbx/asc/vista -I/user/serkans/myprog/BookLibraryTrial/include -bhalt:5 -o program
clean:
rm SourceFiles/Books.o SourceFiles/author.o cmnlib/libLibrary.a program
serkan sendur
Postaholic
2,062 posts since Jan 2008
Reputation Points: 854
Solved Threads: 127