Doxygen and definitions from makefile - doxygen

I'm using Doxygen to generate documentation for some code. I have a large makefile with a lot of OPT+=-DSOME_OPTION that I want to Doxygen to take into account when it analyses the code, since parts of the code are conditionally compiled.
I know there is a an option PREDEFINED in the Doxygen configuration file that specifies macro names that are defined for the preprocessor, but I do not want to manually update this list every time a change happens in the makefile. In essence I want to set the PREDEFINED option to scan the makefile for compilation definitions and be automatically updated.
Is this possible with Doxygen?

Related

Refreshing the macro library

I've been using a macro library so that I can use macros without compiling them first. The problem is that when I change the macro and save it, then refresh my filename for the macro lib, this is not enough to update and use the new macro?
Anyone have any ideas why it is still using and compiling the old macro before it was saved?
The first time a macro is called, if it hasn't already been defined, SAS will check your autocall path and iterate through those locations trying to find it.
When it finds the macro in your autocall library it compiles it and saves the compiled version to your work folder. Subsequent calls to the macro will result in SAS using the compiled version of the macro.
In order for it to be refreshed (if you have made changes since it was compiled) you need to open the code to the macro and submit it again. That will redefine/recompile it for you.
Alternatively, you could also find the catalog in your work folder that contains the compiled versions of the macros and delete it from there (typically work.sasmacr).
Robert explains why you see the behavior.
I use the following to easily reinclude a changed macro. This assumes you have a FILENAME called MACROREF defined to the folder in question.
%include MACROREF(my_macro);
Obviously change the my_macro to the macro you need to be compiled.
filename macroref "c:\temp";
%include MACROREF(MacroOne);
If you have a folder full of macros (as stated in the comments) you can include the whole folder.
%include "%sysfunc(pathname(MACROREF))/*.sas";
This will recompile the whole folder. Just don't have any non-macro sas files in that folder, otherwise you are running them too.

Cond statement doxygen does not work

I am trying to separate out internal and external documentation using the doxygen constructs of cond; but i just cant seem to get get it working. I would essentially like to exclude some files completely and not conditionally. Regardless of where i add the tag (before include, before header guards etc) , the files and source both show up.
What i have tried in vain is to take the test file from doxegen repo for
conditional test and add it to the project.
Steps to reproduce [Linux]
create a new directory.
copy paste the above file (had to rename it to .h as .c was passed over?).
generate dummy config via doxygen -g.
update Doxyfile ENABLED_SECTION = COND_ENABLED.
Run doxygen.
check html/index.html
This however is still visible in the html documentation it generates for the project. I have set the ENABLED_SECTION variable with other values , but cond_enabled function still shows up. Running the testing directory of the project (doxygen) it passes. So i am lost.
Any suggestions?
Tried with latest version 1.8.14.
Thanks!
Regarding the \cond problems (not an answer directly to the real problem you face, I think, but to long for a comment).
The mentioned file is used in the, limited, testing doxygen can do / does and the first lines contain some instructions on what to do. Furthermore there is a default Doxyfile with the tests in use. It is hard to run a separate test outside the doxygen build tree.
Regarding the remark "Running the testing directory of the project (doxygen) it passes." This is correct, here, at the moment, only testing is done against the XML output and the generated output is compared to a once created version of the XML output. No tests are done, at the moment, in respect to HTML or PDF / LaTeX. Recently the test framework has been slightly extended so in the future this should be possible (compare the xhtml and tex output, but some work has still to be done here).
The version of the parser sees the \cond in the first line (normal C comment) as a doxygen command and skips everything till the first \endcond (your friend in these cases is always doxygen -d preprocessor). I think that removing / modifying the first line will result in an already better result. There is however another hiccup for e.g. HTML output. As the function cond_enabled is not documented and EXPAND_ALL is not set to YES the function will not appear in the documentation. So best is also to add a line of documentation with the function cond_enabled.
Regarding the seen HTML problems I modified the the relevant test in doxygen slightly and pushed a proposed patch to github (pull request 714, https://github.com/doxygen/doxygen/pull/714).
Note: the problem of skipping the \cond in normal C comment is quite a bit harder to implement (seen the logical complexity of the doxygen code in pre.l and commentcnv.l.
EDIT: 2018/06/10: The push request has been integrated in the master version on github.

How to ignore generated code in doxygen

So, we are using doxygen in a big project.
Some of the source code is generated during the build,
like my_generated_code_fragment.h
It is used in the source code, like this
file foo.cc
void foo()
{
#include "my_generated_code_fragment.h"
}
Now, when running doxygen from the repository under source control,
doxygen rightly complain that file my_generated_code_fragment.h is missing,
with an error like:
foo.cc:1234: warning: include file my_generated_code_fragment.h not
found, perhaps you forgot to add its directory to INCLUDE_PATH?
Problem
We don't want to perform a full build first, just to generate the missing
files, in order to generate documentation.
Note that the generated code does not contain doxygen comments anyway.
Solution considered so far
Do Nothing
Do nothing and ignore doxygen errors.
Not really satisfactory.
Generate dummy files
Generate dummy files like my_generated_code_fragment.h prior to running
doxygen.
This creates complications in the build scripts,
where "using doxygen" is now different on different projects,
because the files containing generated code differs.
Use preprocessor flags
Change the code to
void foo()
{
#ifndef IN_DOXYGEN
#include "my_generated_code_fragment.h"
#undef IN_DOXYGEN
}
and set PREDEFINED
This is the best solution considered so far, but it means changing the code.
Question
Is there a better option, like tell doxygen using a setting in Doxyfile
that file my_generated_code_fragment.h is expected to be missing,
and should be ignored ?
Note:
EXCLUDE does not work for this,
as the error is seen when parsing file foo.cc, not when parsing the generated code.
Using doxygen version 1.8.5 at the moment.
Documenting the solution taken then.
Solution 3, to use pre-processor flags when building with doxygen, and changing the (small) parts of the code that uses generated content worked well.
This allows to use doxygen on "raw" source code, pulled from git.

Joining files in Coffescript

I am currently looking to use RequireJS to ensure modularity in the front end side of my project written in Coffeescript. Is there a way to use "import" directives in coffeescript so that you could recursive compile a large number of ".coffee" files into a single ".js" file - and potentially minify it too. I know there is a "join" argument you can pass to the coffeescript compiler, but it would be really useful to just reference files from one to another.
Secondly, it should be able to do this compilation really fast, so that the filewatcher can immediately change the entire output .js file every time any file (out of hundreds of files) was changed.
In addition, if it provided inbuilt minification/obfuscation that would be GREAT!

Generating a global include graph in Doxygen

Doxygen can generate graphs showing which files in a project include which others, as a directed graph. This is a nice tool, but it only comes in two flavors, namely showing all the files that include (directly or indirectly) a given file, or all the files that are included (again directly or indirectly) by a given file.
I would like to generate a global include graph, containing all the files that Doxygen knows about, and showing the include structure. Is that possible?
One trick that kind of works but feels extremely dirty: add some dummy.h header somewhere, and include it from every other file, or alternatively (a bit cleaner since it doesn't need to touch the other files) have dummy.h manually include everything else. And then manually remove useless includes (which are implied by others as indirect dependencies). That is not the right way to do it...