[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
- How to add new Makefile-Rules through Configure?,
Marc Wäckerlin <=
- Re: How to add new Makefile-Rules through Configure?, Bob Friesenhahn, 2015/03/08
- Part 2: Add Cleanfiles for User Defined Special Sources [Re: How to add new Makefile-Rules through Configure?], Marc Wäckerlin, 2015/03/09
- Re: Part 2: Add Cleanfiles for User Defined Special Sources [Re: How to add new Makefile-Rules through Configure?], Peter Johansson, 2015/03/09
- Re: Part 2: Add Cleanfiles for User Defined Special Sources [Re: How to add new Makefile-Rules through Configure?], Marc Wäckerlin, 2015/03/10
- Re: Part 2: Add Cleanfiles for User Defined Special Sources [Re: How to add new Makefile-Rules through Configure?], Vincent Torri, 2015/03/10
- Re: Part 2: Add Cleanfiles for User Defined Special Sources [Re: How to add new Makefile-Rules through Configure?], Bert Wesarg, 2015/03/10
- Re: Part 2: Add Cleanfiles for User Defined Special Sources [Re: How to add new Makefile-Rules through Configure?], Marc Wäckerlin, 2015/03/10
- Re: Part 2: Add Cleanfiles for User Defined Special Sources [Re: How to add new Makefile-Rules through Configure?], Thien-Thi Nguyen, 2015/03/10
Re: How to add new Makefile-Rules through Configure?, Gavin Smith, 2015/03/09