Hi Sheldon,
One incorrect thing I’m
seeing in your code is that you are using instantiating the internal
MakeTargetManager class, while you should be using the default instance
provided via the org.eclipse.cdt.make.core.MakeCorePlugin.getTargetManager().
See the org.eclipse.cdt.make.ui.actions.BuildTargetAction
for the reference of using the make target API.
Mikhail
From:
cdt-dev-bounces@xxxxxxxxxxx [mailto:cdt-dev-bounces@xxxxxxxxxxx] On Behalf Of Sheldon Dsouza
Sent: Thursday, August 02, 2007
5:28 PM
To: CDT
General developers list.
Subject: [cdt-dev] creating make
targets programatically
Hi,
The launch of our applications occurs only after
a make install is done on the
application. I would like to automate this process instead of having the user
create this target for his project and building it.
So i have come up with the following solution which is done after a build is
performed on a project
MakeTargetManager mgr = new MakeTargetManager();
mgr.startup();
IMakeTarget target =
mgr.findTarget(getProject(), "install");
if( !mgr.targetExists( target )) {
mgr.addTarget(getProject(),mgr.createTarget(getProject(), "install",
"sbmaketargetbuilder"));
}
IMakeTarget [] targets = mgr.getTargets(
getProject());
for(int i=0;i<targets.length;i++) {
if( targets[i].getName().equals("install"))
{
System.out.println("installing application (5)");
targets[i].build( new NullProgressMonitor());
break;
}
}
mgr.shutdown();
Here i have created a make install target using the API's available. But i am
facing problems, the build using this target does not occur.
Is this the right soution or i am making a mistake some place.
Regards,
Sheldon