automake
[Top][All Lists]
Advanced

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

What is the proper way to add unconventional outputs (e.g. *.res files)?


From: Jerker Bäck
Subject: What is the proper way to add unconventional outputs (e.g. *.res files)?
Date: Wed, 22 Aug 2007 22:45:35 +0200

Hello all,
I wonder what the proper way is to add an unconventional output (other than
*.o or *.obj) to the Makefile objects. As an example, here's a working way
to add rc resources to a Makefile (output from the resource compiler
rc.exe). It uses the BUILT_SOURCES and adds the output via the LDADD macro.
Working, but not so very pretty.

configure.ac
------------------------------------------
m4_define([prog_version_major],   [1])
m4_define([prog_version_minor],   [2])
m4_define([prog_version_release], [3])
            ...
AC_INIT([prog], [prog_full_version], address@hidden)

# Add support for rc version resource
AC_ARG_ENABLE(use_rc, 
  AC_HELP_STRING(--enable-use_rc, support rc version resource),
  [if test "$enableval" = yes; then
    AC_MSG_RESULT([Adding support for rc version resource])
    AC_CHECK_PROG(RSC, 'rc.exe -?', rc.exe)
    AC_SUBST(RCFLAGS)
    AC_DEFINE([PROG_VERSION_MAJOR], [prog_version_major],
        [The major version number of this release])
           ...
  fi], enable_use_rc=no)
AM_CONDITIONAL(USE_RC_RESOURCE, [test "x$enable_use_rc" != xno])
------------------------------------------

Makefile.am
------------------------------------------
if USE_RC_RESOURCE
# add resource script to sources
prog_SOURCES += prog.rc
prog_LDADD += prog.res
BUILT_SOURCES = prog.res
CLEANFILES = *.res
endif

# resource compile
.rc.res:
  $(RSC) $(RCFLAGS) $(INCLUDES) $(DEFAULT_INCLUDES) -fo $@ $<
------------------------------------------

=> resulting Makefile
------------------------------------------
am__append_1 = prog.rc
am__append_2 = prog.res
am__objects_1 = 
am_prog_OBJECTS = $(am__objects_1)
prog_SOURCES = $(am__append_1)
prog_OBJECTS = $(am_prog_OBJECTS)
prog_DEPENDENCIES = $(am__append_2)
prog_LDADD = $(am__append_2)
------------------------------------------

How to automatically get prog.res in $(prog_OBJECTS) instead of
$(prog_LDADD)?

Thanks Erik







reply via email to

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