blob: aeac9e86eb52d4fa3acd80d2cc98720b350f839b [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
PackageRoot := .
PackageName := lwip
PackageSourceDir := $(LwipSrcPath)/$(PackageName)
GeneratePackagePaths = $(addprefix $(call Slashify,$(PackageSourceDir)),$(1))
LicenseSourceFile := $(PackageSourceDir)/COPYING
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: build | $(ResultDirectory)
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/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
ifeq ($(BuildConfig),unittest)
lwip_TEST_PATHS = test/nlunittest/src/test_pbuf.cpp
endif
lwip_SOURCE_PATHS = $(lwip_API_PATHS) \
$(lwip_CORE_PATHS) \
$(lwip_NETIF_PATHS) \
$(lwip_TEST_PATHS)
lwip_INCLUDE = src/include
lwip_IPV4_INCLUDE = src/include/ipv4
lwip_IPV6_INCLUDE = src/include/ipv6
ifeq ($(BuildConfig),unittest)
lwip_TEST_INCLUDE_DIRS = test/nlunittest/include
endif
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)))
ifneq ($(BUILD_PRODUCT),pinnasim) # Only copy headers for pinnasim, don't build lwip library
ARCHIVES = lwip
endif
lwip_SOURCES = $(notdir $(lwip_PACKAGE_SOURCE_PATHS))
lwip_INCLUDES = $(LwIPIncludePaths) \
os/$(TargetOS) \
$(FreeRTOSIncludePaths) \
$(NlPlatformIncludePaths) \
$(TestFrameworkIncludePaths) \
$(NLERIncludePaths)
# While LwIP uses the nlbuild build system because it has no 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)
# Use header_source:header_dest format to move header files to their appropriate locations
LwIPIncludeSourcePaths = $(wildcard $(addsuffix /*/*.h,$(call GeneratePackagePaths, $(lwip_INCLUDE))))
LwIPIncludeTranslationPaths = $(foreach headerfile,$(LwIPIncludeSourcePaths),$(headerfile):$(subst $(PackageSourceDir)/src/include,,$(headerfile)))
LwIPIPV4IncludeSourcePaths = $(wildcard $(addsuffix /*/*.h,$(call GeneratePackagePaths, $(lwip_IPV4_INCLUDE))))
LwIPIPV4IncludeTranslationPaths = $(foreach headerfile,$(LwIPIPV4IncludeSourcePaths),$(headerfile):$(subst $(PackageSourceDir)/src/include,,$(headerfile)))
LwIPIPV6IncludeSourcePaths = $(wildcard $(addsuffix /*/*.h,$(call GeneratePackagePaths, $(lwip_IPV6_INCLUDE))))
LwIPIPV6IncludeTranslationPaths = $(foreach headerfile,$(LwIPIPV6IncludeSourcePaths),$(headerfile):$(subst $(PackageSourceDir)/src/include,,$(headerfile)))
LwIPTestIncludeSourcePaths = $(wildcard $(addsuffix /*.h,$(call GeneratePackagePaths, $(lwip_TEST_INCLUDE_DIRS))))
LwIPTestIncludeTranslationPaths = $(foreach headerfile,$(LwIPTestIncludeSourcePaths),$(headerfile):$(subst $(PackageSourceDir)/test/nlunittest/include,,$(headerfile)))
LwIPOptionHeaderNames = common_lwipopts.h lwipopts.h lwippools.h
LwIPArchHeaderNames = cc.h perf.h sys_arch.h
LwIPArchHeaderSourcePaths = $(addprefix os/$(TargetOS)/arch/,$(LwIPArchHeaderNames))
LwIPArchTranslationPaths = $(foreach headerfile,$(LwIPArchHeaderSourcePaths),$(headerfile):$(subst os/$(TargetOS)/,,$(headerfile)))
lwip_HEADERS = $(LwIPIncludeTranslationPaths) \
$(LwIPIPV4IncludeTranslationPaths) \
$(LwIPIPV6IncludeTranslationPaths) \
$(LwIPOptionHeaderNames) \
$(LwIPArchTranslationPaths) \
$(LwIPTestIncludeTranslationPaths)
include post.mak