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.

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
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.