Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » How to add a tool that doesn't have an output?(Is it possible to generate a makefile rule for a tool that doesn't actually have an output)
How to add a tool that doesn't have an output? [message #1794102] Thu, 23 August 2018 14:40 Go to next message
Kenny McCartney is currently offline Kenny McCartneyFriend
Messages: 1
Registered: August 2018
Junior Member

I'm trying (unsuccessfully) to add support for a new tool to our existing tool support in our Eclipse IDE, and I seem to be having problems. There are a few quirks with the new tool:
- it won't actually produce an output - it'll just update the executable file that is passed to it
- I don't want it to be the default target of the build command - I just want and additional target in the makefile that I can (optionally) call at some later point.

So, what I want to produce is something like this in the makefile.

# All Target
all: a.exe

# Tool invocations
a.exe: $(SRC_OBJS)
@echo 'Building target: $@'
# Usual build commands go here.

# Command for my new tool goes here. "MY_TOOL" is not the default make target
MY_TOOL: a.exe
@echo Running my new tool
my_new_tool a.exe [OPTIONS]

I've successfully added the tool and options to the project options, and I can update the options when I create a project, but nothing shows up in the makefile, and I suspect it's because there's no explicit target that I'm building for (and therefore Eclipse assumes that no makefile rule is required). Is there a trick here? Is there a way to ensure that the build command for my new tool is generated in the makefile, even though there's no (apparent) target?

I've been through the CDT plug-in developer guide, and I guessed that not defining an outputType element for the tool would be the way to go, but I had no luck with that, and I'm now stuck.

Re: How to add a tool that doesn't have an output? [message #1794250 is a reply to message #1794102] Tue, 28 August 2018 05:16 Go to previous message
David VavraFriend
Messages: 805
Registered: October 2012
Senior Member
Yes , they are called Phony targets

You don't actually have to declare them as phony. Just don't create the target file or have it lying about.
	-rm -f obj/*.o  obj/*.d obj/*.a 2>/dev/null
	-rm -f $(MYPROGS)
	-rm -f $(MYTESTS)

	@echo CWD=$(CWD)

Note you have to write your own makefile to use this.
CDT won't do it outside of the clean target.
If it's too much trouble from scratch then modify one created by Eclipse and turn off Generate Makefile automatically
Previous Topic:Attempting to debug Qt gui app with Eclipse
Next Topic:Can't find error location "Line 0" :-(
Goto Forum:

Current Time: Fri Nov 16 22:45:26 GMT 2018

Powered by FUDForum. Page generated in 0.01549 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top