From dfdc9977604bf7d5351741dd066b2479e36d0e74 Mon Sep 17 00:00:00 2001 From: patacongo Date: Thu, 10 Jan 2008 18:16:20 +0000 Subject: [PATCH] First cut at ZDS-II link command git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@544 42af7a65-404d-4744-a932-0658087f49c3 --- arch/z16/src/Makefile | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/arch/z16/src/Makefile b/arch/z16/src/Makefile index cd06924471..35aec46646 100644 --- a/arch/z16/src/Makefile +++ b/arch/z16/src/Makefile @@ -41,6 +41,8 @@ WARCHSRCDIR = ${shell cygpath -w $(ARCHSRCDIR)} USRINCLUDES = -usrinc:'.;$(WTOPDIR)\sched;$(WARCHSRCDIR)\chip;$(WARCHSRCDIR)\common' INCLUDES = $(ARCHSTDINCLUDES) $(USRINCLUDES) CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(INCLUDES) $(ARCHDEFINES) +WLINKLIBS = +LDFLAGS = @${shell cypath -w $(ARCHSRCDIR)/nuttx.linkcmd} HEAD_AOBJ = $(HEAD_ASRC:.S=$(OBJEXT)) @@ -53,17 +55,8 @@ COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) OBJS = $(AOBJS) $(COBJS) -LDFLAGS = $(ARCHSCRIPT) -EXTRA_LIBS = - -LINKLIBS = -LDPATHES = $(addprefix -L$(TOPDIR)/,$(dir $(LINKLIBS))) -LDLIBS = $(patsubst lib%,-l%,$(basename $(notdir $(LINKLIBS)))) - BOARDDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src/board -LIBGCC = ${shell $(CC) -print-libgcc-file-name} - VPATH = chip:common all: $(HEAD_OBJ) libarch$(LIBEXT) @@ -80,11 +73,23 @@ libarch$(LIBEXT): $(OBJS) done ; ) board/libboard$(LIBEXT): - $(MAKE) -C board TOPDIR="$(TOPDIR)" libboard$(LIBEXT) + @$(MAKE) -C board TOPDIR="$(TOPDIR)" libboard$(LIBEXT) -nuttx$(EXEEXT): $(HEAD_AOBJ) board/libboard$(LIBEXT) - $(LD) --entry=__start $(LDFLAGS) $(LDPATHES) -L$(BOARDDIR) -o $(TOPDIR)/$@ $(HEAD_AOBJ) \ - --start-group $(LDLIBS) -lboard --end-group $(EXTRA_LIBS) $(LIBGCC) +wlinklibs: + $(foreach LIB, $(LINKLIBS), $(eval WLINKLIBS += ${shell cygpath -w $(LIB)})) + +nuttx.linkcmd: $(LINKCMDTEMPLATE) wlinklibs + @cp -f $(LINKCMDTEMPLATE) nuttx.linkcmd + @echo "\"${shell cygpath -w $(TOPDIR)/nuttx}\"= \\" >>nuttx.linkcmd + @echo " ${shell cygpath -w $(ARCHSRCDIR)/$(HEAD_AOBJ)}, \\" >>nuttx.linkcmd + @( for lib in $(WLINKLIBS); do \ + echo " $${lib}, \\" >>nuttx.linkcmd; \ + done ; ) + @echo " ${shell cygpath -w $(ARCHSRCDIR)/board/libboard$(LIBEXT)}" >>nuttx.linkcmd + +nuttx$(EXEEXT): $(HEAD_AOBJ) board/libboard$(LIBEXT) nuttx.linkcmd + @echo "LD: nuttx.hex" + @$(LD) $(LDFLAGS) .depend: Makefile chip/Make.defs $(SRCS) @if [ -e board/Makefile ]; then \ @@ -99,7 +104,7 @@ clean: @if [ -e board/Makefile ]; then \ $(MAKE) -C board TOPDIR="$(TOPDIR)" clean ; \ fi - @rm -f libarch$(LIBEXT) *~ .*.swp + @rm -f libarch$(LIBEXT) nuttx.linkcmd *~ .*.swp $(call CLEAN) distclean: clean