Merge remote branch 'origin/sparc-dev'
[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_PARLIB_NEWLIB_DIR)/include
7 ifeq ($(COMPILER),IVY)
8         PATCHFILE = $(OBJDIR)/$(USER_PARLIB_DIR)/libc_patch.i
9         USER_APPS_PARLIB_CFLAGS    += --nodeputy --nopatch #--patch=$(PATCHFILE) 
10 endif
11
12 USER_APPS_PARLIB_LDFLAGS   := $(USER_LDFLAGS) -static \
13                               -T $(USER_APPS_PARLIB_DIR)/apps_$(TARGET_ARCH).ld
14
15 USER_APPS_PARLIB_LDDIRS    := -L$(OBJDIR)/$(USER_PARLIB_DIR) \
16                               -L$(USER_PARLIB_NEWLIB_DIR)/lib/$(TARGET_ARCH)
17
18 USER_APPS_PARLIB_LDLIBS    := --start-group -lc -lm -lg -lparlib -lpthread \
19                               -livyparlib --end-group
20
21 USER_APPS_PARLIB_LDOBJS    := \
22                               $(OBJDIR)/$(USER_PARLIB_ARCH_SRC_DIR)/entry.o \
23                               $(OBJDIR)/$(USER_PARLIB_ARCH_SRC_DIR)/crtbegin.o \
24                               $(OBJDIR)/$(USER_PARLIB_ARCH_SRC_DIR)/crtend.o \
25                               $(OBJDIR)/$(USER_APPS_PARLIB_DIR)/readline.o \
26                               $(OBJDIR)/$(USER_APPS_PARLIB_DIR)/file_io.o \
27                               $(OBJDIR)/$(USER_APPS_PARLIB_DIR)/file_error.o \
28                               $(OBJDIR)/$(USER_APPS_PARLIB_DIR)/clrscrn.o \
29                               $(OBJDIR)/$(USER_APPS_PARLIB_DIR)/draw_nanwan.o \
30                               $(OBJDIR)/$(USER_APPS_PARLIB_DIR)/run_binary.o \
31                               $(OBJDIR)/$(USER_APPS_PARLIB_DIR)/run_binary_colored.o \
32                               $(OBJDIR)/$(USER_APPS_PARLIB_DIR)/change_user.o  
33
34
35 USER_APPS_PARLIB_LDDEPENDS := $(USER_APPS_PARLIB_LDOBJS) \
36                               $(OBJDIR)/$(USER_PARLIB_DIR)/libparlib.a \
37                               $(OBJDIR)/$(USER_PARLIB_DIR)/libivyparlib.a \
38                               $(OBJDIR)/$(USER_APPS_PARLIB_DIR)/%.o
39
40 USER_APPS_PARLIB_GCC_LIB   := $(GCC_LIB)
41
42 include $(USER_APPS_PARLIB_DIR)/pthread/Makefrag
43
44 $(OBJDIR)/$(USER_APPS_PARLIB_DIR)/%.o: $(USER_APPS_PARLIB_DIR)/%.c $(PATCHFILE)
45         @echo + cc [APPS PARLIB] $<
46         @mkdir -p $(@D)
47         $(V)$(CC) $(USER_APPS_PARLIB_CFLAGS) -c -o $@ $<
48
49 $(OBJDIR)/$(USER_APPS_PARLIB_DIR)/%: $(USER_APPS_PARLIB_LDDEPENDS)
50         @echo + ld [APPS PARLIB] $@
51         $(V)$(LD) -o $@ $(USER_APPS_PARLIB_LDFLAGS) $@.o \
52                     $(USER_APPS_PARLIB_LDOBJS) $(USER_APPS_PARLIB_LDDIRS) \
53                     $(USER_APPS_PARLIB_LDLIBS) $(USER_APPS_PARLIB_GCC_LIB)
54         $(V)$(OBJDUMP) -S $@ > $@.asm
55         $(V)$(NM) -n $@ > $@.sym