arch/../src/Makefiles now use only libraries in lib/

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5333 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo 2012-11-11 13:52:31 +00:00
parent 98361244f0
commit 6de9634620
14 changed files with 265 additions and 252 deletions

View File

@ -3601,4 +3601,5 @@
additional logic is needed in the arch/*/src/Makefile's as well. Right additional logic is needed in the arch/*/src/Makefile's as well. Right
now that logic generate multiple library paths, all pointing to the lib/ now that logic generate multiple library paths, all pointing to the lib/
directory. directory.
* arch/*/src/Makefile: Now uses only the libraries in lib/

View File

@ -252,7 +252,7 @@ endif
# LINKLIBS derives from NUTTXLIBS and is simply the same list with the subdirectory removed # LINKLIBS derives from NUTTXLIBS and is simply the same list with the subdirectory removed
LINKLIBS = $(patsubst lib/,,$(NUTTXLIBS)) LINKLIBS = $(patsubst lib/%,%,$(NUTTXLIBS))
# This is the name of the final target (relative to the top level directorty) # This is the name of the final target (relative to the top level directorty)
@ -566,13 +566,13 @@ ifeq ($(CONFIG_BUILD_2PASS),y)
echo "ERROR: No Makefile in CONFIG_PASS1_BUILDIR"; \ echo "ERROR: No Makefile in CONFIG_PASS1_BUILDIR"; \
exit 1; \ exit 1; \
fi fi
$(Q) $(MAKE) -C $(CONFIG_PASS1_BUILDIR) TOPDIR="$(TOPDIR)" LINKLIBS="$(NUTTXLIBS)" USERLIBS="$(USERLIBS)" "$(CONFIG_PASS1_TARGET)" $(Q) $(MAKE) -C $(CONFIG_PASS1_BUILDIR) TOPDIR="$(TOPDIR)" LINKLIBS="$(LINKLIBS)" USERLIBS="$(USERLIBS)" "$(CONFIG_PASS1_TARGET)"
endif endif
pass2deps: context pass2dep $(NUTTXLIBS) pass2deps: context pass2dep $(NUTTXLIBS)
pass2: pass2deps pass2: pass2deps
$(Q) $(MAKE) -C $(ARCH_SRC) TOPDIR="$(TOPDIR)" EXTRA_OBJS="$(EXTRA_OBJS)" LINKLIBS="$(NUTTXLIBS)" EXTRADEFINES=$(KDEFINE) $(BIN) $(Q) $(MAKE) -C $(ARCH_SRC) TOPDIR="$(TOPDIR)" EXTRA_OBJS="$(EXTRA_OBJS)" LINKLIBS="$(LINKLIBS)" EXTRADEFINES=$(KDEFINE) $(BIN)
$(Q) if [ -w /tftpboot ] ; then \ $(Q) if [ -w /tftpboot ] ; then \
cp -f $(BIN) /tftpboot/$(BIN).${CONFIG_ARCH}; \ cp -f $(BIN) /tftpboot/$(BIN).${CONFIG_ARCH}; \
fi fi

View File

@ -59,9 +59,9 @@ SDCCLIBS = -llibfloat.lib -llibint.lib -lliblong.lib -llibmysdcc.lib -lmcs51.lib
LINKSSRCS = up_head.S LINKSSRCS = up_head.S
LINKASRCS = $(LINKSSRCS:.S=$(ASMEXT)) LINKASRCS = $(LINKSSRCS:.S=$(ASMEXT))
LINKOBJS = $(LINKASRCS:$(ASMEXT)=$(OBJEXT)) LINKOBJS = $(LINKASRCS:$(ASMEXT)=$(OBJEXT))
LINKLIBS = LINKLIBS ?=
LDPATHES = $(addprefix -L$(TOPDIR)/,$(dir $(LINKLIBS))) LDPATHS = -L"$(TOPDIR)/lib"
LDLIBS = $(addprefix -l,$(notdir $(LINKLIBS))) LDLIBS = $(patsubst %.a,%,$(patsubst lib%,-l%,$(LINKLIBS)))
TESTSRCS = up_irqtest.c TESTSRCS = up_irqtest.c
TESTOBJS = $(TESTSRCS:.c=$(OBJEXT)) TESTOBJS = $(TESTSRCS:.c=$(OBJEXT))
@ -173,7 +173,7 @@ board/libboard$(LIBEXT):
pass1.hex: up_mem.h $(SDCCLIBDIR)/libmysdcc.lib $(LINKOBJS) board/libboard$(LIBEXT) pass1.hex: up_mem.h $(SDCCLIBDIR)/libmysdcc.lib $(LINKOBJS) board/libboard$(LIBEXT)
@echo "LD: $@" @echo "LD: $@"
@$(CC) $(LDFLAGS) $(LDPATHES) -L$(BOARDDIR) $(SDCCPATH) $(LINKOBJS) \ @$(CC) $(LDFLAGS) $(LDPATHS) -L$(BOARDDIR) $(SDCCPATH) $(LINKOBJS) \
$(LDLIBS) -llibboard$(LIBEXT) $(SDCCLIBS) -o $@ $(LDLIBS) -llibboard$(LIBEXT) $(SDCCLIBS) -o $@
@rm -f up_mem.h @rm -f up_mem.h
@rm -f up_allocateheap$(OBJEXT) libarch$(LIBEXT) @rm -f up_allocateheap$(OBJEXT) libarch$(LIBEXT)
@ -181,7 +181,7 @@ pass1.hex: up_mem.h $(SDCCLIBDIR)/libmysdcc.lib $(LINKOBJS) board/libboard$(LIBE
nuttx.hex: up_mem.h $(SDCCLIBDIR)/libmysdcc.lib $(LINKOBJS) nuttx.hex: up_mem.h $(SDCCLIBDIR)/libmysdcc.lib $(LINKOBJS)
@echo "LD: $@" @echo "LD: $@"
@$(CC) $(LDFLAGS) $(LDPATHES) -L$(BOARDDIR) $(SDCCPATH) $(LINKOBJS) \ @$(CC) $(LDFLAGS) $(LDPATHS) -L$(BOARDDIR) $(SDCCPATH) $(LINKOBJS) \
$(LDLIBS) -llibboard$(LIBEXT) $(SDCCLIBS) -o $@ $(LDLIBS) -llibboard$(LIBEXT) $(SDCCLIBS) -o $@
nuttx$(EXEEXT): pass1.hex nuttx.hex nuttx$(EXEEXT): pass1.hex nuttx.hex

View File

@ -74,16 +74,17 @@ LDFLAGS += $(ARCHSCRIPT)
EXTRA_LIBS ?= EXTRA_LIBS ?=
EXTRA_LIBPATHS ?= EXTRA_LIBPATHS ?=
LINKLIBS ?=
LINKLIBS =
ifeq ($(WINTOOL),y) ifeq ($(WINTOOL),y)
LIBPATHS = ${shell for path in $(LINKLIBS); do dir=`dirname $(TOPDIR)/$$path`;echo "-L\"`cygpath -w $$dir`\"";done} LIBPATHS += -L"${shell cygpath -w "$(TOPDIR)/lib"}"
LIBPATHS += -L"${shell cygpath -w $(BOARDDIR)}" LIBPATHS += -L"${shell cygpath -w $(BOARDDIR)}"
else else
LIBPATHS = $(addprefix -L$(TOPDIR)/,$(dir $(LINKLIBS))) LIBPATHS += -L"(TOPDIR)/lib"
LIBPATHS += -L"$(BOARDDIR)" LIBPATHS += -L"$(BOARDDIR)"
endif endif
LDLIBS = $(patsubst lib%,-l%,$(basename $(notdir $(LINKLIBS))))
LDLIBS = $(patsubst %.a,%,$(patsubst lib%,-l%,$(LINKLIBS)))
BOARDDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src/board BOARDDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src/board

View File

@ -76,16 +76,17 @@ OBJS = $(AOBJS) $(COBJS)
LDFLAGS += $(ARCHSCRIPT) LDFLAGS += $(ARCHSCRIPT)
EXTRA_LIBS ?= EXTRA_LIBS ?=
LINKLIBS ?=
LINKLIBS =
ifeq ($(WINTOOL),y) ifeq ($(WINTOOL),y)
LIBPATHS = ${shell for path in $(LINKLIBS); do dir=`dirname $(TOPDIR)/$$path`;echo "-L\"`cygpath -w $$dir`\"";done} LIBPATHS += -L"${shell cygpath -w "$(TOPDIR)/lib"}"
LIBPATHS += -L"${shell cygpath -w $(BOARDDIR)}" LIBPATHS += -L"${shell cygpath -w $(BOARDDIR)}"
else else
LIBPATHS = $(addprefix -L$(TOPDIR)/,$(dir $(LINKLIBS))) LIBPATHS += -L"(TOPDIR)/lib"
LIBPATHS += -L"$(BOARDDIR)" LIBPATHS += -L"$(BOARDDIR)"
endif endif
LDLIBS = $(patsubst lib%,-l%,$(basename $(notdir $(LINKLIBS))))
LDLIBS = $(patsubst %.a,%,$(patsubst lib%,-l%,$(LINKLIBS)))
BOARDDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src/board BOARDDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src/board

View File

@ -69,16 +69,17 @@ OBJS = $(AOBJS) $(COBJS)
LDFLAGS += $(ARCHSCRIPT) LDFLAGS += $(ARCHSCRIPT)
EXTRA_LIBS ?= EXTRA_LIBS ?=
LINKLIBS ?=
LINKLIBS =
ifeq ($(WINTOOL),y) ifeq ($(WINTOOL),y)
LIBPATHS = ${shell for path in $(LINKLIBS); do dir=`dirname $(TOPDIR)/$$path`;echo "-L\"`cygpath -w $$dir`\"";done} LIBPATHS += -L"${shell cygpath -w "$(TOPDIR)/lib"}"
LIBPATHS += -L"${shell cygpath -w $(BOARDDIR)}" LIBPATHS += -L"${shell cygpath -w $(BOARDDIR)}"
else else
LIBPATHS = $(addprefix -L$(TOPDIR)/,$(dir $(LINKLIBS))) LIBPATHS += -L"(TOPDIR)/lib"
LIBPATHS += -L"$(BOARDDIR)" LIBPATHS += -L"$(BOARDDIR)"
endif endif
LDLIBS = $(patsubst lib%,-l%,$(basename $(notdir $(LINKLIBS))))
LDLIBS = $(patsubst %.a,%,$(patsubst lib%,-l%,$(LINKLIBS)))
BOARDDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src/board BOARDDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src/board

View File

@ -66,16 +66,17 @@ OBJS = $(AOBJS) $(COBJS)
LDFLAGS += $(ARCHSCRIPT) LDFLAGS += $(ARCHSCRIPT)
EXTRA_LIBS ?= EXTRA_LIBS ?=
LINKLIBS ?=
LINKLIBS =
ifeq ($(WINTOOL),y) ifeq ($(WINTOOL),y)
LIBPATHS = ${shell for path in $(LINKLIBS); do dir=`dirname $(TOPDIR)/$$path`;echo "-L\"`cygpath -w $$dir`\"";done} LIBPATHS += -L"${shell cygpath -w "$(TOPDIR)/lib"}"
LIBPATHS += -L"${shell cygpath -w $(BOARDDIR)}" LIBPATHS += -L"${shell cygpath -w $(BOARDDIR)}"
else else
LIBPATHS = $(addprefix -L$(TOPDIR)/,$(dir $(LINKLIBS))) LIBPATHS += -L"(TOPDIR)/lib"
LIBPATHS += -L"$(BOARDDIR)" LIBPATHS += -L"$(BOARDDIR)"
endif endif
LDLIBS = $(patsubst lib%,-l%,$(basename $(notdir $(LINKLIBS))))
LDLIBS = $(patsubst %.a,%,$(patsubst lib%,-l%,$(LINKLIBS)))
BOARDDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src/board BOARDDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src/board

View File

@ -53,9 +53,8 @@ LINKSRCS = rgmp.c bridge.c
LINKOBJS = $(LINKSRCS:.c=$(OBJEXT)) LINKOBJS = $(LINKSRCS:.c=$(OBJEXT))
LDFLAGS += -T$(RGMPLKSCPT) LDFLAGS += -T$(RGMPLKSCPT)
LDPATHS = $(addprefix -L$(TOPDIR)/,$(dir $(LINKLIBS))) LDLIBS = $(patsubst %.a,%,$(patsubst lib%,-l%,$(LINKLIBS)))
LDLIBS = $(patsubst lib%,-l%,$(basename $(notdir $(LINKLIBS)))) LDPATHS += -L"$(TOPDIR)/lib -L$(RGMPLIBDIR)
LDPATHS += -L$(RGMPLIBDIR)
LDLIBS += -lrgmp $(shell $(CC) -print-libgcc-file-name) LDLIBS += -lrgmp $(shell $(CC) -print-libgcc-file-name)
all: libarch$(LIBEXT) all: libarch$(LIBEXT)

View File

@ -52,10 +52,17 @@ OBJS = $(AOBJS) $(COBJS)
LDFLAGS += $(ARCHSCRIPT) LDFLAGS += $(ARCHSCRIPT)
EXTRA_LIBS ?= EXTRA_LIBS ?=
LINKLIBS ?=
LINKLIBS = ifeq ($(WINTOOL),y)
LDPATHES = $(addprefix -L$(TOPDIR)/,$(dir $(LINKLIBS))) LIBPATHS += -L"${shell cygpath -w "$(TOPDIR)/lib"}"
LDLIBS = $(patsubst lib%,-l%,$(basename $(notdir $(LINKLIBS)))) LIBPATHS += -L"${shell cygpath -w $(BOARDDIR)}"
else
LIBPATHS += -L"(TOPDIR)/lib"
LIBPATHS += -L"$(BOARDDIR)"
endif
LDLIBS = $(patsubst %.a,%,$(patsubst lib%,-l%,$(LINKLIBS)))
BOARDDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src/board BOARDDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src/board
@ -83,7 +90,7 @@ board/libboard$(LIBEXT):
nuttx: $(HEAD_OBJ) board/libboard$(LIBEXT) nuttx: $(HEAD_OBJ) board/libboard$(LIBEXT)
@echo "LD: nuttx" @echo "LD: nuttx"
@$(LD) --entry=__start $(LDFLAGS) $(LDPATHES) -L$(BOARDDIR) -o $(TOPDIR)/$@ $(HEAD_OBJ) \ @$(LD) --entry=__start $(LDFLAGS) $(LDPATHS) -L$(BOARDDIR) -o $(TOPDIR)/$@ $(HEAD_OBJ) \
--start-group $(LDLIBS) -lboard $(EXTRA_LIBS) $(LIBGCC) --end-group --start-group $(LDLIBS) -lboard $(EXTRA_LIBS) $(LIBGCC) --end-group
@$(NM) $(TOPDIR)/$@ | \ @$(NM) $(TOPDIR)/$@ | \
grep -v '\(compiled\)\|\(\$(OBJEXT)$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | \ grep -v '\(compiled\)\|\(\$(OBJEXT)$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | \

View File

@ -126,9 +126,10 @@ endif
# Determine which NuttX libraries will need to be linked in # Determine which NuttX libraries will need to be linked in
# Most are provided by LINKLIBS on the MAKE command line # Most are provided by LINKLIBS on the MAKE command line
LINKLIBS = LINKLIBS ?=
LDPATHS = $(addprefix -L$(TOPDIR)/,$(dir $(LINKLIBS))) LIBPATHS += -L"(TOPDIR)/lib"
LDLIBS = $(patsubst lib%,-l%,$(basename $(notdir $(LINKLIBS)))) LIBPATHS += -L"$(BOARDDIR)"
LDLIBS = $(patsubst %.a,%,$(patsubst lib%,-l%,$(LINKLIBS)))
# Add the board-specific library and directory # Add the board-specific library and directory

View File

@ -66,16 +66,17 @@ OBJS = $(AOBJS) $(COBJS)
LDFLAGS += $(ARCHSCRIPT) LDFLAGS += $(ARCHSCRIPT)
EXTRA_LIBS ?= EXTRA_LIBS ?=
LINKLIBS ?=
LINKLIBS =
ifeq ($(WINTOOL),y) ifeq ($(WINTOOL),y)
LIBPATHS = ${shell for path in $(LINKLIBS); do dir=`dirname $(TOPDIR)/$$path`;echo "-L\"`cygpath -w $$dir`\"";done} LIBPATHS += -L"${shell cygpath -w "$(TOPDIR)/lib"}"
LIBPATHS += -L"${shell cygpath -w $(BOARDDIR)}" LIBPATHS += -L"${shell cygpath -w $(BOARDDIR)}"
else else
LIBPATHS = $(addprefix -L$(TOPDIR)/,$(dir $(LINKLIBS))) LIBPATHS += -L"(TOPDIR)/lib"
LIBPATHS += -L"$(BOARDDIR)" LIBPATHS += -L"$(BOARDDIR)"
endif endif
LDLIBS = $(patsubst lib%,-l%,$(basename $(notdir $(LINKLIBS))))
LDLIBS = $(patsubst %.a,%,$(patsubst lib%,-l%,$(LINKLIBS)))
BOARDDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src/board BOARDDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src/board

View File

@ -103,7 +103,7 @@ nuttx.linkcmd: $(LINKCMDTEMPLATE)
@echo "\"${shell cygpath -w $(TOPDIR)/nuttx}\"= \\" >>nuttx.linkcmd @echo "\"${shell cygpath -w $(TOPDIR)/nuttx}\"= \\" >>nuttx.linkcmd
@echo " \"${shell cygpath -w $(ARCHSRCDIR)/$(HEAD_OBJ)}\", \\" >>nuttx.linkcmd @echo " \"${shell cygpath -w $(ARCHSRCDIR)/$(HEAD_OBJ)}\", \\" >>nuttx.linkcmd
@( for lib in $(LINKLIBS); do \ @( for lib in $(LINKLIBS); do \
echo " \"`cygpath -w $(TOPDIR)/$${lib}`\", \\" >>nuttx.linkcmd; \ echo " \"`cygpath -w $(TOPDIR)/lib/$${lib}`\", \\" >>nuttx.linkcmd; \
done ; ) done ; )
@echo " \"${shell cygpath -w $(ARCHSRCDIR)/board/libboard$(LIBEXT)}\", \\" >>nuttx.linkcmd @echo " \"${shell cygpath -w $(ARCHSRCDIR)/board/libboard$(LIBEXT)}\", \\" >>nuttx.linkcmd
@echo " \"${shell cygpath -w $(ZDSSTDLIBDIR)/chelpld$(LIBEXT)}\", \\" >>nuttx.linkcmd @echo " \"${shell cygpath -w $(ZDSSTDLIBDIR)/chelpld$(LIBEXT)}\", \\" >>nuttx.linkcmd

View File

@ -152,7 +152,7 @@ pass1.hex: up_mem.h asm_mem.h $(SDCCLIBDIR)/myz80.lib $(HEAD_OBJ) board/libboard
@echo "-k $(SDCCLIBDIR)" >>pass1.lnk # Path to SDCC z80 library @echo "-k $(SDCCLIBDIR)" >>pass1.lnk # Path to SDCC z80 library
@echo "-l libboard$(LIBEXT)" >>pass1.lnk # Name of board library @echo "-l libboard$(LIBEXT)" >>pass1.lnk # Name of board library
@for LIB in $(LINKLIBS); do \ @for LIB in $(LINKLIBS); do \
echo "-l $(TOPDIR)/$$LIB" >> pass1.lnk ;\ echo "-l $(TOPDIR)/lib/$$LIB" >> pass1.lnk ;\
done done
@echo "-l myz80.lib" >>pass1.lnk # Name of SDCC z80 library @echo "-l myz80.lib" >>pass1.lnk # Name of SDCC z80 library
ifneq ($(CONFIG_LINKER_START_AREA),) ifneq ($(CONFIG_LINKER_START_AREA),)
@ -185,7 +185,7 @@ nuttx.hex: up_mem.h asm_mem.h $(SDCCLIBDIR)/myz80.lib $(HEAD_OBJ) board/libboard
@echo "-k $(SDCCLIBDIR)" >>nuttx.lnk # Path to SDCC z80 library @echo "-k $(SDCCLIBDIR)" >>nuttx.lnk # Path to SDCC z80 library
@echo "-l libboard$(LIBEXT)" >>nuttx.lnk # Name of board library @echo "-l libboard$(LIBEXT)" >>nuttx.lnk # Name of board library
@for LIB in $(LINKLIBS); do \ @for LIB in $(LINKLIBS); do \
echo "-l $(TOPDIR)/$$LIB" >> nuttx.lnk ;\ echo "-l $(TOPDIR)/lib/$$LIB" >> nuttx.lnk ;\
done done
@echo "-l myz80.lib" >>nuttx.lnk # Name of SDCC z80 library @echo "-l myz80.lib" >>nuttx.lnk # Name of SDCC z80 library
ifneq ($(CONFIG_LINKER_START_AREA),) ifneq ($(CONFIG_LINKER_START_AREA),)

View File

@ -63,16 +63,16 @@ PASS1_LINKLIBS += $(PASS1_LIBBOARD)
ifeq ($(WINTOOL),y) ifeq ($(WINTOOL),y)
# Windows-native toolchains # Windows-native toolchains
PASS1_LIBPATHS = ${shell for path in $(PASS1_LINKLIBS); do dir=`dirname $(TOPDIR)/$$path`;echo "-L\"`cygpath -w $$dir`\"";done} PASS1_LIBPATHS += -L"${shell cygpath -w "$(TOPDIR)/lib"}"
PASS1_LDSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/locked/ld-locked.inc}" PASS1_LDSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/locked/ld-locked.inc}"
else else
# Linux/Cygwin-native toolchain # Linux/Cygwin-native toolchain
PASS1_LIBPATHS = $(addprefix -L$(TOPDIR)/,$(dir $(PASS1_LINKLIBS))) PASS1_LIBPATHS += -L"(TOPDIR)/lib"
PASS1_LDSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/locked/ld-locked.inc PASS1_LDSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/locked/ld-locked.inc
endif endif
PASS1_LDFLAGS = -r $(PASS1_LDSCRIPT) PASS1_LDFLAGS = -r $(PASS1_LDSCRIPT)
PASS1_LDLIBS = $(patsubst lib%,-l%,$(basename $(notdir $(PASS1_LINKLIBS)))) PASS1_LDLIBS = $(patsubst %.a,%,$(patsubst lib%,-l%,$(PASS1_LINKLIBS)))
PASS1_LIBGCC = "${shell $(CC) -print-libgcc-file-name}" PASS1_LIBGCC = "${shell $(CC) -print-libgcc-file-name}"
# Targets: # Targets: