First run at integrating LWIP into the tree (again)
[akaros.git] / user / lwip / Makefrag
1 USER_LWIP_DIR := $(USER_DIR)/lwip
2 USER_LWIP_SRC_DIR = $(USER_LWIP_DIR)
3 OBJDIRS += $(USER_LWIP_SRC_DIR)
4 USER_LWIP_INCLUDE_DIR := $(USER_DIR)/lwip/include
5
6 USER_LWIP_SRC_CFLAGS    := $(USER_CFLAGS) -I$(USER_PARLIB_INCLUDE_DIR) \
7                                           -I$(USER_PARLIB_NEWLIB_DIR)/include \
8                                           -I$(USER_LWIP_INCLUDE_DIR)
9
10 USER_LWIP_SRC_SRCFILES  := $(USER_LWIP_SRC_DIR)/api/api_msg.c \
11                            $(USER_LWIP_SRC_DIR)/api/api_lib.c \
12                            $(USER_LWIP_SRC_DIR)/api/err.c \
13                            $(USER_LWIP_SRC_DIR)/api/netbuf.c \
14                            $(USER_LWIP_SRC_DIR)/api/netdb.c \
15                            $(USER_LWIP_SRC_DIR)/api/sockets.c \
16                            $(USER_LWIP_SRC_DIR)/api/tcpip.c \
17                            $(USER_LWIP_SRC_DIR)/core/init.c \
18                            $(USER_LWIP_SRC_DIR)/core/sys_arch.c \
19                            $(USER_LWIP_SRC_DIR)/core/mem.c \
20                            $(USER_LWIP_SRC_DIR)/core/memp.c \
21                            $(USER_LWIP_SRC_DIR)/core/netif.c \
22                            $(USER_LWIP_SRC_DIR)/core/pbuf.c  \
23                            $(USER_LWIP_SRC_DIR)/core/stats.c \
24                            $(USER_LWIP_SRC_DIR)/core/udp.c \
25                            $(USER_LWIP_SRC_DIR)/core/tcp.c \
26                            $(USER_LWIP_SRC_DIR)/core/raw.c \
27                            $(USER_LWIP_SRC_DIR)/core/sys.c \
28                            $(USER_LWIP_SRC_DIR)/core/tcp_out.c \
29                            $(USER_LWIP_SRC_DIR)/core/tcp_in.c \
30                            $(USER_LWIP_SRC_DIR)/core/ipv4/icmp.c \
31                            $(USER_LWIP_SRC_DIR)/core/ipv4/inet.c \
32                            $(USER_LWIP_SRC_DIR)/core/ipv4/ip.c  \
33                            $(USER_LWIP_SRC_DIR)/core/ipv4/ip_addr.c \
34                            $(USER_LWIP_SRC_DIR)/core/ipv4/ip_frag.c \
35                            $(USER_LWIP_SRC_DIR)/core/ipv4/inet_chksum.c \
36                            $(USER_LWIP_SRC_DIR)/netif/etharp.c \
37                            $(USER_LWIP_SRC_DIR)/netif/ethernetif.c
38                                                         
39 USER_LWIP_SRC_OBJFILES  := $(patsubst $(USER_LWIP_SRC_DIR)/%.c, \
40                            $(OBJDIR)/$(USER_LWIP_DIR)/%.o,  \
41                            $(USER_LWIP_SRC_SRCFILES))
42
43
44 $(OBJDIR)/$(USER_LWIP_DIR)/%.o: $(USER_LWIP_SRC_DIR)/%.c
45         @echo + cc [LWIP] $<
46         @mkdir -p $(@D)
47         $(V)$(CC) $(USER_LWIP_SRC_CFLAGS) -c -o $@ $<
48         
49 $(OBJDIR)/$(USER_LWIP_DIR)/liblwip.a: $(USER_LWIP_SRC_OBJFILES)
50         @echo + ar [LWIP] $@
51         $(V)$(AR) r $@ $(USER_LWIP_SRC_OBJFILES) 2>/dev/null