This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 270147 - Typing "make clean" on an IDE-built project deletes shared libraries that were NOT built but just linked
Summary: Typing "make clean" on an IDE-built project deletes shared libraries that wer...
Status: NEW
Alias: None
Product: cnd
Classification: Unclassified
Component: Project (show other bugs)
Version: 8.2
Hardware: Macintosh Mac OS X
: P3 normal (vote)
Assignee: ilia
URL:
Keywords:
Depends on: 255959
Blocks:
  Show dependency tree
 
Reported: 2017-03-21 04:44 UTC by devel4astro
Modified: 2017-03-31 04:58 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
This is one my projects that has the annoying behavior (23.96 KB, application/zip)
2017-03-24 05:55 UTC, devel4astro
Details

Note You need to log in before you can comment on or make changes to this bug.
Description devel4astro 2017-03-21 04:44:48 UTC
Product Version = NetBeans IDE 8.2 (Build 201609300101)
Operating System = Mac OS X version 10.11.6 running on x86_64
Java; VM; Vendor = 1.8.0_111
Runtime = Java HotSpot(TM) 64-Bit Server VM 25.111-b14

Reproducibility: Happens every time

==>c++ build

Hello,

My issue is not with the IDE per se -- it seems to work great. My complaint is with the IDE-generated makefile. For my project I link to a couple of shared-libraries, but in the
linker area I specifically tell the IDE NOT to copy these shared libraries -- just link to them. The IDE seems to obey these instructions just fine. Using the IDE to build and run my project
seems to work great. 

However, I also want to be able to build and run from the shell. (I use tcsh on Mac OSX Yosemite.) Generally, I don't have a problem. But for some reason a "make clean" decides
to delete the shared libraries this project is linked to (and didn't build). I don't want that to happen, but I can't seem to control the behavior of "make clean" in the IDE. My fix is to define a new target 
in the makefile called "cleansafe" which does what I want. 

Is there a way to force the IDE to define "clean" in the Makefile so that it only cleans things that it actually builds when running "make clean" from the command line? (Again, none of this is a problem when cleaning/building within the IDE.)

Thanks for your help,
David
Comment 1 ilia 2017-03-23 06:43:12 UTC
Hi David. Could you please provide a sample project which causes this behavior?
Comment 2 devel4astro 2017-03-24 05:55:41 UTC
Created attachment 163930 [details]
This is one my projects that has the annoying behavior

Thanks again for your help. I've worked around this issue by manually removing the build directory when I want to clean the project; i.e., rm -rf build/*. That way it doesn't try to delete the linked shared libraries that it shouldn't.
Comment 3 ilia 2017-03-24 13:14:16 UTC
I am able to reproduce something similar to the behavior you're describing.

But for me it's quite strange that doing "make clean" from the IDE and from command line gives different results.

Could you, please, execute clean on both IDE and command line and paste an output here?
Does $IXRAYSOFT same in IDE and command line?

(This is a note for me: logic may broken here: ConfigurationMakefileWriter.java:1480)
Comment 4 devel4astro 2017-03-25 04:51:46 UTC
Gosh. I just noticed that indeed it behaves the same way in the IDE. I don't know why I didn't experience that before. So that's good at least -- IDE & make from shell do exactly the same thing.

At any rate, I don't want the behavior where "clean" removes the shared libraries. Any suggestions on how I can prevent that?

Thanks for your help,
David
Comment 5 ilia 2017-03-27 07:10:06 UTC
The easy workaround is to redefine "clean" target in a main Makefile.
I see you added a "cleansafe" target here. Just rename it to "clean" and remove "clean .clean-pre .clean-post" lines defined by IDE (lines 64-71).

IDE won't re-generate this Makefile, so this fix seems to be OK for one project.
But this behavior certainly looks like a bug so this issue is expected to be fixed.

By the way, since 8.2 NetBeans has a great 'launchers' feature.
Right click on the project -> Manage launchers. You can create a custom command (i.e. sh -c "make cleansafe && make && echo SUCCESSFUL"). This command will be executed from IDE when you run the launcher (Right click on the project -> Run -> <Your new launcher>).
Comment 6 devel4astro 2017-03-31 04:58:54 UTC
Right. I'll just have to make new definitions for clean. Thanks a lot for pointing out the "launchers" feature. That looks very promising for customizing the build from within the IDE.

Thanks again,
David