From owner-freebsd-questions@FreeBSD.ORG Wed Sep 7 13:55:49 2005 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id F26B116A421 for ; Wed, 7 Sep 2005 13:55:48 +0000 (GMT) (envelope-from keramida@ceid.upatras.gr) Received: from kane.otenet.gr (kane.otenet.gr [195.170.0.95]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8EE9943D80 for ; Wed, 7 Sep 2005 13:55:43 +0000 (GMT) (envelope-from keramida@ceid.upatras.gr) Received: from orion.daedalusnetworks.priv (aris.bedc.ondsl.gr [62.103.39.226]) by kane.otenet.gr (8.13.4/8.13.4/Debian-1) with SMTP id j87DtfLF015236; Wed, 7 Sep 2005 16:55:41 +0300 Received: from orion.daedalusnetworks.priv (orion [127.0.0.1]) by orion.daedalusnetworks.priv (8.13.4/8.13.4) with ESMTP id j87DtfJw010351; Wed, 7 Sep 2005 16:55:41 +0300 (EEST) (envelope-from keramida@ceid.upatras.gr) Received: (from keramida@localhost) by orion.daedalusnetworks.priv (8.13.4/8.13.4/Submit) id j87DtfuH010350; Wed, 7 Sep 2005 16:55:41 +0300 (EEST) (envelope-from keramida@ceid.upatras.gr) X-Authentication-Warning: orion.daedalusnetworks.priv: keramida set sender to keramida@ceid.upatras.gr using -f Date: Wed, 7 Sep 2005 16:55:41 +0300 From: Giorgos Keramidas To: Nils Vogels Message-ID: <20050907135540.GA10237@orion.daedalusnetworks.priv> References: <431EE940.30604@yuckfou.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <431EE940.30604@yuckfou.org> Cc: freebsd-questions@freebsd.org Subject: Re: Makefile woes X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Sep 2005 13:55:49 -0000 On 2005-09-07 15:21, Nils Vogels wrote: > Hi there ! > > I'm trying to write a Makefile and it's my first time writing a bit more > complex one .. I seem to be stuck and examples currently are not very > helpful, so I thought I'd try here: > > What I am trying to do is differ the way of building depending if a > variable has been defined, my current Makefile looks like this: > > build_1: > @cd /build/dir && make OPTION=set > > build_2: > @cd /build/dir && make > > build: > .if defined(WANT_OPTION) > HAS_OPTION?=1 > ${MAKE} build_1 > .else > HAS_OPTION?=0 > ${MAKE} build_2 <-- error in this line > .endif If the indentation shown above is what you are truly using and not what your mailer thinks is a good way to format it, you are missing vital whitespace before the build commands of the ``build'' target. Please note that the above makefile will build the build_1 target by default, as this is the first target that appears in the Makefile. I'd probably write this a little differently, moving all the conditional material out of the target build commands: # # Pick the default target, depending on WANT_OPTION. # .if defined(WANT_OPTION) HAVE_OPTION?= 1 BUILD_TARGET= build_1 .else HAVE_OPTION?= 0 BUILD_TARGET= build_2 .endif build: $(BUILD_TARGET) build_1: @cd /build/dir && make OPTION=set build_2: @cd /build/dir && make > Whenever I run "make build" I get: > > "Makefile", line xx: Need an operator > make: fatal errors encountered -- cannot continue This is usually an indication of whitespace/indentation errors.