Compiles with GCC
[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_NEWLIB_DIR)/include \
6                               -I$(USER_PARLIB_DIR)/inc
7 ifeq ($(COMPILER),IVY)
8         USER_APPS_PARLIB_CFLAGS    += --nodeputy --nopatch
9 endif
10
11 USER_APPS_PARLIB_LDFLAGS   := $(USER_LDFLAGS) -static \
12                               -T $(USER_APPS_PARLIB_DIR)/apps_$(TARGET_ARCH).ld
13
14 USER_APPS_PARLIB_LDDIRS    := -L$(OBJDIR)/$(USER_PARLIB_DIR) \
15                               -L$(USER_PARLIB_NEWLIB_DIR)/lib/$(TARGET_ARCH)
16
17 USER_APPS_PARLIB_LDLIBS    := --start-group -lc -lm -lg -lparlib -livyparlib --end-group
18
19 USER_APPS_PARLIB_LDOBJS    := $(OBJDIR)/$(USER_PARLIB_ARCH_SRC_DIR)/entry.o \
20                               $(OBJDIR)/$(USER_APPS_PARLIB_DIR)/readline.o \
21                               $(OBJDIR)/$(USER_APPS_PARLIB_DIR)/file_io.o \
22                               $(OBJDIR)/$(USER_APPS_PARLIB_DIR)/file_error.o \
23                               $(OBJDIR)/$(USER_APPS_PARLIB_DIR)/clrscrn.o \
24                               $(OBJDIR)/$(USER_APPS_PARLIB_DIR)/draw_nanwan.o \
25                               $(OBJDIR)/$(USER_APPS_PARLIB_DIR)/change_user.o  
26
27
28 USER_APPS_PARLIB_LDDEPENDS := $(USER_APPS_PARLIB_LDOBJS) \
29                               $(OBJDIR)/$(USER_PARLIB_DIR)/libparlib.a \
30                               $(OBJDIR)/$(USER_PARLIB_DIR)/libivyparlib.a \
31                               $(OBJDIR)/$(USER_APPS_PARLIB_DIR)/%.o       
32
33 USER_APPS_PARLIB_GCC_LIB   := $(GCC_LIB)
34
35 $(OBJDIR)/$(USER_APPS_PARLIB_DIR)/%.o: $(USER_APPS_PARLIB_DIR)/%.c
36         @echo + cc [APPS PARLIB] $<
37         @mkdir -p $(@D)
38         $(V)$(CC) $(USER_APPS_PARLIB_CFLAGS) -c -o $@ $<
39
40 $(OBJDIR)/$(USER_APPS_PARLIB_DIR)/%: $(USER_APPS_PARLIB_LDDEPENDS)
41         @echo + ld [APPS PARLIB] $@
42         $(V)$(LD) -o $@ $(USER_APPS_PARLIB_LDFLAGS) $@.o \
43                     $(USER_APPS_PARLIB_LDOBJS) $(USER_APPS_PARLIB_LDDIRS) \
44                     $(USER_APPS_PARLIB_LDLIBS) $(USER_APPS_PARLIB_GCC_LIB)
45         $(V)$(OBJDUMP) -S $@ > $@.asm
46         $(V)$(NM) -n $@ > $@.sym
47