blob: 91f18a1759b3f628c87ca2364b048d1b5f6a1790 [file] [log] [blame] [edit]
#
# 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)
TcpWrappersDir := sw/tps/tcp_wrappers
TcpWrappersIncDir := $(call GenerateResultPaths,$(TcpWrappersDir),usr/include)
TcpWrappersLibDir := $(call GenerateResultPaths,$(TcpWrappersDir),usr/lib)
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)" \
CFLAGS=-I$(TcpWrappersIncDir) \
LDFLAGS=-L$(TcpWrappersLibDir) \
INSTALL="$(INSTALL) $(INSTALLFLAGS)" \
--build=$(HostTuple) \
--host=$(TargetTuple) \
--without-readline \
--prefix=/usr \
--sysconfdir=/etc
$(Verbose)touch $@
# Build the source.
$(BuildDirectory)/build: $(BuildDirectory)/configure
$(Verbose)$(MAKE) $(JOBSFLAG) -C $(BuildDirectory) all
$(Verbose)touch $@
# Stage the build to a temporary installation area.
$(BuildDirectory)/stage: $(BuildDirectory)/build | $(ResultDirectory)
$(Verbose)$(MAKE) $(JOBSFLAG) -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