How to add custom targets in a qmake generated Makefile?

后端 未结 4 1622
野趣味
野趣味 2020-12-06 17:28

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 Makefil

4条回答
  •  感动是毒
    2020-12-06 18:05

    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?

提交回复
热议问题