automake
[Top][All Lists]
Advanced

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

How to add new Makefile-Rules through Configure?


From: Marc Wäckerlin
Subject: How to add new Makefile-Rules through Configure?
Date: Sun, 08 Mar 2015 23:29:40 +0100
User-agent: Roundcube Webmail/0.9.5

I didn't find any proper solution with google for the following problem:

How do the makefile rules come into the makefile?

E.g. when I use AC_PROG_CXX, in the makefile rules should be added, such as compiling .o from .cxx and to cleanup .o files, and so on - or ar these rules always there?

I would like to add something to configure.ac, that creates new rules, new cleanup files, etc.

e.g. for adding Qt support (or support for any other code generating tool):

uic creates uic_%.h files from %.ui and the derieved uic_%.h files should then be cleaned up with "make clean"

I found the following "hack" as solution:

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 $@ $<
-------------------------------------------

So, it works, but it is a dirty hack, and it doesnot resolve the problem of adding the derieved objects to CLEANFILES.

All ui-files in xxx_SOURCES should automatically add ui_xxx.hxx to the CLEANFILES, so:
-------------------------------------------
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?


Any ideas? What would be the intended solution?



If you need a working example:

I use this approach in my project
 https://dev.marc.waeckerlin.org/redmine/projects/libpcscxx
an m4 include file is in
https://dev.marc.waeckerlin.org/redmine/projects/libpcscxx/repository/raw/trunk/m4/ax_check_qt.m4
and used in
https://dev.marc.waeckerlin.org/redmine/projects/libpcscxx/repository/raw/trunk/configure.ac

Thank you
Regards
Marc
--
Marc Wäckerlin



reply via email to

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