automake
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Part 2: Add Cleanfiles for User Defined Special Sources [Re: How to add


From: Marc Wäckerlin
Subject: Part 2: Add Cleanfiles for User Defined Special Sources [Re: How to add new Makefile-Rules through Configure?]
Date: Mon, 09 Mar 2015 09:34:04 +0100
User-agent: Roundcube Webmail/0.9.5

Just to state my intention: I want to ad a couple of M4-Macros to support users of now unsupported build tools, namely doxygen, Qt, dpkg-buildpackage, rpmbuild, ...; then I will deliver those as M4 macro library that can be included in configure.ac and that should do as much as possible "automagically" - as usual within the autotools.

Am 09.03.2015 02:04, schrieb Bob Friesenhahn:
-------------------------------------------
bin_PROGRAMS = cardgui
cardgui_SOURCES = cardgui.cxx cardgui.hxx \
                 password.hxx cardgui-model.hxx \
                 cardgui.ui password.ui
-------------------------------------------
Should generate "CLEANFILES += ui_cardgui.hxx ui_password.hxx". How can I achieve this?

There are other ways to accomplish cleaning besides CLEANFILES.  You
should be able to solve the problem by adding a 'clean-local' target
since then you can invoke arbitrary multi-line shell code and can
reference Makefile variables.

Yes, that would work too, but not in my case. There cannot be multiple 'clean-local' targets in the same makefile. So if I would define a 'clean-local' target in my M4-Library, then a user of my macros could no more write his own 'clean-local' target. But my stuff must be 100% transparent und "invisible" to the end user. As usually in Automake, it should "just work" without bothering the end user with implementatin details.

I had an idea and found a solution for the CLEANFILES-problem: I have seen in a generated makefile, that there is a definition of the variable SOURCES that concatenates all xxx_SOURCES variables, e.g.:
-------------------------------------------
SOURCES = $(libpcscxx_la_SOURCES) $(cardgui_SOURCES) \
        $(nodist_cardgui_SOURCES) $(versiontest_SOURCES)
-------------------------------------------

That means, in this case, I can rely on SOURCES and simply add lines to the makefile, such as:
-------------------------------------------
BUILT_SOURCES = ${BUILT_SOURCES} $(shell echo ${SOURCES} | tr ' ' '\n' | sed -n ',\(.*\).ui,ui_\1.hxx,p')
CLEANFILES = ${CLEANFILES} ${BUILT_SOURCES}
-------------------------------------------

Where the user only has to write:
-------------------------------------------
myprog_SOURCES = file1.cxx file2.cxx auifile.ui anotheruifile.ui
-------------------------------------------


Remains the basic question:

*******************************************
How can I add something to a makefile within the configure script, respectively within an m4 macro that is include in a configure script?
*******************************************

Or in other words: How can I manipulate the makefile without touching makefile.am?

Is my hack acceptable, or is there a proper way to do it?



From my last mail, my hack is:

In ax_check_qt.m4 that I include in configure.ac, I add:
-------------------------------------------
  AX_ADDITIONAL_QT_RULES_HACK='
%_ui.hxx: %.ui
        ${UIC} -o address@hidden $<

moc_%.cxx: %.hxx
        ${MOC} -o address@hidden $<'
  AC_SUBST(AX_ADDITIONAL_QT_RULES_HACK)
])
-------------------------------------------

In the makefile, automake copies the variable, but is unable to handle the multi-line content, so the rules go straight into the makefile:
-------------------------------------------
AX_ADDITIONAL_QT_RULES_HACK =
%_ui.hxx: %.ui
        ${UIC} -o $@ $<

moc_%.cxx: %.hxx
        ${MOC} -o $@ $<
-------------------------------------------



Thank you
Regards
Marc
--
Marc Wäckerlin



reply via email to

[Prev in Thread] Current Thread [Next in Thread]