jfowkes
jfowkes

Reputation: 1565

Can I run a post-build step after a makefile build in Eclipse?

I am trying to get a post-build step to run after building a makefile target from Eclipse. Since it's a makefile project, there are no Post-Build options.

I am aware of similar questions to this (such as this one), but unfortunately none of the answers work for me as the answer is essentially "put your build steps in the makefile". But my post-build step processes the build log that Eclipse generates, which of course doesn't exist until make completes.

Is there no way at all of running a post-build step after the make process has run? I'd accept that the answer is simply "no", but I'd appreciate if anyone can confirm that.

Upvotes: 1

Views: 1726

Answers (1)

HighCommander4
HighCommander4

Reputation: 52957

I'm not aware of a way to get Eclipse to perform an explicit post-build step in a makefile project, but it seems fairly straightforward to work around it. Here is one suggestion:

Write a second makefile called makefile-wrapper that looks like this:

all:
    make > build.log
    post-build-script.sh build.log

Then set the build command in Eclipse to make -f makefile-wrapper.

When Eclipse invokes make -f makefile-wrapper, it will run the recipe given above, which will invoke make again, saving its output to build-log.txt. The recursive invocation will use your real makefile (due to the absence of an -f argument in the recursive invocation), and save its output, which is then available for your post-build script to process.

Upvotes: 0

Related Questions