# Best way to pass an option to linker



## Peter2121 (Jun 9, 2016)

What is the best way to pass an additional option to linker during the port build?
Is it possible to pass the same option to all dependencies built for this port?

For example, I want to add the option "-rpath /root/lib" for ftp/wget port. I can do it adding the line 
	
	



```
LDFLAGS+=-rpath /root/lib
```
 to port's Makefile, but it can be overwritten during port update, and maybe it is not the best way - modify Makefile. And if I want to pass this option to all dependencies of the port - I should modify all Makefiles, it's difficult task. 
Maybe there is a better way??


----------



## tobik@ (Jun 9, 2016)

Peter2121 said:


> I should modify all Makefiles, it's difficult task.


Put it in /etc/make.conf. That's what it's there for 

The location of make.conf(5) can also be overridden per make invocation with e.g. `make __MAKE_CONF=/path/to/another/make.conf`.


----------

