blob: 66bdca2b903127951bdc95642f08bd3710168c19 [file] [log] [blame] [edit]
#
# Copyright (c) 2015 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 neard, a daemon that connects
# user applications to the NFC kernel drivers.
#
BuildConfigSpecialized := No
BuildProductSpecialized := No
include pre.mak
PackageRoot := .
PackageName := neard
PackageSeparator :=
PackageSourceDir := $(PackageRoot)/$(PackageName)
PackageBuildMakefile = $(call GenerateBuildPaths,Makefile)
LicenseSourceFile := $(PackageSourceDir)/COPYING
CleanPaths += $(PackageLicenseFile)
DbusDir := sw/tps/dbus
DbusIncDirs := $(call GenerateResultPaths,$(DbusDir),usr/include/dbus-1.0 usr/lib/dbus-1.0/include)
DbusLibDir := $(call GenerateResultPaths,$(DbusDir),usr/lib)
GlibDir := sw/tps/glib
GlibIncDirs := $(call GenerateResultPaths,$(GlibDir),usr/include/glib-2.0 usr/lib/glib-2.0/include)
GlibLibDir := $(call GenerateResultPaths,$(GlibDir),usr/lib)
GnuTlsDir := sw/tps/gnutls
GnuTlsIncDir := $(call GenerateResultPaths,$(GnuTlsDir),usr/include)
GnuTlsLibDir := $(call GenerateResultPaths,$(GnuTlsDir),usr/lib)
LibnlDir := sw/tps/libnl
LibnlIncDir := $(call GenerateResultPaths,$(LibnlDir),usr/include/ usr/lib/include)
LibnlLibDir := $(call GenerateResultPaths,$(LibnlDir),usr/lib)
LinuxDir := sw/tps/linux
LinuxIncDir := $(call GenerateResultPaths,$(LinuxDir),include)
all: $(PackageDefaultGoal)
# Generate the package license contents.
$(LicenseSourceFile): source
$(PackageLicenseFile): $(LicenseSourceFile)
$(copy-result)
# We are building this package from version-controlled source, so
# there is nothing to do for this target goal.
$(PackageSourceDir):
# Prepare the sources.
.PHONY: source
source: | $(PackageSourceDir)
# Patch the sources, if necessary.
.PHONY: patch
patch: source
# Generate the package build makefile.
OPTIONS_FLAGS = \
--disable-systemd \
--enable-debug \
--enable-test \
--enable-tools
$(PackageBuildMakefile): | $(PackageSourceDir) $(BuildDirectory) $(ResultDirectory)
$(Verbose)cd $(BuildDirectory) && \
$(CURDIR)/$(PackageSourceDir)/configure \
INSTALL="$(INSTALL) $(INSTALLFLAGS)" \
CC="$(CC)" CXX="$(CXX)" AR=$(AR) NM=$(NM) RANLIB=$(RANLIB) STRIP=$(STRIP) \
CPPFLAGS="$(call ToolGenerateIncludeArgument,$(LinuxIncDir))" \
LDFLAGS=" " \
DBUS_CFLAGS="$(call ToolGenerateIncludeArgument,$(DbusIncDirs))" \
DBUS_LIBS="-L$(DbusLibDir) -ldbus-1" \
GLIB_CFLAGS="$(call ToolGenerateIncludeArgument,$(GlibIncDirs))" \
GLIB_LIBS="-L$(GlibLibDir) -lglib-2.0" \
LIBNL2_CFLAGS="$(call ToolGenerateIncludeArgument,$(LibnlIncDir))" \
LIBNL2_LIBS="-L$(LibnlLibDir) -lnl -lnl-genl" \
GNUTLS_CFLAGS="$(call ToolGenerateIncludeArgument,$(GnuTlsIncDir))" \
GNUTLS_LIBS="-L$(GnuTlsLibDir) -lgnutls -Wl,-rpath-link -Wl,$(GpgErrorLibDir) -Wl,-rpath-link -Wl,$(GcryptLibDir)" \
GTHREAD_CFLAGS="$(call ToolGenerateIncludeArgument,$(GlibIncDirs))" \
GTHREAD_LIBS="-L$(GlibLibDir) -lgthread-2.0" \
--build=$(HostTuple) \
--host=$(TargetTuple) \
--prefix=/usr \
--sysconfdir=/etc \
--localstatedir=/var \
$(OPTIONS_FLAGS)
# 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) $(JOBSFLAG) -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) $(JOBSFLAG) -C $(BuildDirectory) \
DESTDIR=$(ResultDirectory) \
install
clean:
$(Verbose)$(RM) $(RMFLAGS) -r $(BuildDirectory)
$(Verbose)$(RM) $(RMFLAGS) -r $(ResultDirectory)
include post.mak