Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
457 views
in Technique[技术] by (71.8m points)

gnu make - How to add custom targets in a qmake generated Makefile?

I use qmake to generate the Makefile, and that works well. However, sometimes I want to add more stuff to the generated Makefile without having to edit the generated Makefile.

Let's say that we beside the source code have a Doxygen directory, and there I need to run some doxygen commands to generate the documentation. So it would be nice to have this as a target in the main Makefile. But as default qmake do not understand this type of extra stuff.

So can I add something to tell qmake to include a secondary Makefile in the "doxygen" dir, or maybe add "extra targets" directly in the qmake config?


Maybe something like:

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I am working this same issue and so far I have had limited success using the QMAKE_EXTRA_TARGETS variable to build the docs target like so:

docs.depends = $(SOURCES)
docs.commands = (cat Doxyfile; echo "INPUT = $?") | doxygen -
QMAKE_EXTRA_TARGETS += docs

where Doxyfile has the basic doxygen config settings minus the INPUT symbol which I am appending via 'echo' to include only the unsatisfied Makefile dependencies in $(SOURCES).

This approach seems to work in that it only recreates documentation for source files that have changed which is good but I have encountered another problem in that my qmake project file is built with the debug_and_release CONFIG option so that it generates Makefile, Makefile.Debug, and Makefile.Release but SOURCES are only defined in the debug and release Makefiles forcing me to explicitly do a make -f Makefile.Debug docs instead of the more simple and intuitive make docs to build the docs.

Anybody ever tackled the problem from this QMAKE_EXTRA_TARGETS perspective before?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...