-#
-#TCPSTACK, uIP is used currently
-#
-TCPSTACK=UIP
 
 #
 #TCPSTACK, uIP is used currently
 all : $(ALL_TARGETS)
 
 
+force_lwip:
+       (cd ../src/lwip/build; make clean; make)
+
+
 #geekos/vmx_lowlevel.o: $(PROJECT_ROOT)/src/geekos/vmx_lowlevel.asm
 #      $(NASM) -O99 \
 #      -f elf \
        $(PAD) $@ 512
 
 # The kernel executable and symbol map.
-geekos/kernel.exe : $(KERNEL_OBJS) $(COMMON_C_OBJS) $(TCPSTACK_OBJS)
+geekos/kernel.exe : $(KERNEL_OBJS) $(COMMON_C_OBJS) force_lwip $(TCPSTACK_OBJS) 
        $(TARGET_LD) -o geekos/kernel.exe -Ttext $(KERNEL_BASE_ADDR) -e $(KERNEL_ENTRY) \
                $(V3_LD_FLAGS) \
                $(KERNEL_OBJS) $(COMMON_C_OBJS) $(TCPSTACK_OBJS) $(V3_LIBS) -b binary ./palacios/vm_kernel
 
 #define GEEKOS_SOCKET_H
 
 #include <geekos/ring_buffer.h>
-#include <uip/uip.h>
 #include <geekos/kthread.h>
 
+#ifdef UIP
+#include <uip/uip.h>
+
 
 typedef enum {WAITING, CLOSED, LISTEN, ESTABLISHED} sock_state_t;
 
 
 void set_ip_addr(uchar_t addr[4]);
 
+#endif // UIP
 
 #endif
 
 
 #include <string.h>
 
-#include <palacios/vmm.h>
+//#include <palacios/vmm.h>
 #include <geekos/synch.h>
 #include <geekos/kthread.h>
 #include <geekos/debug.h>