First run at integrating LWIP into the tree (again)
[akaros.git] / user / apps / parlib / Makefrag
index 9b7ea44..f46d5e0 100644 (file)
@@ -1,35 +1,50 @@
 USER_APPS_PARLIB_DIR = $(USER_APPS_DIR)/parlib
 OBJDIRS += $(USER_APPS_PARLIB_DIR)
 
-USER_APPS_PARLIB_CFLAGS    := $(USER_CFLAGS) --nodeputy \
-                              -I$(USER_PARLIB_NEWLIB_DIR)/include \
-                              -I$(USER_PARLIB_DIR)/inc
-
-USER_APPS_PARLIB_LDFLAGS   := $(USER_LDFLAGS) -static \
-                              -T $(USER_APPS_PARLIB_DIR)/apps.ld
+USER_APPS_PARLIB_CFLAGS    := $(USER_CFLAGS)  \
+                              -I$(USER_PARLIB_DIR)/inc \
+                              -I$(USER_LWIP_DIR)/include
+                              # -I$(USER_PARLIB_NEWLIB_DIR)/include
+ifeq ($(COMPILER),IVY)
+       PATCHFILE = $(OBJDIR)/$(USER_PARLIB_DIR)/libc_patch.i
+       USER_APPS_PARLIB_CFLAGS    += --nodeputy --nopatch #--patch=$(PATCHFILE) 
+endif
+
+USER_APPS_PARLIB_LDFLAGS   := -static \
+                              -T $(USER_APPS_PARLIB_DIR)/apps_$(TARGET_ARCH).ld
 
 USER_APPS_PARLIB_LDDIRS    := -L$(OBJDIR)/$(USER_PARLIB_DIR) \
-                              -L$(USER_PARLIB_NEWLIB_DIR)/lib
+                              -L$(OBJDIR)/$(USER_LWIP_DIR)
 
-USER_APPS_PARLIB_LDLIBS    := --start-group -lc -lm -lg -lparlib --end-group
+USER_APPS_PARLIB_LDLIBS    := --start-group -lc -lm -lg -lparlib -llwip \
+                              -lpthread -livyparlib --end-group
 
-USER_APPS_PARLIB_LDOBJS    := $(OBJDIR)/$(USER_PARLIB_DIR)/entry.o \
+USER_APPS_PARLIB_LDOBJS    := \
+                              $(OBJDIR)/$(USER_PARLIB_ARCH_SRC_DIR)/entry.o \
+                              $(OBJDIR)/$(USER_PARLIB_ARCH_SRC_DIR)/crtbegin.o \
+                              $(OBJDIR)/$(USER_PARLIB_ARCH_SRC_DIR)/crtend.o \
                               $(OBJDIR)/$(USER_APPS_PARLIB_DIR)/readline.o \
                               $(OBJDIR)/$(USER_APPS_PARLIB_DIR)/file_io.o \
                               $(OBJDIR)/$(USER_APPS_PARLIB_DIR)/file_error.o \
                               $(OBJDIR)/$(USER_APPS_PARLIB_DIR)/clrscrn.o \
                               $(OBJDIR)/$(USER_APPS_PARLIB_DIR)/draw_nanwan.o \
                               $(OBJDIR)/$(USER_APPS_PARLIB_DIR)/run_binary.o \
-                              $(OBJDIR)/$(USER_APPS_PARLIB_DIR)/change_user.o  
+                              $(OBJDIR)/$(USER_APPS_PARLIB_DIR)/run_binary_colored.o \
+                              $(OBJDIR)/$(USER_APPS_PARLIB_DIR)/change_user.o \
+                             $(OBJDIR)/$(USER_APPS_PARLIB_DIR)/ping.o \
+                              $(OBJDIR)/$(USER_APPS_PARLIB_DIR)/network_init.o
 
 
 USER_APPS_PARLIB_LDDEPENDS := $(USER_APPS_PARLIB_LDOBJS) \
                               $(OBJDIR)/$(USER_PARLIB_DIR)/libparlib.a \
-                              $(OBJDIR)/$(USER_APPS_PARLIB_DIR)/%.o       
+                              $(OBJDIR)/$(USER_LWIP_DIR)/liblwip.a \
+                              $(OBJDIR)/$(USER_PARLIB_DIR)/libpthread.a \
+                              $(OBJDIR)/$(USER_PARLIB_DIR)/libivyparlib.a \
+                              $(OBJDIR)/$(USER_APPS_PARLIB_DIR)/%.o
 
 USER_APPS_PARLIB_GCC_LIB   := $(GCC_LIB)
 
-$(OBJDIR)/$(USER_APPS_PARLIB_DIR)/%.o: $(USER_APPS_PARLIB_DIR)/%.c
+$(OBJDIR)/$(USER_APPS_PARLIB_DIR)/%.o: $(USER_APPS_PARLIB_DIR)/%.c $(PATCHFILE)
        @echo + cc [APPS PARLIB] $<
        @mkdir -p $(@D)
        $(V)$(CC) $(USER_APPS_PARLIB_CFLAGS) -c -o $@ $<
@@ -41,4 +56,3 @@ $(OBJDIR)/$(USER_APPS_PARLIB_DIR)/%: $(USER_APPS_PARLIB_LDDEPENDS)
                     $(USER_APPS_PARLIB_LDLIBS) $(USER_APPS_PARLIB_GCC_LIB)
        $(V)$(OBJDUMP) -S $@ > $@.asm
        $(V)$(NM) -n $@ > $@.sym
-