| # | |
| # 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 libedit, a BSD-licensed | |
| # alternative to libreadline. | |
| # | |
| include pre.mak | |
| PackageName := libedit | |
| PackageExtension := tar.gz | |
| PackageSeparator := - | |
| PackagePatchArgs := -p1 | |
| PackageArchive := $(PackageName).$(PackageExtension) | |
| PackageSourceDir := $(PackageName)$(PackageSeparator)$(PackageVersion) | |
| PackageBuildMakefile = $(call GenerateBuildPaths,Makefile) | |
| CleanPaths += $(PackageLicenseFile) | |
| NCursesDir := sw/tps/ncurses | |
| NCursesIncDir = $(call GenerateResultPaths,$(NCursesDir),usr/include) | |
| NCursesLibDir = $(call GenerateResultPaths,$(NCursesDir),usr/lib) | |
| SOURCEDIRS = $(PackageSourceDir) | |
| $(PackageSourceDir)_RULE_TARGET = $(BuildDirectory)/configure | |
| all: $(PackageDefaultGoal) | |
| # Generate the package license contents. | |
| $(PackageSourceDir)/COPYING: $(BuildDirectory)/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. | |
| $(BuildDirectory)/source: | $(PackageSourceDir) | |
| $(Verbose)touch $@ | |
| # Patch the sources, if necessary. | |
| $(BuildDirectory)/patch: $(BuildDirectory)/source | |
| $(Verbose)touch $@ | |
| # Generate the package build makefile. | |
| # Configure the source for building. | |
| # | |
| # Avahi uses and, in fact, requires pkg-config to set-up LDFLAGS and | |
| # CFLAGS for LIBDAEMON even though these are explicitly provided on | |
| # the configure command line above as prescribed in the "how to | |
| # configure WITHOUT pkg-config" instructions. | |
| # | |
| # Unfortunately, some site Linux systems are quite old and have a | |
| # version of pkg-config that avahi refuses to work with. | |
| # Consequently, we place $(HostBinDir) first in the path to ensure | |
| # that the project-local version of pkg-config is detected and used | |
| # rather than a host- or site-local version. | |
| $(BuildDirectory)/configure: PATH := $(HostBinDir):$(PATH) | |
| $(BuildDirectory)/configure: $(BuildDirectory)/source | $(PackageSourceDir) $(BuildDirectory) | |
| $(Verbose)cd $(BuildDirectory) && \ | |
| $(CURDIR)/$(PackageSourceDir)/configure \ | |
| CC="$(CC)" CXX="$(CXX)" AR=$(AR) RANLIB=$(RANLIB) STRIP=$(STRIP) \ | |
| INSTALL="$(INSTALL) $(INSTALLFLAGS)" \ | |
| CPPFLAGS="-I$(NCursesIncDir)" \ | |
| LDFLAGS="-L$(NCursesLibDir)" \ | |
| --build=$(HostTuple) \ | |
| --host=$(TargetTuple) \ | |
| --prefix=/usr \ | |
| --sysconfdir=/etc \ | |
| --localstatedir=/var \ | |
| --disable-static | |
| $(Verbose)touch $@ | |
| # Build the source. | |
| $(BuildDirectory)/build: $(BuildDirectory)/configure | |
| $(MAKE) $(JOBSFLAG) -C $(BuildDirectory) all | |
| $(Verbose)touch $@ | |
| # Stage the build to a temporary installation area. | |
| $(BuildDirectory)/stage: $(BuildDirectory)/build | $(ResultDirectory) | |
| $(MAKE) $(JOBSFLAG) -C $(BuildDirectory) DESTDIR=$(ResultDirectory) install | |
| -ln -s editline $(ResultDirectory)/usr/include/readline | |
| -ln -s ../histedit.h $(ResultDirectory)/usr/include/readline/history.h | |
| -ln -s libedit.so $(ResultDirectory)/usr/lib/libreadline.so | |
| -ln -s libedit.a $(ResultDirectory)/usr/lib/libreadline.a | |
| $(Verbose)touch $@ | |
| .PHONY: stage | |
| stage: $(BuildDirectory)/stage | |
| DeviceUser:=root | |
| quick-install: stage | |
| tar -czC $(ResultDirectory)/usr/ . | ssh $(DeviceUser)@$(DeviceAddress) tar xvzC /usr | |
| clean: | |
| $(Verbose)$(RM) $(RMFLAGS) -r $(PackageSourceDir) | |
| $(Verbose)$(RM) $(RMFLAGS) -r $(BuildDirectory) | |
| $(Verbose)$(RM) $(RMFLAGS) -r $(ResultDirectory) | |
| include post.mak | |