# Unable to override default build target with CMake



## m4r1n (Mar 1, 2015)

Hi,

I'm trying to build a port candidate for LizardFS, a distributed file system. The whole software builds fine. Now, I want to add Makefile options so that one may only build certain components instead of the whole package. This is where I'm stuck.

LizardFS uses devel/cmake to generate the final Makefile. If I run `make` manually, I'm able to build a specific target, e.g. `make manpages`.

Before defining Makefile options, I first tried to override the default build target. I added the ALL_TARGET variable in the port's Makefile. I hoped I could override the default value:


```
# $FreeBSD$

PORTNAME=            lizardfs
PORTVERSION=         2.5.4
CATEGORIES=          sysutils

USE_GITHUB=          yes
GH_ACCOUNT=          lizardfs
GH_COMMIT=           217dff7

MAINTAINER=          marin@-
COMMENT=             A fault-tolerant distributed file system, forked from MooseFS

USERS=               mfs
GROUPS=              mfs

LIB_DEPENDS=         libxml2.so:${PORTSDIR}/textproc/libxml2 \
                     libxslt.so:${PORTSDIR}/textproc/libxslt
BUILD_DEPENDS=       asciidoc:${PORTSDIR}/textproc/asciidoc \
                     docbook:${PORTSDIR}/textproc/docbook
USES=                cmake:outsource
CMAKE_BUILD_TYPE=    Release

USE_RC_SUBR=         mfscgiserv \
                     mfschunkserver \
                     mfsmaster \
                     mfsmetalogger
					 
ALL_TARGET=          manpages

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

As expected, running `make` launches the manpages target build. It builds fine, and the mfs user and groups even get created. Yet, immediately after the manpages target build has ended, another build starts over and builds the other targets, as if `make all` was used.

I'm sure I'm missing something. What is the proper way to only build a specific target in the port tree ?

Many thanks!

Marin.


----------

