blob: eda4e6bae8b09469d88dc0823a2e0320b5b0fdde [file] [log] [blame]
#
# 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 wpa_supplicant, a free software
# implementation of an IEEE 802.11i security supplicant for
# Linux, FreeBSD, NetBSD and Microsoft Windows.
#
include pre.mak
PackageName := wpa_supplicant
PackageExtension := tar.gz
PackageSeparator := -
PackagePatchArgs := -p1
PackageArchive := $(PackageName).$(PackageExtension)
PackageSourceDir := $(PackageName)$(PackageSeparator)$(PackageVersion)
PackageBuildSubdir := $(BuildDirectory)/wpa_supplicant
PackageConfigDir := configs
PackageProductConfig := $(PackageConfigDir)/$(BuildProduct)/defconfig
PackageSiteConfig := $(PackageConfigDir)/defconfig
PackageDefaultConfig := $(PackageBuildSubdir)/defconfig
PackageSiteConfig := $(if $(wildcard $(PackageProductConfig)),$(PackageProductConfig),$(wildcard $(PackageSiteConfig)))
PackageSourceConfig := $(if $(PackageSiteConfig),$(PackageSiteConfig),$(PackageDefaultConfig))
PackageBuildConfig := $(PackageBuildSubdir)/.config
PackageBuildMakefile = $(call GenerateBuildPaths,Makefile)
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)
LinuxDir := sw/tps/linux
LinuxIncDir := $(call GenerateResultPaths,$(LinuxDir),include)
NetlinkDir := sw/tps/libnl
NetlinkIncDir := $(call GenerateResultPaths,$(NetlinkDir),usr/include)
NetlinkLibDir := $(call GenerateResultPaths,$(NetlinkDir),usr/lib)
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)
WpaDbusConfSourcePath := $(PackageSourceDir)/wpa_supplicant/dbus/dbus-wpa_supplicant.conf
WpaDbusConfResultPath := $(call GenerateResultPaths,,$(notdir $(WpaDbusConfSourcePath)))
all: $(PackageDefaultGoal)
# Generate the package license contents.
$(PackageSourceDir)/COPYING: source
$(PackageLicenseFile): $(PackageSourceDir)/COPYING
$(copy-result)
# 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
$(PackageDefaultConfig) $(PackageBuildMakefile) $(PackageBuildSubdir): | $(PackageSourceDir) $(BuildDirectory)
$(call create-links,$(CURDIR)/$(PackageSourceDir),$(BuildDirectory))
$(PackageBuildConfig): $(PackageSourceConfig) | $(PackageBuildSubdir)
$(copy-result)
# Configure the source for building.
.PHONY: configure
configure: source $(PackageBuildConfig)
# Build the source.
#
# We have to unset MAKEFLAGS since they confuse the package build otherwise.
.PHONY: build
build: configure
$(Verbose)unset MAKEFLAGS && \
$(MAKE) -C $(PackageBuildSubdir) \
CC=$(CC) CXX=$(CXX) AR=$(AR) NM=$(NM) RANLIB=$(RANLIB) STRIP=$(STRIP) \
DBUSCFLAGS="$(call ToolGenerateIncludeArgument,$(DbusIncDirs))" \
DBUSLDFLAGS="-L$(DbusLibDir) -ldbus-1" \
DBUSVERSION=$(shell cat $(BuildRoot)/$(DbusDir)/dbus.version) \
LINUXCFLAGS="$(call ToolGenerateIncludeArgument,$(LinuxIncDir))" \
NETLINKCFLAGS="$(call ToolGenerateIncludeArgument,$(NetlinkIncDir))" \
NETLINKLDFLAGS="-L$(NetlinkLibDir)" \
OPENSSLCFLAGS="-I$(OpenSSLIncDir)" \
OPENSSLLDFLAGS="-L$(OpenSSLLibDir) -L$(ZlibLibDir) -lz" \
all
# Stage the build to a temporary installation area.
#
# We have to unset MAKEFLAGS since they confuse the package build otherwise.
.PHONY: stage
stage: stage-default stage-other
.PHONY: stage-default
stage-default: build | $(ResultDirectory)
$(Verbose)unset MAKEFLAGS && \
$(MAKE) -C $(PackageBuildSubdir) \
DBUSCFLAGS="$(call ToolGenerateIncludeArgument,$(DbusIncDirs))" \
DBUSLDFLAGS="-L$(DbusLibDir) -ldbus-1" \
DBUSVERSION=$(shell cat $(BuildRoot)/$(DbusDir)/dbus.version) \
LINUXCFLAGS="$(call ToolGenerateIncludeArgument,$(LinuxIncDir))" \
NETLINKCFLAGS="$(call ToolGenerateIncludeArgument,$(NetlinkIncDir))" \
NETLINKLDFLAGS="-L$(NetlinkLibDir)" \
OPENSSLCFLAGS="-I$(OpenSSLIncDir)" \
OPENSSLLDFLAGS="-L$(OpenSSLLibDir) -L$(ZlibLibDir) -lz" \
BINDIR=/usr/sbin \
LIBDIR=/usr/lib \
DESTDIR=$(ResultDirectory) \
install
.PHONY: stage-other
stage-other: $(WpaDbusConfResultPath)
$(WpaDbusConfSourcePath): build
$(WpaDbusConfResultPath): $(WpaDbusConfSourcePath) | $(ResultDirectory)
$(copy-result)
clean:
$(Verbose)$(RM) $(RMFLAGS) -r $(PackageSourceDir)
$(Verbose)$(RM) $(RMFLAGS) -r $(BuildDirectory)
$(Verbose)$(RM) $(RMFLAGS) -r $(ResultDirectory)
include post.mak