From 78f865ea25a5f06b6b00ec1a3283335953925cb6 Mon Sep 17 00:00:00 2001 From: John Hodge Date: Wed, 6 Jul 2011 23:10:06 +0800 Subject: [PATCH] Usermode Build - Updated makefiles to compile needed libraries if not avaliable --- Usermode/Applications/Makefile.tpl | 17 +++++++++++++---- Usermode/Libraries/Makefile.tpl | 8 ++++++++ 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/Usermode/Applications/Makefile.tpl b/Usermode/Applications/Makefile.tpl index c9409174..b2cfcd1f 100644 --- a/Usermode/Applications/Makefile.tpl +++ b/Usermode/Applications/Makefile.tpl @@ -9,6 +9,9 @@ LDFLAGS += _BIN := $(OUTPUTDIR)$(DIR)/$(BIN) _OBJPREFIX := obj-$(ARCH)/ +_LIBS := $(filter -l%,$(LDFLAGS)) +_LIBS := $(patsubst -l%,$(OUTPUTDIR)Libs/lib%.so,$(_LIBS)) + OBJ := $(addprefix $(_OBJPREFIX),$(OBJ)) DEPFILES := $(OBJ:%.o=%.dep) @@ -18,7 +21,8 @@ DEPFILES := $(OBJ:%.o=%.dep) all: $(_BIN) clean: - @$(RM) $(OBJ) $(DEPFILES) $(_BIN) $(BIN).dsm Map.txt + @$(RM) $(OBJ) $(DEPFILES) $(_BIN) $(BIN).dsm + @$(RM) -r $(_OBJPREFIX) install: $(_BIN) @echo [xCP] $(DISTROOT)/$(DIR)/$(BIN) @@ -27,13 +31,13 @@ install: $(_BIN) @$(xCP) $(_BIN)_ $(DISTROOT)/$(DIR)/$(BIN) @$(RM) $(_BIN)_ -$(_BIN): $(OBJ) +$(_BIN): $(OUTPUTDIR)Libs/acess.ld $(OUTPUTDIR)Libs/crt0.o $(_LIBS) $(OBJ) @mkdir -p $(dir $(_BIN)) @echo [LD] -o $@ ifneq ($(_DBGMAKEFILE),) - $(LD) -g $(LDFLAGS) -o $@ $(OBJ) -Map Map.txt + $(LD) -g $(LDFLAGS) -o $@ $(OBJ) -Map $(_OBJPREFIX)Map.txt else - @$(LD) -g $(LDFLAGS) -o $@ $(OBJ) -Map Map.txt + @$(LD) -g $(LDFLAGS) -o $@ $(OBJ) -Map $(_OBJPREFIX)Map.txt endif @$(DISASM) $(_BIN) > $(BIN).dsm @@ -45,4 +49,9 @@ endif @$(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@ @$(CC) -M -MT $@ $(CPPFLAGS) $< -o $(_OBJPREFIX)$*.dep +$(OUTPUTDIR)Libs/libld-acess.so: + @make -C $(ACESSDIR)/Usermode/Libraries/ld-acess.so_src/ +$(OUTPUTDIR)Libs/%: + @make -C $(ACESSDIR)/Usermode/Libraries/$*_src/ + -include $(DEPFILES) diff --git a/Usermode/Libraries/Makefile.tpl b/Usermode/Libraries/Makefile.tpl index 29129b6b..7a46c515 100644 --- a/Usermode/Libraries/Makefile.tpl +++ b/Usermode/Libraries/Makefile.tpl @@ -7,6 +7,9 @@ _BIN := $(OUTPUTDIR)Libs/$(BIN) _XBIN := $(addprefix $(OUTPUTDIR)Libs/,$(EXTRABIN)) _OBJPREFIX := obj-$(ARCH)/ +_LIBS := $(filter -l%,$(LDFLAGS)) +_LIBS := $(patsubst -l%,$(OUTPUTDIR)Libs/lib%.so,$(_LIBS)) + OBJ := $(addprefix $(_OBJPREFIX),$(OBJ)) DEPFILES := $(addsuffix .dep,$(OBJ)) @@ -46,4 +49,9 @@ $(_OBJPREFIX)%.ao: %.asm @$(AS) $(ASFLAGS) -o $@ $< @$(AS) $(ASFLAGS) -o $@ $< -M > $@.dep +#$(OUTPUTDIR)Libs/libld-acess.so: +# @make -C $(ACESSDIR)/Usermode/Libraries/ld-acess.so_src/ +$(OUTPUTDIR)Libs/%: + @make -C $(ACESSDIR)/Usermode/Libraries/$*_src/ + -include $(DEPFILES) -- 2.20.1