| 1 |
# |
| 2 |
# Copyright (c) 2001, 2002 Swedish Institute of Computer Science. |
| 3 |
# All rights reserved. |
| 4 |
# |
| 5 |
# Redistribution and use in source and binary forms, with or without modification, |
| 6 |
# are permitted provided that the following conditions are met: |
| 7 |
# |
| 8 |
# 1. Redistributions of source code must retain the above copyright notice, |
| 9 |
# this list of conditions and the following disclaimer. |
| 10 |
# 2. Redistributions in binary form must reproduce the above copyright notice, |
| 11 |
# this list of conditions and the following disclaimer in the documentation |
| 12 |
# and/or other materials provided with the distribution. |
| 13 |
# 3. The name of the author may not be used to endorse or promote products |
| 14 |
# derived from this software without specific prior written permission. |
| 15 |
# |
| 16 |
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED |
| 17 |
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
| 18 |
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT |
| 19 |
# SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
| 20 |
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT |
| 21 |
# OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
| 22 |
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
| 23 |
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING |
| 24 |
# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY |
| 25 |
# OF SUCH DAMAGE. |
| 26 |
# |
| 27 |
# This file is part of the lwIP TCP/IP stack. |
| 28 |
# |
| 29 |
# Author: Adam Dunkels <[email protected]> |
| 30 |
# |
| 31 |
|
| 32 |
#CC=gcc |
| 33 |
#CC=clang |
| 34 |
CCDEP?=$(CC) |
| 35 |
|
| 36 |
CFLAGS+=-g -DLWIP_DEBUG -Wall -pedantic -Werror \ |
| 37 |
-Wparentheses -Wsequence-point -Wswitch-default \ |
| 38 |
-Wextra -Wundef -Wshadow -Wpointer-arith -Wcast-qual \ |
| 39 |
-Wc++-compat -Wwrite-strings -Wold-style-definition -Wcast-align \ |
| 40 |
-Wmissing-prototypes -Wnested-externs \ |
| 41 |
-Wunreachable-code -Wuninitialized -Wmissing-prototypes \ |
| 42 |
-Wredundant-decls -Waggregate-return -Wlogical-not-parentheses |
| 43 |
# -Wconversion -Wsign-compare -Wmissing-include-dirs |
| 44 |
|
| 45 |
ifeq (,$(findstring clang,$(CC))) |
| 46 |
CFLAGS+= -Wlogical-op -Wc90-c99-compat -Wtrampolines |
| 47 |
# if GCC is newer than 4.8/4.9 you may use: |
| 48 |
#CFLAGS:=$(CFLAGS) -fsanitize=address -fstack-protector -fstack-check -fsanitize=undefined -fno-sanitize=alignment |
| 49 |
else |
| 50 |
# we cannot sanitize alignment on x86-64 targets because clang wants 64 bit alignment |
| 51 |
CFLAGS+= -fsanitize=address -fsanitize=undefined -fno-sanitize=alignment -Wdocumentation -Wno-documentation-deprecated-sync |
| 52 |
endif |
| 53 |
|
| 54 |
CONTRIBDIR?=../../.. |
| 55 |
ARFLAGS?=rs |
| 56 |
|
| 57 |
#Set this to where you have the lwip core module checked out from git |
| 58 |
#default assumes it's a dir above the contrib module |
| 59 |
LWIPDIR?=$(CONTRIBDIR)/.. |
| 60 |
|
| 61 |
CFLAGS+=-I. \ |
| 62 |
-I$(CONTRIBDIR) \ |
| 63 |
-I$(LWIPDIR)/include \ |
| 64 |
-I$(LWIPARCH)/include |
| 65 |
|
| 66 |
# Add include path and link to mbedTLS lib if available |
| 67 |
MBEDTLSDIR?=$(LWIPDIR)/../mbedtls |
| 68 |
ifneq (,$(wildcard $(MBEDTLSDIR)/include/mbedtls/*.h)) |
| 69 |
LDFLAGS+=-L$(MBEDTLSDIR)/library -lmbedtls -lmbedcrypto -lmbedx509 |
| 70 |
CFLAGS+=-I$(MBEDTLSDIR)/include -Wno-redundant-decls -DLWIP_HAVE_MBEDTLS=1 -Wno-c90-c99-compat |
| 71 |
endif |
| 72 |
|
| 73 |
include $(CONTRIBDIR)/Filelists.mk |
| 74 |
include $(LWIPDIR)/Filelists.mk |
| 75 |
|
| 76 |
# LWIPFILES: All the above. |
| 77 |
LWIPFILES=$(LWIPNOAPPSFILES) $(ARCHFILES) |
| 78 |
LWIPOBJS=$(notdir $(LWIPFILES:.c=.o)) |
| 79 |
|
| 80 |
LWIPLIBCOMMON=liblwipcommon.a |
| 81 |
$(LWIPLIBCOMMON): $(LWIPOBJS) |
| 82 |
$(AR) $(ARFLAGS) $(LWIPLIBCOMMON) $? |
| 83 |
|
| 84 |
APPFILES=$(CONTRIBAPPFILES) $(LWIPAPPFILES) |
| 85 |
APPLIB=liblwipapps.a |
| 86 |
APPOBJS=$(notdir $(APPFILES:.c=.o)) |
| 87 |
$(APPLIB): $(APPOBJS) |
| 88 |
$(AR) $(ARFLAGS) $(APPLIB) $? |
| 89 |
|
| 90 |
%.o: |
| 91 |
$(CC) $(CFLAGS) -c $< |