Merge branch 'sparc-dev' of ssh://waterman@scm.millennium.berkeley.edu/project/cs...
[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_PTHREAD_DIR)/include \
6                               -I$(USER_PARLIB_NEWLIB_DIR)/include \
7                               -I$(USER_PARLIB_DIR)/inc
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   := $(USER_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_PARLIB_PTHREAD_DIR) \
18                               -L$(USER_PARLIB_NEWLIB_DIR)/lib/$(TARGET_ARCH)
19
20 USER_APPS_PARLIB_LDLIBS    := --start-group -lc -lm -lg -lparlib -livyparlib --end-group
21
22 USER_APPS_PARLIB_LDOBJS    := $(OBJDIR)/$(USER_PARLIB_ARCH_SRC_DIR)/entry.o \
23                               $(OBJDIR)/$(USER_APPS_PARLIB_DIR)/readline.o \
24                               $(OBJDIR)/$(USER_APPS_PARLIB_DIR)/file_io.o \
25                               $(OBJDIR)/$(USER_APPS_PARLIB_DIR)/file_error.o \
26                               $(OBJDIR)/$(USER_APPS_PARLIB_DIR)/clrscrn.o \
27                               $(OBJDIR)/$(USER_APPS_PARLIB_DIR)/draw_nanwan.o \
28                               $(OBJDIR)/$(USER_APPS_PARLIB_DIR)/run_binary.o \
29                               $(OBJDIR)/$(USER_APPS_PARLIB_DIR)/run_binary_colored.o \
30                               $(OBJDIR)/$(USER_APPS_PARLIB_DIR)/change_user.o  
31
32
33 USER_APPS_PARLIB_LDDEPENDS := $(USER_APPS_PARLIB_LDOBJS) \
34                               $(OBJDIR)/$(USER_PARLIB_DIR)/libparlib.a \
35                               $(OBJDIR)/$(USER_PARLIB_DIR)/libivyparlib.a \
36                               $(OBJDIR)/$(USER_APPS_PARLIB_DIR)/%.o
37
38 USER_APPS_PARLIB_GCC_LIB   := $(GCC_LIB)
39
40 include $(USER_APPS_PARLIB_DIR)/pthread/Makefrag
41
42 $(OBJDIR)/$(USER_APPS_PARLIB_DIR)/%.o: $(USER_APPS_PARLIB_DIR)/%.c $(PATCHFILE)
43         @echo + cc [APPS PARLIB] $<
44         @mkdir -p $(@D)
45         $(V)$(CC) $(USER_APPS_PARLIB_CFLAGS) -c -o $@ $<
46
47 $(OBJDIR)/$(USER_APPS_PARLIB_DIR)/%: $(USER_APPS_PARLIB_LDDEPENDS)
48         @echo + ld [APPS PARLIB] $@
49         $(V)$(LD) -o $@ $(USER_APPS_PARLIB_LDFLAGS) $@.o \
50                     $(USER_APPS_PARLIB_LDOBJS) $(USER_APPS_PARLIB_LDDIRS) \
51                     $(USER_APPS_PARLIB_LDLIBS) $(USER_APPS_PARLIB_GCC_LIB)
52         $(V)$(OBJDUMP) -S $@ > $@.asm
53         $(V)$(NM) -n $@ > $@.sym