blob: 75b09d77b6297bfb9b8ebb71bcad08863b7551e5 [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 makefile for the H. Peter Anvin TFTP client
# and server (tftp-hpa).
BuildConfigSpecialized := No
BuildProductSpecialized := No
include pre.mak
PackageName := tftp-hpa
PackageExtension := tar.bz2
PackageSeparator := -
PackagePatchArgs :=
PackageArchive := $(PackageName).$(PackageExtension)
PackageSourceDir := $(PackageName)$(PackageSeparator)$(PackageVersion)
PackageBuildMakefile = $(call GenerateBuildPaths,Makefile)
CleanPaths += $(PackageLicenseFile)
TcpWrappersDir := sw/tps/tcp_wrappers
TcpWrappersIncDir := $(call GenerateResultPaths,$(TcpWrappersDir),usr/include)
TcpWrappersLibDir := $(call GenerateResultPaths,$(TcpWrappersDir),usr/lib)
all: $(PackageDefaultGoal)
# Generate the package license contents.
$(PackageSourceDir)/tftpd/tftpd.c: source
$(PackageLicenseFile): $(PackageSourceDir)/tftpd/tftpd.c
$(Verbose)$(SED) -n -e '/^\/\*$$/,/\*\/$$/{;p;/\*\/$$/q;}' < $< > $@
# Extract the source from the archive and apply patches, if any.
$(PackageSourceDir): $(PackageArchive) $(PackagePatchPaths)
# Prepare the sources.
.PHONY: source
source: | $(PackageSourceDir)
# Patch the sources, if necessary.
.PHONY: patch
patch: source
# Generate the package build makefile.
# Even though this package supports GNU configure, we have to clone
# the tree since it doesn't correctly support non-colocated source and
# build trees.
$(PackageBuildMakefile): | $(PackageSourceDir) $(BuildDirectory)
$(call create-links,$(CURDIR)/$(PackageSourceDir),$(BuildDirectory))
$(Verbose)cd $(BuildDirectory) && \
./configure \
CC=$(CC) \
CFLAGS=-I$(TcpWrappersIncDir) \
LDFLAGS=-L$(TcpWrappersLibDir) \
--build=$(HostTuple) \
--host=$(TargetTuple) \
--without-readline \
--prefix=/usr \
# Configure the source for building.
.PHONY: configure
configure: source $(PackageBuildMakefile)
# Build the source.
.PHONY: build
build: configure
$(Verbose)$(MAKE) -C $(BuildDirectory) all
# Stage the build to a temporary installation area.
.PHONY: stage
stage: build | $(ResultDirectory)
$(Verbose)$(MAKE) -C $(BuildDirectory) INSTALLROOT=$(ResultDirectory) install
$(Verbose)$(RM) $(RMFLAGS) -r $(PackageSourceDir)
$(Verbose)$(RM) $(RMFLAGS) -r $(BuildDirectory)
$(Verbose)$(RM) $(RMFLAGS) -r $(ResultDirectory)
include post.mak