TinyURL widget - shorten your URL's for free!

Enter a long URL to make tiny:

Friday, January 10, 2014

Simple way to add doxygen to your GNU Autotools project

[Edited with changes in Autotools 2016...]

I tried Oren Ben-Kiki's doxygen support here and got some errors when trying doxygen generation inside a directory that wasn't source code directory because of the way it's configured. So here is my simple version:


1. inside top source dir execute:

doxygen -g

to generate Doxyfile.

2. copy that to Doxyfile.in

3. edit Doxyfile.in with the following variables inserted where it makes sense:

PROJECT_NAME = @PACKAGE@
PROJECT_NUMBER = @VERSION@
OUTPUT_DIRECTORY = doxygen
down halfway in the doxygen.in file change
INPUT = @SRC_SUBDIRS@

Then, inside configure.ac insert:
SRC_SUBDIRS = src
# shell script to find directories
for FILE in `ls -d src/*`
do
case "$FILE" in
autom4te* ) continue ;; #
doxygen* ) continue ;; # exclude doxygen dir
*Makefile* ) continue ;; # exclude doxygen dir
m4*) continue ;; #
* )
SRC_SUBDIRS+=" $FILE"
esac
done
at the bottom of configure.ac:

AC_SUBST([SRC_SUBDIRS])

and make sure you add the target doxygen file (it will start with doxygen.in and generate doxygen)

# OUTPUT STAGE
AC_CONFIG_FILES([Makefile Doxyfile])

Then inside your Makefile.am add:


EXTRA_DIST += Doxyfile.in

# simple doxygen target
dox: Doxyfile.in
doxygen Doxyfile


# clean up the extras including doxygen
clean-local:
cd ${top_srcdir}
rm -rf doxygen


now when you
make clean

it will remove the doxygen directory.
When you

make dox

it will run doxygen and make html and latex outputs. You will need to configure other changes to the doxygen to get specific output but this will get you started fast...

2 comments:

  1. Simple indeed. would the target "dox" be build too when I would run "make all"?

    ReplyDelete
  2. Hello Ali. Since dox is a recipe located in an automake.am directory then it could if the dependency Do xyfile.in is updated. But it isn't added directly to all: recipe. So I can give you a complicated answer: yes and no. Remember too, some autotools behavior changes with version so that complicates it further. Feeling better you asked?

    My automatic reaction to any question of autotools behavior is run it and see.

    ReplyDelete