blob: 8c95a859d13dc2ae6bee3ff70c3df1aa36c8bfe6 [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).
#
include pre.mak
PackageName := tftp-hpa
PackageExtension := tar.bz2
PackageSeparator := -
PackagePatchArgs :=
PackageArchive := $(PackageName).$(PackageExtension)
PackageSourceDir := $(PackageName)$(PackageSeparator)$(PackageVersion)
PackageBuildMakefile = $(call GenerateBuildPaths,Makefile)
CleanPaths += $(PackageLicenseFile)
SOURCEDIRS = $(PackageSourceDir)
$(PackageSourceDir)_RULETARGET = $(BuildDirectory)/configure
all: $(PackageDefaultGoal)
# Generate the package license contents.
$(PackageSourceDir)/tftpd/tftpd.c: $(BuildDirectory)/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)
$(expand-and-patch-package)
# Prepare the sources.
$(BuildDirectory)/source: | $(PackageSourceDir)
$(Verbose)touch $@
# Patch the sources, if necessary.
$(BuildDirectory)/patch: $(BuildDirectory)/source
$(Verbose)touch $@
# 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.
# Configure the source for building.
$(BuildDirectory)/configure: $(BuildDirectory)/source | $(PackageSourceDir) $(BuildDirectory)
$(call create-links,$(CURDIR)/$(PackageSourceDir),$(BuildDirectory))
$(Verbose)cd $(BuildDirectory) && \
./configure \
CC="$(CC) $(CPPOPTFLAGS)" \
CFLAGS="$(call ToolGenerateIncludeArgument,$(TcpWrappersIncludePath)) \
$(call ToolGenerateIncludeArgument,$(LinuxIncludePath))" \
LDFLAGS=$(call GenerateLibraryPathArgument,$(TcpWrappersLibraryPath)) \
INSTALL="$(INSTALL) $(INSTALLFLAGS)" \
--build=$(HostTuple) \
--host=$(TargetTuple) \
--without-readline \
--prefix=/usr \
--sysconfdir=/etc
$(Verbose)touch $@
# Build the source.
$(BuildDirectory)/build: $(BuildDirectory)/configure
$(Verbose)$(MAKE) -C $(BuildDirectory) all
$(Verbose)touch $@
# Stage the build to a temporary installation area.
$(BuildDirectory)/stage: $(BuildDirectory)/build | $(ResultDirectory)
$(Verbose)$(MAKE) -C $(BuildDirectory) INSTALLROOT=$(ResultDirectory) install
$(Verbose)touch $@
.PHONY: stage
stage: $(BuildDirectory)/stage
clean:
$(Verbose)$(RM) $(RMFLAGS) -r $(PackageSourceDir)
$(Verbose)$(RM) $(RMFLAGS) -r $(BuildDirectory)
$(Verbose)$(RM) $(RMFLAGS) -r $(ResultDirectory)
include post.mak