Added external user binary support (usrbin/)
[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 -livyparlib --end-group
19
20 USER_APPS_PARLIB_LDOBJS    := $(OBJDIR)/$(USER_PARLIB_ARCH_SRC_DIR)/entry.o \
21                               $(OBJDIR)/$(USER_APPS_PARLIB_DIR)/readline.o \
22                               $(OBJDIR)/$(USER_APPS_PARLIB_DIR)/file_io.o \
23                               $(OBJDIR)/$(USER_APPS_PARLIB_DIR)/file_error.o \
24                               $(OBJDIR)/$(USER_APPS_PARLIB_DIR)/clrscrn.o \
25                               $(OBJDIR)/$(USER_APPS_PARLIB_DIR)/draw_nanwan.o \
26                               $(OBJDIR)/$(USER_APPS_PARLIB_DIR)/run_binary.o \
27                               $(OBJDIR)/$(USER_APPS_PARLIB_DIR)/run_binary_colored.o \
28                               $(OBJDIR)/$(USER_APPS_PARLIB_DIR)/change_user.o  
29
30
31 USER_APPS_PARLIB_LDDEPENDS := $(USER_APPS_PARLIB_LDOBJS) \
32                               $(OBJDIR)/$(USER_PARLIB_DIR)/libparlib.a \
33                               $(OBJDIR)/$(USER_PARLIB_DIR)/libparlib-pthread.a \
34                               $(OBJDIR)/$(USER_PARLIB_DIR)/libivyparlib.a \
35                               $(OBJDIR)/$(USER_APPS_PARLIB_DIR)/%.o
36
37 USER_APPS_PARLIB_GCC_LIB   := $(GCC_LIB)
38
39 include $(USER_APPS_PARLIB_DIR)/pthread/Makefrag
40
41 $(OBJDIR)/$(USER_APPS_PARLIB_DIR)/%.o: $(USER_APPS_PARLIB_DIR)/%.c $(PATCHFILE)
42         @echo + cc [APPS PARLIB] $<
43         @mkdir -p $(@D)
44         $(V)$(CC) $(USER_APPS_PARLIB_CFLAGS) -c -o $@ $<
45
46 $(OBJDIR)/$(USER_APPS_PARLIB_DIR)/%: $(USER_APPS_PARLIB_LDDEPENDS)
47         @echo + ld [APPS PARLIB] $@
48         $(V)$(LD) -o $@ $(USER_APPS_PARLIB_LDFLAGS) $@.o \
49                     $(USER_APPS_PARLIB_LDOBJS) $(USER_APPS_PARLIB_LDDIRS) \
50                     $(USER_APPS_PARLIB_LDLIBS) $(USER_APPS_PARLIB_GCC_LIB)
51         $(V)$(OBJDUMP) -S $@ > $@.asm
52         $(V)$(NM) -n $@ > $@.sym