M
M
MartinLuk2017-10-16 10:58:24
Programming
MartinLuk, 2017-10-16 10:58:24

Code documentation. How to use gtk-doc?

2
vote against
favorites
There is a code based on GObject that needs to be documented, found that there is gtk-doc for this purpose, which is capable of documenting signals and object properties in addition to describing functions. Used this: https://wiki.gnome.org/DocumentationProject/GtkDoc and this https://developer.gnome.org/gtk-doc-manual/stable/ . Documentation should be collected "make doc".
The question is how to create a working Makefile?
makefile:

objects =   main.o example_person.o
source  =   main.c example_person.c
bin = main
DOC_MODULE = example_person


CC=gcc 
CFLAGS = -g -O0 --std=gnu99 -Wall -Wextra -Wno-unused-parameter \
$(shell pkg-config --cflags gobject-2.0)

LIBS = $(shell pkg-config --libs gobject-2.0)

ALL_FLAGS = $(CFLAGS) 
ALL_LIBS  = $(CFLAGS) $(LIBS)


$(bin): $(objects)
    $(CC) $(ALL_LIBS) -o $(bin) $(objects)

$(objects): $(source)
    $(CC) $(ALL_FLAGS) -c $(source)



clean:
    rm -f $(bin)
    rm -f *.o

// Создание документации "make doc"
doc:
    @echo "doc generator ... "

    # sources have changed

    gtkdoc-scan --module="$(DOC_MODULE)" 
    gtkdoc-scangobj --module="$(DOC_MODULE)" --output-dir=gen --cc="$(CC)" --cflags="$(CFLAGS)" --ldflags="$(LIBS)"
    gtkdoc-mkdb --module=$(DOC_MODULE) --output-format=xml --source-dir=src

    # xml files have changed

    mkdir html
    cd html && gtkdoc-mkhtml $(DOC_MODULE) ../meep-docs.xml
    gtkdoc-fixxref --module=$(DOC_MODULE) --module-dir=html

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question