blob: 1e6129b76d80f9f0dfe4ddd6d957ba3783b888ba [file] [log] [blame]
#
# Copyright (c) 2012 Nest Labs, 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 make file for LwIP, a Lightweight IPv4-
# and IPv6 TCP/IP stack.
#
BuildConfigSpecialized := Yes
BuildProductSpecialized := Yes
include pre.mak
ifeq ($(BUILD_FEATURE_LWIP),1)
PackageRoot := .
PackageName := lwip
PackageSourceDir := $(LwipSrcPath)/$(PackageName)
GeneratePackagePaths = $(addprefix $(call Slashify,$(PackageSourceDir)),$(1))
LicenseSourceFile := $(PackageSourceDir)/COPYING
# Turn off warnings for missing protos
CCFLAGS += $(call ToolDeassertWarningFlag,$(WarnMissingProtos))
all: $(PackageDefaultGoal)
# Generate the package license contents.
$(LicenseSourceFile): source
$(PackageLicenseFile): $(LicenseSourceFile)
$(copy-result)
# We are building this package from version-controlled source, so
# there is nothing to do for this target goal.
$(PackageSourceDir):
# Prepare the sources.
.PHONY: source
source: | $(PackageSourceDir)
# Patch the sources, if necessary.
.PHONY: patch
patch: source
# Configure the source for building.
.PHONY: configure
configure: source
# Build the source.
.PHONY: build
build: configure
.PHONY: stage stage-headers
stage: build | $(ResultDirectory)
stage: stage-headers
lwip_API_PATHS = src/api/api_lib.c \
src/api/api_msg.c \
src/api/err.c \
src/api/netbuf.c \
src/api/netdb.c \
src/api/netifapi.c \
src/api/sockets.c \
src/api/tcpip.c
lwip_CORE_PATHS = src/core/def.c \
src/core/dhcp.c \
src/core/dns.c \
src/core/inet_chksum.c \
src/core/init.c \
src/core/ipv4/autoip.c \
src/core/ipv4/icmp.c \
src/core/ipv4/igmp.c \
src/core/ipv4/ip4.c \
src/core/ipv4/ip4_addr.c \
src/core/ipv4/ip_frag.c \
src/core/ipv6/dhcp6.c \
src/core/ipv6/ethip6.c \
src/core/ipv6/icmp6.c \
src/core/ipv6/inet6.c \
src/core/ipv6/ip6.c \
src/core/ipv6/ip6_addr.c \
src/core/ipv6/ip6_frag.c \
src/core/ipv6/ip6_route_table.c \
src/core/ipv6/mld6.c \
src/core/ipv6/nd6.c \
src/core/mem.c \
src/core/memp.c \
src/core/netif.c \
src/core/pbuf.c \
src/core/raw.c \
src/core/stats.c \
src/core/sys.c \
src/core/tcp.c \
src/core/tcp_in.c \
src/core/tcp_out.c \
src/core/timers.c \
src/core/udp.c
lwip_NETIF_PATHS = src/netif/etharp.c
lwip_SOURCE_PATHS = $(lwip_API_PATHS) \
$(lwip_CORE_PATHS) \
$(lwip_NETIF_PATHS)
lwip_INCLUDE_DIRS = src/include \
src/include/ipv4 \
src/include/ipv6
lwip_INCLUDE_PATHS = $(call GeneratePackagePaths,$(lwip_INCLUDE_DIRS))
lwip_PACKAGE_SOURCE_PATHS = $(call GeneratePackagePaths,$(lwip_SOURCE_PATHS))
# Tell make where to search for the sources, cleaning up the leading
# ./ strictly for cosmetic display purposes in the process.
VPATH = $(subst ./,,$(dir $(lwip_PACKAGE_SOURCE_PATHS)))
ARCHIVES = lwip
lwip_SOURCES = $(notdir $(lwip_PACKAGE_SOURCE_PATHS))
ifdef BUILD_FEATURE_WEAVE_TEST
lwip_INCLUDES = $(lwip_INCLUDE_PATHS) \
os/freertos \
$(NlERIncludePaths) \
products \
products/$(BuildProduct)
else
lwip_INCLUDES = $(lwip_INCLUDE_PATHS) \
os/$(TargetOS) \
$(NlERIncludePaths) \
products \
products/$(BuildProduct)
endif
lwip_CPPFLAGS = -Wno-error=implicit-function-declaration \
-Wno-error=strict-prototypes \
-include ./products/$(BuildProduct)/lwip.mak
LwIPHeaderSourcePaths = $(wildcard $(addsuffix /*/*.h,$(lwip_INCLUDE_PATHS)))
LwIPHeaderSourceStems = $(subst $(PackageSourceDir)/src/include,,$(LwIPHeaderSourcePaths))
LwIPHeaderSourcePattern = $(call GeneratePackagePaths,src/include/%)
LwIPHeaderResultPaths = $(call GenerateResultPaths,,$(LwIPHeaderSourceStems))
LwIPHeaderResultPattern = $(call GenerateResultPaths,,%)
LwIPOptionHeaderName = lwipopts.h
LwIPPoolHeaderName = lwippools.h
LwIPOptionHeaderStems = $(LwIPOptionHeaderName) $(LwIPPoolHeaderName) common/$(LwIPOptionHeaderName) $(BuildProduct)/$(LwIPOptionHeaderName)
LwIPOptionHeaderSourceDirectory = products
LwIPOptionHeaderSourcePaths = $(addprefix $(call Slashify,$(LwIPOptionHeaderSourceDirectory)),$(LwIPOptionHeaderStems))
LwIPOptionHeaderResultDirectory = $(ResultDirectory)
LwIPOptionHeaderResultPaths = $(call GenerateResultPaths,,$(LwIPOptionHeaderStems))
LwIPArchHeaderNames = cc.h perf.h sys_arch.h
ifdef BUILD_FEATURE_WEAVE_TEST
LwIPArchHeaderSourcePaths = $(addprefix os/freertos/arch/,$(LwIPArchHeaderNames))
LwIPArchHeaderSourceStems = $(subst os/freertos/,,$(LwIPArchHeaderSourcePaths))
LwIPArchHeaderSourcePattern = os/freertos/%
else
LwIPArchHeaderSourcePaths = $(addprefix os/$(TargetOS)/arch/,$(LwIPArchHeaderNames))
LwIPArchHeaderSourceStems = $(subst os/$(TargetOS)/,,$(LwIPArchHeaderSourcePaths))
LwIPArchHeaderSourcePattern = os/$(TargetOS)/%
endif
LwIPArchHeaderResultPaths = $(call GenerateResultPaths,,$(LwIPArchHeaderSourceStems))
LwIPArchHeaderResultPattern = $(call GenerateResultPaths,,%)
ResultPaths += $(LwIPHeaderResultPaths) \
$(LwIPOptionHeaderResultPaths) \
$(LwIPArchHeaderResultPaths)
stage-headers: $(LwIPHeaderResultPaths) $(LwIPOptionHeaderResultPaths) $(LwIPArchHeaderResultPaths)
prepare: stage-headers
$(LwIPHeaderResultPaths): $(LwIPHeaderResultPattern): $(LwIPHeaderSourcePattern)
$(install-result)
$(LwIPOptionHeaderResultPaths): $(LwIPOptionHeaderResultDirectory)/%: $(LwIPOptionHeaderSourceDirectory)/% | $(LwIPOptionHeaderResultDirectory)
$(install-result)
$(LwIPArchHeaderResultPaths): $(LwIPArchHeaderResultPattern): $(LwIPArchHeaderSourcePattern)
$(install-result)
endif #ifeq ($(BUILD_FEATURE_LWIP),1)
# While the LwIP library uses the nlbuild build system because it has no
# make- compatible build system of its own, it is still third-party
# software and we do not want to enforce style semantics on it.
# Consequently, set PrettyPaths to empty.
PrettyPaths := $(NULL)
include post.mak