# Compile optional code



## sprock (Oct 21, 2020)

Hello,

In slurm-wlm there is some contributed code that can be compiled separately using

```
gmak contrib
gmake install-contrib
```

I have added an option to the slurm-wlm port to enable this code to be built, but I don't know how to carry out the work.  What I have at the moment is this rather naiive effort:


```
.include <bsd.port.options.mk>

pre-install:
.if  ${PORT_OPTIONS:MCON}
        @${CD} ${WRKSRC}
        @${MAKE} contrib
.endif

post-install:
        ${INSTALL_DATA} ${WRKSRC}/etc/slurm.conf.example \
                ${STAGEDIR}${PREFIX}/etc/slurm.conf.sample
.if  ${PORT_OPTIONS:MCON}
        @${CD} ${WRKSRC}
        @${MAKE} install-contrib
.endif
```

The port builds in poudriere with both testport & bulk but the contrib code is not being built.   I would appreciate some pointers or indication of what parts of the porters handbook I should explore.

Thanks.


----------



## SirDice (Oct 21, 2020)

sprock said:


> I would appreciate some pointers or indication of what parts of the porters handbook I should explore.











						Chapter 5. Configuring the Makefile
					

Configuring the Makefile for FreeBSD Ports




					www.freebsd.org


----------



## sprock (Dec 11, 2020)

A very belated thank you for your help.
sprock


----------

