automake
[Top][All Lists]
Advanced

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

creating generic am files to be auto included by automake


From: Mr E_T
Subject: creating generic am files to be auto included by automake
Date: Sat, 26 Apr 2003 18:43:55 +0800 (WST)

Are there plans to allow a programmer to add generic am files to his package as
in the form of aclocal m4 files. Say to complement an m4 macro?

It would probably make thing easier for package designers.

I was thinking about somthing like automating things like this -

configure.ac
...
AC_ARG_ENABLE([final],
              [AC_HELP_STRING([--enable-final],
                           [build size optimized application - memory hungry])],
          [case "${enableval}" in
             yes) final=true ;;
             no)  final=false ;;
             *)   AC_MSG_ERROR(bad value ${enableval} for --enable-final) ;;
           esac],[final=false])
AM_CONDITIONAL(PKG_FINAL,test x$final = xtrue)

...

and in the Makefile.am

HMM_SOURCES = .....
if CG_FINAL
  nodist_cgtest_SOURCES = cgtest_final.cpp
  EXTRA_DIST += $(HMM_SOURCES)
else
  cgtest_SOURCES = $(HMM_SOURCES)
endif

...

if PKG_FINAL
  %_final.cpp: Makefile
        @$(ECHO) "preparing $@"
        @$(ECHO) $(ECHO_N) > $@
        @for h in $(HMM_SOURCES) ;\
          do \
            $(ECHO) $(ECHO_N) '#include "' >> $@ ; \
            $(ECHO) $(ECHO_N) $$h >> $@ ; \
            $(ECHO) '"' >> $@; \
          done
endif

...

If a programmer could put a "generic verison of the above int a autoincluded m4
file tagged to the m4 macro above the the stub could be used by any programmer
wanting to use the package .


I was envisiging a solution like -

aclocal.m4

....

AC_DEFUN([AM_FINAL_PROG],
[
  AC_ARG_ENABLE([final_prog],
    [AC_HELP_STRING([--enable-final],
       [build size optimized application - memory hungry])],
    [
      case "${enableval}" in
        yes) final_prog=true ;;
        no)  final_prog=false ;;
        *)   AC_MSG_ERROR(bad value ${enableval} for --enable-final) ;;
        esac
    ],[final_prog=false])
  AM_CONDITIONAL(FINAL_PROG,test x$final_prog = xtrue)
])

.....

configure.ac

......

AM_FINAL_PROG

.....

src/Makefile.am

.....

## intead of using prog_SOURCES
prog_FINALSOURCES = ....

.....

admin/Makestubs.am

if FINAL_PROG
  nodist_%DIR%SOURCES = %DIR%final.cpp
  EXTRA_DIST = $(%DIR%FINALSOURCES)
else
  %DIR%SOURCES = $(%DIR%FINALSOURCES)
endif
CLEANFILES = %DIR%final.cpp

%DIR%final.cpp: Makefile
        @$(ECHO) "preparing $@"
        @$(ECHO) $(ECHO_N) > $@
        @for h in $(%DIR%FINALSOURCES) ;\
          do \
            $(ECHO) $(ECHO_N) '#include "' >> $@ ; \
            $(ECHO) $(ECHO_N) $$h >> $@ ; \
            $(ECHO) '"' >> $@; \
          done


I would think that automake would source the "CONFIG_AUX_DIR" of the package
then various package automake/am dirs (probably in an aclocal like dirlist) to
produce an Makefile.am.tmp which is then parsed using the
/usr/share/automake-.../am/ files to produxe the Makefile.in.

It would seem to me that this would allow programmers a great deal more
flexibility to add their own package compiler/program requirements that are
easily integrated into new p[rojects.

Currently the kde developers use a perl script to
physically change the Makefile.in before autoconf converts it to a Makefile.

A solution like this would make things a lot easier.

 --
regs MR E_T
_______________________
\                      \
  \   OOHH I hate TYPOS  \
    \                      \
      ~~~~~~~~~~~~~~~~~~~~~~~




-- 
regs MR E_T
_______________________
\                      \
  \   OOHH I hate TYPOS  \
    \                      \
      ~~~~~~~~~~~~~~~~~~~~~~~





reply via email to

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