Skip to content

Commit

Permalink
arch/../src/Makefiles now use only libraries in lib/
Browse files Browse the repository at this point in the history
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5333 42af7a65-404d-4744-a932-0658087f49c3
  • Loading branch information
patacongo committed Nov 11, 2012
1 parent 9836124 commit 6de9634
Show file tree
Hide file tree
Showing 14 changed files with 273 additions and 260 deletions.
1 change: 1 addition & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -3601,4 +3601,5 @@
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/
directory.
* arch/*/src/Makefile: Now uses only the libraries in lib/

6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ endif

# 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)

Expand Down Expand Up @@ -566,13 +566,13 @@ ifeq ($(CONFIG_BUILD_2PASS),y)
echo "ERROR: No Makefile in CONFIG_PASS1_BUILDIR"; \
exit 1; \
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

pass2deps: context pass2dep $(NUTTXLIBS)

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 \
cp -f $(BIN) /tftpboot/$(BIN).${CONFIG_ARCH}; \
fi
Expand Down
100 changes: 50 additions & 50 deletions arch/8051/src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,68 +35,68 @@

-include $(TOPDIR)/Make.defs

CFLAGS += -I$(TOPDIR)/sched
ASFLAGS = -x -j -g -l -s -p
CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -D__ASSEMBLY__

SSRCS =
ASRCS = $(SSRCS:.S=$(ASMEXT))
AOBJS = $(ASRCS:$(ASMEXT)=$(OBJEXT))
CSRCS = up_initialize.c up_idle.c up_interruptcontext.c \
up_initialstate.c up_unblocktask.c up_blocktask.c \
up_releasepending.c up_reprioritizertr.c \
up_exit.c up_assert.c up_allocateheap.c \
up_irq.c up_savecontext.c up_restorecontext.c \
up_timerisr.c up_putc.c up_debug.c up_delay.c
COBJS = $(CSRCS:.c=$(OBJEXT))
SRCS = $(SSRCS) $(CSRCS)
OBJS = $(AOBJS) $(COBJS)

SDCCLIBDIR = /usr/local/share/sdcc/lib/large-stack-auto
SDCCPATH = -L$(SDCCLIBDIR)
SDCCLIBS = -llibfloat.lib -llibint.lib -lliblong.lib -llibmysdcc.lib -lmcs51.lib

LINKSSRCS = up_head.S
LINKASRCS = $(LINKSSRCS:.S=$(ASMEXT))
LINKOBJS = $(LINKASRCS:$(ASMEXT)=$(OBJEXT))
LINKLIBS =
LDPATHES = $(addprefix -L$(TOPDIR)/,$(dir $(LINKLIBS)))
LDLIBS = $(addprefix -l,$(notdir $(LINKLIBS)))

TESTSRCS = up_irqtest.c
TESTOBJS = $(TESTSRCS:.c=$(OBJEXT))
TESTLINKOBJS = up_head$(OBJEXT)
TESTEXTRAOBJS = up_savecontext$(OBJEXT) up_restorecontext$(OBJEXT)

BOARDDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src/board

IRAM_SIZE = 0x100
DEF_STACK_BASE = 0x24
LDFLAGS += --model-large --nostdlib \
--data-loc $(DEF_STACK_BASE) --iram-size $(IRAM_SIZE) \
--code-loc 0x2100 --code-size 0x5f40 \
--xram-loc $(IRAM_SIZE) --xram-size 0x1f00

DEPSRCS = $(SRCS) $(LINKSSRCS)

HEAP1_BASE = ${shell \
CFLAGS += -I$(TOPDIR)/sched
ASFLAGS = -x -j -g -l -s -p
CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -D__ASSEMBLY__

SSRCS =
ASRCS = $(SSRCS:.S=$(ASMEXT))
AOBJS = $(ASRCS:$(ASMEXT)=$(OBJEXT))
CSRCS = up_initialize.c up_idle.c up_interruptcontext.c \
up_initialstate.c up_unblocktask.c up_blocktask.c \
up_releasepending.c up_reprioritizertr.c \
up_exit.c up_assert.c up_allocateheap.c \
up_irq.c up_savecontext.c up_restorecontext.c \
up_timerisr.c up_putc.c up_debug.c up_delay.c
COBJS = $(CSRCS:.c=$(OBJEXT))
SRCS = $(SSRCS) $(CSRCS)
OBJS = $(AOBJS) $(COBJS)

SDCCLIBDIR = /usr/local/share/sdcc/lib/large-stack-auto
SDCCPATH = -L$(SDCCLIBDIR)
SDCCLIBS = -llibfloat.lib -llibint.lib -lliblong.lib -llibmysdcc.lib -lmcs51.lib

LINKSSRCS = up_head.S
LINKASRCS = $(LINKSSRCS:.S=$(ASMEXT))
LINKOBJS = $(LINKASRCS:$(ASMEXT)=$(OBJEXT))
LINKLIBS ?=
LDPATHS = -L"$(TOPDIR)/lib"
LDLIBS = $(patsubst %.a,%,$(patsubst lib%,-l%,$(LINKLIBS)))

TESTSRCS = up_irqtest.c
TESTOBJS = $(TESTSRCS:.c=$(OBJEXT))
TESTLINKOBJS = up_head$(OBJEXT)
TESTEXTRAOBJS = up_savecontext$(OBJEXT) up_restorecontext$(OBJEXT)

BOARDDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src/board

IRAM_SIZE = 0x100
DEF_STACK_BASE = 0x24
LDFLAGS += --model-large --nostdlib \
--data-loc $(DEF_STACK_BASE) --iram-size $(IRAM_SIZE) \
--code-loc 0x2100 --code-size 0x5f40 \
--xram-loc $(IRAM_SIZE) --xram-size 0x1f00

DEPSRCS = $(SRCS) $(LINKSSRCS)

HEAP1_BASE = ${shell \
if [ -e pass1.mem ]; then \
cat pass1.mem | grep "EXTERNAL RAM" | \
sed -e "s/[ ][ ]*/ /g" | cut -d' ' -f5 ; \
else \
echo $(IRAM_SIZE) ; \
fi \
}
DEF_HEAP2_BASE = 0x6000
HEAP2_BASE = ${shell \
DEF_HEAP2_BASE = 0x6000
HEAP2_BASE = ${shell \
if [ -e pass1.mem ]; then \
cat pass1.mem | grep "ROM/EPROM/FLASH" | \
sed -e "s/[ ][ ]*/ /g" | cut -d' ' -f4 ; \
else \
echo $(DEF_HEAP2_BASE) ; \
fi \
}
STACK_BASE = ${shell \
STACK_BASE = ${shell \
if [ -e pass1.mem ]; then \
cat pass1.mem | grep "Stack starts" | \
cut -d' ' -f4 ; \
Expand Down Expand Up @@ -173,15 +173,15 @@ board/libboard$(LIBEXT):

pass1.hex: up_mem.h $(SDCCLIBDIR)/libmysdcc.lib $(LINKOBJS) board/libboard$(LIBEXT)
@echo "LD: $@"
@$(CC) $(LDFLAGS) $(LDPATHES) -L$(BOARDDIR) $(SDCCPATH) $(LINKOBJS) \
@$(CC) $(LDFLAGS) $(LDPATHS) -L$(BOARDDIR) $(SDCCPATH) $(LINKOBJS) \
$(LDLIBS) -llibboard$(LIBEXT) $(SDCCLIBS) -o $@
@rm -f up_mem.h
@rm -f up_allocateheap$(OBJEXT) libarch$(LIBEXT)
@$(MAKE) TOPDIR=$(TOPDIR) libarch$(LIBEXT)

nuttx.hex: up_mem.h $(SDCCLIBDIR)/libmysdcc.lib $(LINKOBJS)
@echo "LD: $@"
@$(CC) $(LDFLAGS) $(LDPATHES) -L$(BOARDDIR) $(SDCCPATH) $(LINKOBJS) \
@$(CC) $(LDFLAGS) $(LDPATHS) -L$(BOARDDIR) $(SDCCPATH) $(LINKOBJS) \
$(LDLIBS) -llibboard$(LIBEXT) $(SDCCLIBS) -o $@

nuttx$(EXEEXT): pass1.hex nuttx.hex
Expand Down
9 changes: 5 additions & 4 deletions arch/arm/src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -74,16 +74,17 @@ LDFLAGS += $(ARCHSCRIPT)

EXTRA_LIBS ?=
EXTRA_LIBPATHS ?=
LINKLIBS ?=

LINKLIBS =
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)}"
else
LIBPATHS = $(addprefix -L$(TOPDIR)/,$(dir $(LINKLIBS)))
LIBPATHS += -L"(TOPDIR)/lib"
LIBPATHS += -L"$(BOARDDIR)"
endif
LDLIBS = $(patsubst lib%,-l%,$(basename $(notdir $(LINKLIBS))))

LDLIBS = $(patsubst %.a,%,$(patsubst lib%,-l%,$(LINKLIBS)))

BOARDDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src/board

Expand Down
71 changes: 36 additions & 35 deletions arch/avr/src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,61 +37,62 @@
-include $(TOPDIR)/Make.defs
-include chip/Make.defs

ARCH_SRCDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src
ARCH_SRCDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src
ifeq ($(CONFIG_ARCH_AVR32),y)
ARCH_SUBDIR = avr32
ARCH_SUBDIR = avr32
else ifeq ($(CONFIG_ARCH_AVR),y)
ARCH_SUBDIR = avr
ARCH_SUBDIR = avr
endif

ifeq ($(WINTOOL),y)
NUTTX = "${shell cygpath -w $(TOPDIR)/nuttx}"
INCLUDES += -I "${shell cygpath -w $(ARCH_SRCDIR)/chip}"
INCLUDES += -I "${shell cygpath -w $(ARCH_SRCDIR)/common}"
INCLUDES += -I "${shell cygpath -w $(ARCH_SRCDIR)/$(ARCH_SUBDIR)}"
INCLUDES += -I "${shell cygpath -w $(TOPDIR)/sched}"
NUTTX = "${shell cygpath -w $(TOPDIR)/nuttx}"
INCLUDES += -I "${shell cygpath -w $(ARCH_SRCDIR)/chip}"
INCLUDES += -I "${shell cygpath -w $(ARCH_SRCDIR)/common}"
INCLUDES += -I "${shell cygpath -w $(ARCH_SRCDIR)/$(ARCH_SUBDIR)}"
INCLUDES += -I "${shell cygpath -w $(TOPDIR)/sched}"
else
NUTTX = "$(TOPDIR)/nuttx"
INCLUDES += -I "$(ARCH_SRCDIR)/chip"
INCLUDES += -I "$(ARCH_SRCDIR)/common"
INCLUDES += -I "$(ARCH_SRCDIR)/$(ARCH_SUBDIR)"
INCLUDES += -I "$(TOPDIR)/sched"
NUTTX = "$(TOPDIR)/nuttx"
INCLUDES += -I "$(ARCH_SRCDIR)/chip"
INCLUDES += -I "$(ARCH_SRCDIR)/common"
INCLUDES += -I "$(ARCH_SRCDIR)/$(ARCH_SUBDIR)"
INCLUDES += -I "$(TOPDIR)/sched"
endif

CPPFLAGS += $(INCLUDES)
CFLAGS += $(INCLUDES)
CXXFLAGS += $(INCLUDES)
AFLAGS += $(INCLUDES)
CPPFLAGS += $(INCLUDES)
CFLAGS += $(INCLUDES)
CXXFLAGS += $(INCLUDES)
AFLAGS += $(INCLUDES)

HEAD_OBJ = $(HEAD_ASRC:.S=$(OBJEXT))
HEAD_OBJ = $(HEAD_ASRC:.S=$(OBJEXT))

ASRCS = $(CHIP_ASRCS) $(CMN_ASRCS)
AOBJS = $(ASRCS:.S=$(OBJEXT))
ASRCS = $(CHIP_ASRCS) $(CMN_ASRCS)
AOBJS = $(ASRCS:.S=$(OBJEXT))

CSRCS = $(CHIP_CSRCS) $(CMN_CSRCS)
COBJS = $(CSRCS:.c=$(OBJEXT))
CSRCS = $(CHIP_CSRCS) $(CMN_CSRCS)
COBJS = $(CSRCS:.c=$(OBJEXT))

SRCS = $(ASRCS) $(CSRCS)
OBJS = $(AOBJS) $(COBJS)
SRCS = $(ASRCS) $(CSRCS)
OBJS = $(AOBJS) $(COBJS)

LDFLAGS += $(ARCHSCRIPT)
EXTRA_LIBS ?=
LDFLAGS += $(ARCHSCRIPT)
EXTRA_LIBS ?=
LINKLIBS ?=

LINKLIBS =
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 $(BOARDDIR)}"
LIBPATHS += -L"${shell cygpath -w "$(TOPDIR)/lib"}"
LIBPATHS += -L"${shell cygpath -w $(BOARDDIR)}"
else
LIBPATHS = $(addprefix -L$(TOPDIR)/,$(dir $(LINKLIBS)))
LIBPATHS += -L"$(BOARDDIR)"
LIBPATHS += -L"(TOPDIR)/lib"
LIBPATHS += -L"$(BOARDDIR)"
endif
LDLIBS = $(patsubst lib%,-l%,$(basename $(notdir $(LINKLIBS))))

BOARDDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src/board
LDLIBS = $(patsubst %.a,%,$(patsubst lib%,-l%,$(LINKLIBS)))

LIBGCC = "${shell $(CC) $(ARCHCPUFLAGS) -print-libgcc-file-name}"
BOARDDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src/board

VPATH = chip:common:$(ARCH_SUBDIR)
LIBGCC = "${shell $(CC) $(ARCHCPUFLAGS) -print-libgcc-file-name}"

VPATH = chip:common:$(ARCH_SUBDIR)

all: $(HEAD_OBJ) libarch$(LIBEXT)

Expand Down
55 changes: 28 additions & 27 deletions arch/hc/src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,55 +36,56 @@
-include $(TOPDIR)/Make.defs
-include chip/Make.defs

ARCH_SRCDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src
ARCH_SRCDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src
ifeq ($(CONFIG_ARCH_HC12),y)
ARCH_SUBDIR = hc12
ARCH_SUBDIR = hc12
endif
ifeq ($(CONFIG_ARCH_HCS12),y)
ARCH_SUBDIR = hcs12
ARCH_SUBDIR = hcs12
endif

ifeq ($(WINTOOL),y)
NUTTX = "${shell cygpath -w $(TOPDIR)/nuttx}"
CFLAGS += -I "${shell cygpath -w $(ARCH_SRCDIR)/chip}" \
-I "${shell cygpath -w $(ARCH_SRCDIR)/common}" \
NUTTX = "${shell cygpath -w $(TOPDIR)/nuttx}"
CFLAGS += -I "${shell cygpath -w $(ARCH_SRCDIR)/chip}" \
-I "${shell cygpath -w $(ARCH_SRCDIR)/common}" \
-I "${shell cygpath -w $(ARCH_SRCDIR)/$(ARCH_SUBDIR)}" \
-I "${shell cygpath -w $(TOPDIR)/sched}"
else
NUTTX = $(TOPDIR)/nuttx
CFLAGS += -I$(ARCH_SRCDIR)/chip -I$(ARCH_SRCDIR)/common \
-I$(ARCH_SRCDIR)/$(ARCH_SUBDIR) -I$(TOPDIR)/sched
NUTTX = $(TOPDIR)/nuttx
CFLAGS += -I$(ARCH_SRCDIR)/chip -I$(ARCH_SRCDIR)/common \
-I$(ARCH_SRCDIR)/$(ARCH_SUBDIR) -I$(TOPDIR)/sched
endif

