First run at integrating LWIP into the tree (again)
[akaros.git] / user / apps / parlib / Makefrag
1 USER_APPS_PARLIB_DIR = $(USER_APPS_DIR)/parlib
2 OBJDIRS += $(USER_APPS_PARLIB_DIR)
3
4 USER_APPS_PARLIB_CFLAGS    := $(USER_CFLAGS)  \
5                               -I$(USER_PARLIB_DIR)/inc \
6                               -I$(USER_LWIP_DIR)/include
7                               # -I$(USER_PARLIB_NEWLIB_DIR)/include
8 ifeq ($(COMPILER),IVY)
9         PATCHFILE = $(OBJDIR)/$(USER_PARLIB_DIR)/libc_patch.i
10         USER_APPS_PARLIB_CFLAGS    += --nodeputy --nopatch #--patch=$(PATCHFILE) 
11 endif
12
13 USER_APPS_PARLIB_LDFLAGS   := -static \
14                               -T $(USER_APPS_PARLIB_DIR)/apps_$(TARGET_ARCH).ld
15
16 USER_APPS_PARLIB_LDDIRS    := -L$(OBJDIR)/$(USER_PARLIB_DIR) \
17                               -L$(OBJDIR)/$(USER_LWIP_DIR)
18
19 USER_APPS_PARLIB_LDLIBS    := --start-group -lc -lm -lg -lparlib -llwip \
20                               -lpthread -livyparlib --end-group
21
22 USER_APPS_PARLIB_LDOBJS    := \
23                               $(OBJDIR)/$(USER_PARLIB_ARCH_SRC_DIR)/entry.o \
24                               $(OBJDIR)/$(USER_PARLIB_ARCH_SRC_DIR)/crtbegin.o \
25                               $(OBJDIR)/$(USER_PARLIB_ARCH_SRC_DIR)/crtend.o \
26                               $(OBJDIR)/$(USER_APPS_PARLIB_DIR)/readline.o \
27                               $(OBJDIR)/$(USER_APPS_PARLIB_DIR)/file_io.o \
28                               $(OBJDIR)/$(USER_APPS_PARLIB_DIR)/file_error.o \
29                               $(OBJDIR)/$(USER_APPS_PARLIB_DIR)/clrscrn.o \
30                               $(OBJDIR)/$(USER_APPS_PARLIB_DIR)/draw_nanwan.o \
31                               $(OBJDIR)/$(USER_APPS_PARLIB_DIR)/run_binary.o \
32                               $(OBJDIR)/$(USER_APPS_PARLIB_DIR)/run_binary_colored.o \
33                               $(OBJDIR)/$(USER_APPS_PARLIB_DIR)/change_user.o \
34                               $(OBJDIR)/$(USER_APPS_PARLIB_DIR)/ping.o \
35                               $(OBJDIR)/$(USER_APPS_PARLIB_DIR)/network_init.o
36
37
38 USER_APPS_PARLIB_LDDEPENDS := $(USER_APPS_PARLIB_LDOBJS) \
39                               $(OBJDIR)/$(USER_PARLIB_DIR)/libparlib.a \
40                               $(OBJDIR)/$(USER_LWIP_DIR)/liblwip.a \
41                               $(OBJDIR)/$(USER_PARLIB_DIR)/libpthread.a \
42                               $(OBJDIR)/$(USER_PARLIB_DIR)/libivyparlib.a \
43                               $(OBJDIR)/$(USER_APPS_PARLIB_DIR)/%.o
44
45 USER_APPS_PARLIB_GCC_LIB   := $(GCC_LIB)
46
47 $(OBJDIR)/$(USER_APPS_PARLIB_DIR)/%.o: $(USER_APPS_PARLIB_DIR)/%.c $(PATCHFILE)
48         @echo + cc [APPS PARLIB] $<
49         @mkdir -p $(@D)
50         $(V)$(CC) $(USER_APPS_PARLIB_CFLAGS) -c -o $@ $<
51
52 $(OBJDIR)/$(USER_APPS_PARLIB_DIR)/%: $(USER_APPS_PARLIB_LDDEPENDS)
53         @echo + ld [APPS PARLIB] $@
54         $(V)$(LD) -o $@ $(USER_APPS_PARLIB_LDFLAGS) $@.o \
55                     $(USER_APPS_PARLIB_LDOBJS) $(USER_APPS_PARLIB_LDDIRS) \
56                     $(USER_APPS_PARLIB_LDLIBS) $(USER_APPS_PARLIB_GCC_LIB)
57         $(V)$(OBJDUMP) -S $@ > $@.asm
58         $(V)$(NM) -n $@ > $@.sym