[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
FW: AC_SUBST_FILE
From: |
wolfgang haefelinger |
Subject: |
FW: AC_SUBST_FILE |
Date: |
Thu, 16 Dec 2004 09:42:20 +0100 |
Hi,
my Makefile.in looks like this:
=== Makefile.in ==============
## ...
@stdrules@
===============================
where "stdrules" is a AC_SUBST_FILE() variable, ie. my
configure.in (yes, should be configure.ac - I know)
contains something like
stdrules="scripts/stdrules.mk"
AC_SUBST_FILE(stdrules)
The idea of "stdrules" is to provide all standard rules
in a automatic way, ie. I don't want to touch N Make-
files just because I made a small typo.
So for example, "scripts/stdrules.mk" shall contain a
rule to regenerate "Makefile" if corresponding
Makefile.in has changed:
========= scripts/stdrules.mk ======================
#subdir = @????@
Makefile : @abs_top_srcdir@/$(subdir)/Makefile.in
@echo "*** remake $(subdir)/Makefile"
@cd @abs_builddir@ && /bin/sh ./config.status $(subdir)/Makefile
====================================================
To get this to work, substitution of autoconf vars
need to take place (and as a side issue here - I like
config.status to compute the value for $(subdir) ).
And I like to apologize that I'm not using "automake"
The solution I found then later myself is the same as
Olaf (thanks) sent me today:
--- autoconfig.ac ---
common_mk=common.mk
AC_SUBST_FILE(common_mk)
AC_CONFIG_FILES([common.mk:common.in])
-----------------------
This works fine but one has to make sure that "common.mk"
gets generated before any other (Make)files using
"common.mk". In other words, "common.mk" needs to be the
very first listed in AC_CONFIG_FILES ( or the last if
autoconf one day change creation order).
So this solution works but appears a bit hackish..
Another solution is to create "common.mk" on the fly
while running "configure". For instance:
--- autoconfig.ac ---
common_mk=common.mk
AC_SUBST_FILE(common_mk)
cat >> common.mk << EOF
common rules go here ..
EOF
-----------------------
This works also but unfortunatly lot's of interesting
values are not fully computed.
For example, the value of $exec_prefix appears to be always
NONE. No idear why it has not it's final value while my
code gets executed.
Regards,
Wolfgang.
- AC_SUBST_FILE, wolfgang haefelinger, 2004/12/15
- FW: AC_SUBST_FILE,
wolfgang haefelinger <=