| # |
| # 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 OpenThread SPI HDLC Adapter. |
| # |
| |
| |
| include pre.mak |
| |
| PackageName := spi-hdlc-adapter |
| |
| PackagePatchArgs := -p1 |
| |
| PackageSourceDir := $(PackageName) |
| |
| PackageBuildMakefile = $(call GenerateBuildPaths,Makefile) |
| |
| CleanPaths += $(PackageLicenseFile) |
| |
| SOURCEDIRS = $(PackageSourceDir) |
| $(PackageSourceDir)_RULE_TARGET = $(BuildDirectory)/configure |
| |
| all: $(PackageDefaultGoal) |
| |
| # Extract the source from the archive and apply patches, if any. |
| |
| # Prepare the sources. |
| |
| $(BuildDirectory)/source: | $(PackageSourceDir) |
| $(Verbose)touch $@ |
| |
| # Patch the sources, if necessary. |
| |
| $(BuildDirectory)/patch: $(BuildDirectory)/source |
| $(Verbose)touch $@ |
| |
| $(BuildDirectory)/configure: $(BuildDirectory)/source |
| $(Verbose)touch $@ |
| |
| # Build the source. |
| # |
| # We have to unset MAKEFLAGS since they confuse the package build otherwise. |
| |
| $(BuildDirectory)/build: $(BuildDirectory)/configure | $(BuildDirectory) |
| $(Verbose)$(CC) -Wall "$(CURDIR)/$(PackageSourceDir)/spi-hdlc-adapter.c" -o "$(CURDIR)/$(BuildDirectory)/spi-hdlc-adapter" |
| $(Verbose)touch $@ |
| |
| # Stage the build to a temporary installation area. |
| # |
| # We have to unset MAKEFLAGS since they confuse the package build otherwise. |
| # |
| # We could also handle this by removing DESTDIR and setting the prefix |
| # to $(ResultDirectory); however, that results in libtool hard-coding |
| # $(ResultDirectory) as the RPATH in the linked executables which is |
| # NOT what we want either. We lose again. |
| # |
| # By removing the '*.la' file, we win by ensuring neither a misdirected |
| # link nor an RPATH. |
| |
| $(BuildDirectory)/stage: $(BuildDirectory)/build | $(ResultDirectory) |
| $(Verbose)$(MKDIR) -p $(ResultDirectory)/usr/sbin |
| $(Verbose)cp $(BuildDirectory)/spi-hdlc-adapter $(ResultDirectory)/usr/sbin |
| $(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 $(BuildDirectory) |
| $(Verbose)$(RM) $(RMFLAGS) -r $(ResultDirectory) |
| |
| include post.mak |