[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Post-Processing Step
From: |
Ralf Wildenhues |
Subject: |
Re: Post-Processing Step |
Date: |
Fri, 29 Sep 2006 08:51:22 +0200 |
User-agent: |
Mutt/1.5.13 (2006-09-08) |
Hello Mike,
* Mike Melanson wrote on Fri, Sep 29, 2006 at 02:55:55AM CEST:
>
> Is there an easy, official way to add a post-processing step to a
> Makefile.am? Specifically, after the primary build target is linked via
> autotool magic, how can I specify an extra 'objcopy' command to be
> executed on the linked binary? My best guess on this would be hijacking
> the 'all' target. Better solution?
You can use the all-local target to extend it. In order to be safe for
parallel make, it should depend on the files it needs, though.
Something similar to this:
all-local: mybinary
objcopy mybinary mynewbinary
Some ideas to improve this:
- you can make a separate rule for mynewbinary. This isn't only nicer
for clarity, it also helps `make' to remove the output file in case
you interrupt it during rule execution.
- objcopy is not portable (many GNU/Linux systems do not have it
installed), so maybe it would be better to have a configure test that
checks this and sets OBJCOPY to objcopy or to `:', or some other
replacement method to create the new from the old (dunny if `cp' as a
replacement would be good enough). Using AC_CHECK_TOOL, as in
AC_CHECK_TOOL([OBJCOPY], [objcopy], [:])
would even help to find a cross-compile objcopy
(I realize these notes may be marginal for you; but this list is for
others to read as well).
- In case this should be portable to cross-compilation from a unixy host
to a w32 system, the manual rules should use $(EXEEXT)
So we'd end up at something like
all-local: mynewbinary$(EXEEXT)
mynewbinary$(EXEEXT): mybinary$(EXEEXT)
$(OBJCOPY) mybinary $@
Cheers,
Ralf