Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[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

Back to the top