make-liblwip.mk 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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 <adam@sics.se>
  30. #
  31. CONTRIBDIR=../ext/contrib
  32. LWIPARCH=$(CONTRIBDIR)/ports/unix
  33. #Set this to where you have the lwip core module checked out from CVS
  34. #default assumes it's a dir named lwip at the same level as the contrib module
  35. LWIPDIR=../ext/lwip/src
  36. CCDEP=gcc
  37. CC=gcc
  38. CFLAGS=-O3 -g -Wall -DIPv4 -fPIC
  39. #-DLWIP_DEBUG
  40. CFLAGS:=$(CFLAGS) \
  41. -I$(LWIPDIR)/include -I$(LWIPARCH)/include -I$(LWIPDIR)/include/ipv4 \
  42. -I$(LWIPDIR) -I.
  43. # COREFILES, CORE4FILES: The minimum set of files needed for lwIP.
  44. COREFILES=$(LWIPDIR)/core/mem.c $(LWIPDIR)/core/memp.c $(LWIPDIR)/core/netif.c \
  45. $(LWIPDIR)/core/pbuf.c $(LWIPDIR)/core/raw.c $(LWIPDIR)/core/stats.c \
  46. $(LWIPDIR)/core/sys.c $(LWIPDIR)/core/tcp.c $(LWIPDIR)/core/tcp_in.c \
  47. $(LWIPDIR)/core/tcp_out.c $(LWIPDIR)/core/udp.c $(LWIPDIR)/core/dhcp.c \
  48. $(LWIPDIR)/core/init.c $(LWIPDIR)/core/timers.c $(LWIPDIR)/core/def.c
  49. CORE4FILES=$(wildcard $(LWIPDIR)/core/ipv4/*.c) $(LWIPDIR)/core/ipv4/inet.c \
  50. $(LWIPDIR)/core/ipv4/inet_chksum.c
  51. # SNMPFILES: Extra SNMPv1 agent
  52. SNMPFILES=$(LWIPDIR)/core/snmp/asn1_dec.c $(LWIPDIR)/core/snmp/asn1_enc.c \
  53. $(LWIPDIR)/core/snmp/mib2.c $(LWIPDIR)/core/snmp/mib_structs.c \
  54. $(LWIPDIR)/core/snmp/msg_in.c $(LWIPDIR)/core/snmp/msg_out.c
  55. # APIFILES: The files which implement the sequential and socket APIs.
  56. APIFILES=$(LWIPDIR)/api/api_lib.c $(LWIPDIR)/api/api_msg.c $(LWIPDIR)/api/tcpip.c \
  57. $(LWIPDIR)/api/err.c $(LWIPDIR)/api/sockets.c $(LWIPDIR)/api/netbuf.c $(LWIPDIR)/api/netdb.c
  58. # NETIFFILES: Files implementing various generic network interface functions.'
  59. NETIFFILES=$(LWIPDIR)/netif/etharp.c $(LWIPDIR)/netif/slipif.c
  60. # NETIFFILES: Add PPP netif
  61. NETIFFILES+=$(LWIPDIR)/netif/ppp/auth.c $(LWIPDIR)/netif/ppp/chap.c \
  62. $(LWIPDIR)/netif/ppp/chpms.c $(LWIPDIR)/netif/ppp/fsm.c \
  63. $(LWIPDIR)/netif/ppp/ipcp.c $(LWIPDIR)/netif/ppp/lcp.c \
  64. $(LWIPDIR)/netif/ppp/magic.c $(LWIPDIR)/netif/ppp/md5.c \
  65. $(LWIPDIR)/netif/ppp/pap.c $(LWIPDIR)/netif/ppp/ppp.c \
  66. $(LWIPDIR)/netif/ppp/randm.c $(LWIPDIR)/netif/ppp/vj.c
  67. # ARCHFILES: Architecture specific files.
  68. ARCHFILES=$(wildcard $(LWIPARCH)/*.c $(LWIPARCH)tapif.c $(LWIPARCH)/netif/list.c $(LWIPARCH)/netif/tcpdump.c)
  69. # LWIPFILES: All the above.
  70. LWIPFILES=$(COREFILES) $(CORE4FILES) $(SNMPFILES) $(APIFILES) $(NETIFFILES) $(ARCHFILES)
  71. LWIPFILESW=$(wildcard $(LWIPFILES))
  72. LWIPOBJS=$(notdir $(LWIPFILESW:.c=.o))
  73. LWIPLIB=liblwip.so
  74. %.o:
  75. $(CC) $(CFLAGS) -c $(<:.o=.c)
  76. all: $(LWIPLIB)
  77. .PHONY: all
  78. clean:
  79. rm -f *.o $(LWIPLIB) *.s .depend* *.core core
  80. depend dep: .depend
  81. include .depend
  82. $(LWIPLIB): $(LWIPOBJS)
  83. $(CC) -g -nostartfiles -shared -o $@ $^
  84. .depend: $(LWIPFILES)
  85. $(CCDEP) $(CFLAGS) -MM $^ > .depend || rm -f .depend