3

I'm trying to make a small change to an automake build.

The system to modify uses configure.ac and Makefile.am inputs. For a single object file within one subdirectory I have to invoke a script before compiling, to patch config info into the build.

I don't see the right location to allow such pre-processing ahead of compiling this specific C file. What I've tried is to insert an additional target into

all: all-am

But this seems not to be the way to go and in addition I wasn't able to figure how to overload this generated line.

1 Answer 1

0

You should be able to add in a special target for the object file in question in your Makefile.am. Something like:

file.o: file.c
    $(CC) $(CFLAGS)  -c file.c
    modification.sh file.o

This should cause modification.sh to be run on the object file whenever it gets built.

2
  • Thanks I will try that. What I found in between were the automake targets BUILD_SOURCES all-local This way I can inject similar things. Nov 29, 2011 at 16:36
  • 1
    This is probably the right way, but not that if your modification script fails, it will leave an unpatched but seemingly up to date file.o lying around. It might be better to chain the commands like file.c -> file.o.tmp -> file.o. Dec 2, 2011 at 13:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .