I have implemented a binary tree program which includes the tree.c with the functions, the tree.h with the declarations of them and a main.c for testing. Also, I have a makefile which is:
CC=gcc
CFLAGS=-g -Wall
DEPS = tree.h
OBJ = main.o tree.o
%.o: %.c $(DEPS)
$(CC) -c -o $@ $< $(CFLAGS)
tree: $(OBJ)
$(CC) -o $@ $^ $(CFLAGS)
clean:
rm -f *.o tree
Now I want to make it generate a library not only an object file for the binary trees functions and afterwards to generate the documentation of doxygen inside the makefile. Any help would be helpful.
Well, I don't really know the syntax for the doxygen command, so I'll make a generic answer:
in your Makefile, each
is a target.
So if you add something like:
You will be able to generate the documentation using:
(
doc
being here the name of the target)Now, if you add:
you will have the program and the documentation generated with simply invoking
In the end, there is an additional statment your Makefile could have use of:
.PHONY
. It's "A way to mark one of many targets as not directly producing files, and ensure their execution even if a file having the same name as the target exists". In other terms, it's to make suredoc
,clean
orall
will always be executed even if files nameddoc
,clean
orall
exist.Its syntax is the following:
And is usually put at the end of the Makefile.
I know that my answer comes in a bit late, but i hope someone will benefit from this.
I have a makefile that generates Doxygen doc. You have to twist Doxygen a tiny bit Create the Doxygen setup file that fits Your need, then open that in an editor and remove the lines containg the following two settings (they will be added by the make file later)
add this line
Save this file under a different name I use Doxyfile.mk
in You makefile You need a list of sources and the directories where they are located example
Now You can put this rule in the Makefile, it will create the file doxyfile.inc that contains the settings You removed from Doxyfile.mk.
Bonus: If run from inside an IDE like Eclipse the errors that Doxygen spits out becomes clickable and will jump to the bad comment.