HEAD_OBJ = $(HEAD_ASRC:.S=$(OBJEXT))
HEAD_OBJ = $(HEAD_ASRC:.S=$(OBJEXT))

ASRCS = $(CHIP_ASRCS) $(CMN_ASRCS)
AOBJS = $(ASRCS:.S=$(OBJEXT))
ASRCS = $(CHIP_ASRCS) $(CMN_ASRCS)
AOBJS = $(ASRCS:.S=$(OBJEXT))

CSRCS = $(CHIP_CSRCS) $(CMN_CSRCS)
COBJS = $(CSRCS:.c=$(OBJEXT))
CSRCS = $(CHIP_CSRCS) $(CMN_CSRCS)
COBJS = $(CSRCS:.c=$(OBJEXT))

SRCS = $(ASRCS) $(CSRCS)
OBJS = $(AOBJS) $(COBJS)
SRCS = $(ASRCS) $(CSRCS)
OBJS = $(AOBJS) $(COBJS)

LDFLAGS += $(ARCHSCRIPT)
EXTRA_LIBS ?=
LDFLAGS += $(ARCHSCRIPT)
EXTRA_LIBS ?=
LINKLIBS ?=

LINKLIBS =
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 $(BOARDDIR)}"
LIBPATHS += -L"${shell cygpath -w "$(TOPDIR)/lib"}"
LIBPATHS += -L"${shell cygpath -w $(BOARDDIR)}"
else
LIBPATHS = $(addprefix -L$(TOPDIR)/,$(dir $(LINKLIBS)))
LIBPATHS += -L"$(BOARDDIR)"
LIBPATHS += -L"(TOPDIR)/lib"
LIBPATHS += -L"$(BOARDDIR)"
endif
LDLIBS = $(patsubst lib%,-l%,$(basename $(notdir $(LINKLIBS))))

BOARDDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src/board
LDLIBS = $(patsubst %.a,%,$(patsubst lib%,-l%,$(LINKLIBS)))

LIBGCC = "${shell $(CC) $(ARCHCPUFLAGS) -print-libgcc-file-name}"
BOARDDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src/board

VPATH = chip:common:$(ARCH_SUBDIR)
LIBGCC = "${shell $(CC) $(ARCHCPUFLAGS) -print-libgcc-file-name}"

VPATH = chip:common:$(ARCH_SUBDIR)

all: $(HEAD_OBJ) libarch$(LIBEXT)
.PHONY: board/libboard$(LIBEXT)
Expand Down
Loading

0 comments on commit 6de9634

Please sign in to comment.