# Will `make clean` clean the dependencies?



## jronald (Mar 16, 2010)

Will `make clean` clean the dependencies, which is not dependent by others?

Just now I tried to install gnome2-lite using port:
firstly I run `make`, error occurs,
I ignored the error and run `make install`, it seems working - downloading, compiling, linking, but after several hours, error occurs, I don't know how to fix it
(need an automatic way  ), so I want to rollback it, does `make clean` help here?
BTW, I found disk usage grows when `make clean` is done.
Thanks in advance.


----------



## fronclynne (Mar 16, 2010)

`# make clean` should catch the dependencies, however the simplest and most straight-forward way of removing the build directories is `# rm -r /usr/ports/*/*/work` (or, if you have [red]WRKDIRPREFIX=[/red] set, the relative equivalent under that).

If old or mis-set options are causing trouble, `# make rmconfig` in the relevant port directory, or (assuming that's not catching what you want) you can remove directories under /var/db/ports/.


----------



## sixtydoses (Mar 16, 2010)

jronald said:
			
		

> Will `make clean` clean the dependencies, which is not dependent by others?
> 
> Just now I tried to install gnome2-lite using port:
> firstly I run `make`, error occurs,
> ...



I think what you're looking for is `# make clean-depends`. `# make clean`, as fronclynne mentioned earlier, is similar to `# rm -r /usr/ports/*/*/work`.



```
# clean                 - Remove ${WRKDIR} and other temporary files used for building.
# clean-depends - Do a "make clean" for all dependencies.
```


You could refer for more make options in /usr/ports/Mk/bsd.port.mk.


----------



## phoenix (Mar 16, 2010)

fronclynne said:
			
		

> `# make clean` should catch the dependencies,



No, it won't.  *make clean* only cleans the work directory for the current port.
`# make clean-recursive` will clean out the work directory for the current port, and the work directories for all dependencies of the current port.

`# rm -rf /usr/ports/*/*/work` will clear out all the work directories for all ports.  As will using `# portsclean -CDD`, which is part of the portupgrade suite of tools.


----------



## gcooper@ (Mar 21, 2010)

phoenix said:
			
		

> No, it won't.  *make clean* only cleans the work directory for the current port.
> `# make clean-recursive` will clean out the work directory for the current port, and the work directories for all dependencies of the current port.
> 
> `# rm -rf /usr/ports/*/*/work` will clear out all the work directories for all ports.  As will using `# portsclean -CDD`, which is part of the portupgrade suite of tools.



`find /usr/ports -name work -mindepth 2 -maxdepth 3 | xargs rm -Rf`

would be a safer bet -- especially because the globbing could go over the shell argument character limit.


----------



## l2f (Nov 20, 2017)

More safer: -type d = directory


```
find /usr/ports -type d -name work -mindepth 2 -maxdepth 3 | xargs rm -Rf
```


----------

