| # | 
 | #    Copyright (c) 2010-2011 Nest, Inc. | 
 | #    All rights reserved. | 
 | # | 
 | #    This document is the property of Nest. It is considered | 
 | #    confidential and proprietary information. | 
 | # | 
 | #    This document may not be reproduced or transmitted in any form, | 
 | #    in whole or in part, without the express written permission of | 
 | #    Nest. | 
 | # | 
 | #    Description: | 
 | #      This file is the make file for the daemon-monitoring daemon | 
 | #      (DMD), monit. | 
 | # | 
 |  | 
 | BuildConfigSpecialized	:= No | 
 | BuildProductSpecialized	:= No | 
 |  | 
 | include pre.mak | 
 |  | 
 | PackageName		:= monit | 
 |  | 
 | PackageExtension	:= tar.gz | 
 | PackageSeparator	:= - | 
 |  | 
 | PackageArchive		:= $(PackageName).$(PackageExtension) | 
 | PackageSourceDir	:= $(PackageName)$(PackageSeparator)$(PackageVersion) | 
 |  | 
 | PackageBuildMakefile	= $(call GenerateBuildPaths,Makefile) | 
 |  | 
 | PackageBuildConfigure	= $(call GenerateBuildPaths,configure) | 
 |  | 
 | LicenseSourceFiles	:= LICENSE COPYING | 
 | LicenseSourcePaths      := $(addprefix $(PackageSourceDir)/,$(LicenseSourceFiles)) | 
 |  | 
 | CleanPaths		+= $(PackageLicenseFile) | 
 |  | 
 | OpenSSLDir		:= sw/tps/openssl | 
 | OpenSSLIncDir		:= $(call GenerateResultPaths,$(OpenSSLDir),usr/include) | 
 | OpenSSLLibDir		:= $(call GenerateResultPaths,$(OpenSSLDir),usr/lib) | 
 |  | 
 | ZlibDir			:= sw/tps/zlib | 
 | ZlibIncDir      	:= $(call GenerateResultPaths,$(ZlibDir),usr/include) | 
 | ZlibLibDir      	:= $(call GenerateResultPaths,$(ZlibDir),usr/lib) | 
 |  | 
 | all: $(PackageDefaultGoal) | 
 |  | 
 | # Generate the package license contents. | 
 |  | 
 | $(LicenseSourcePaths): source | 
 |  | 
 | $(PackageLicenseFile): $(LicenseSourcePaths) | 
 | 	$(Verbose)touch $@ | 
 | 	$(Verbose)for file in $(LicenseSourcePaths); do	\ | 
 | 		echo "Concatenating \"$${file}\"...";	\ | 
 | 		cat $${file} >> $@;			\ | 
 | 	done | 
 |  | 
 | # Extract the source from the archive and apply patches, if any. | 
 |  | 
 | $(PackageSourceDir): $(PackageArchive) $(PackagePatchPaths) | 
 | 	$(expand-and-patch-package) | 
 |  | 
 | # Prepare the sources. | 
 |  | 
 | .PHONY: source | 
 | source: | $(PackageSourceDir) | 
 |  | 
 | # Patch the sources, if necessary. | 
 |  | 
 | .PHONY: patch | 
 | patch: source | 
 |  | 
 | # Generate the package build configure script by shadowing the source | 
 | # tree as a link farm. | 
 | # | 
 | # This is generally unnecessary for most GNU autoconf-based packages; | 
 | # however, monit completely drops the ball on non-colocated builds. | 
 |  | 
 | $(PackageBuildConfigure): | $(PackageSourceDir) $(BuildDirectory) | 
 | 	$(call create-links,$(CURDIR)/$(PackageSourceDir),$(BuildDirectory)) | 
 |  | 
 | # Generate the package build makefile. | 
 |  | 
 | $(PackageBuildMakefile): $(PackageBuildConfigure) | 
 | 	$(Verbose)cd $(BuildDirectory) && \ | 
 | 	./configure \ | 
 | 	CC=$(CC) CXX=$(CXX) AR=$(AR) RANLIB=$(RANLIB) STRIP=$(STRIP) \ | 
 | 	LDFLAGS="-Wl,-rpath-link -Wl,$(ZlibLibDir)" \ | 
 | 	--build=$(HostTuple) \ | 
 | 	--host=$(TargetTuple) \ | 
 | 	--prefix=/usr \ | 
 | 	--sysconfdir=/etc \ | 
 | 	--localstatedir=/var \ | 
 | 	--with-ssl-incl-dir=$(OpenSSLIncDir) \ | 
 | 	--with-ssl-lib-dir=$(OpenSSLLibDir) \ | 
 | 	--without-pam | 
 |  | 
 | # Configure the source for building. | 
 |  | 
 | .PHONY: configure | 
 | configure: source $(PackageBuildMakefile) | 
 |  | 
 | # Build the source. | 
 | # | 
 | # We have to unset MAKEFLAGS since they confuse the package build otherwise. | 
 |  | 
 | .PHONY: build | 
 | build: configure | 
 | 	$(Verbose)unset MAKEFLAGS && \ | 
 | 	$(MAKE) -C $(BuildDirectory) all | 
 |  | 
 | # Stage the build to a temporary installation area. | 
 | # | 
 | # We have to unset MAKEFLAGS since they confuse the package build otherwise. | 
 |  | 
 | .PHONY: stage | 
 | stage: build | $(ResultDirectory) | 
 | 	$(Verbose)unset MAKEFLAGS && \ | 
 | 	$(MAKE) -C $(BuildDirectory) \ | 
 | 	DESTDIR=$(ResultDirectory) \ | 
 | 	MODE_PROGS=775 \ | 
 | 	install | 
 |  | 
 | clean: | 
 | 	$(Verbose)$(RM) $(RMFLAGS) -r $(PackageSourceDir) | 
 | 	$(Verbose)$(RM) $(RMFLAGS) -r $(BuildDirectory) | 
 | 	$(Verbose)$(RM) $(RMFLAGS) -r $(ResultDirectory) | 
 |  | 
 | include post.mak |