Extend the makefile to generate a library and documentation with doxygen

前端 未结 2 1296
悲&欢浪女
悲&欢浪女 2021-01-15 22:27

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 mak

2条回答
  •  感情败类
    2021-01-15 23:07

    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)

    INPUT
    FILE_PATTERNS
    

    add this line

    @INCLUDE = doxyfile.inc
    

    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

    SRCS =  $(OBJS:.o=.c)
    SRCDIRS = ./src
    SRCDIRS += ./other_src
    

    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.

    .PHONY: all clean distclean doxy
    
    # If makefile changes, maybe the list of sources has changed, so update doxygens list
    doxyfile.inc: Makefile.mk
            echo INPUT         =  $(SRCDIRS) > doxyfile.inc
            echo FILE_PATTERNS =  *.h $(SRCS) >> doxyfile.inc
    
    doxy: doxyfile.inc $(SRCS) 
            doxygen.exe 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.

提交回复
热议问题