Make logic reorganized for non-GNU toolchain

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@528 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo 2008-01-08 17:06:21 +00:00
parent bdbe9e93b7
commit d1169000ca
17 changed files with 196 additions and 75 deletions

View File

@ -81,6 +81,7 @@ Make.defs -- This makefile fragment provides architecture and
Tools: CC, LD, AR, NM, OBJCOPY, OBJDUMP
Tool options: CFLAGS, LDFLAGS
COMPILE, ASSEMBLE, ARCHIVE, and MKDEP macros
When this makefile fragment runs, it will be passed TOPDIR which
is the path to the root directory of the build. This makefile

View File

@ -59,6 +59,7 @@ OBJDUMP = $(CROSSDEV)objdump
CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
$(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) -pipe
AFLAGS = $(CFLAGS) -D__ASSEMBLY__
OBJEXT = .o
LIBEXT = .a
@ -68,11 +69,26 @@ ifeq ("${CONFIG_DEBUG}","y")
LDFLAGS += -g
endif
define COMPILE
@echo "CC: $1"
@$(CC) -c $(CFLAGS) $1 -o $2
endef
define ASSEMBLE
@echo "AS: $1"
@$(CC) -c $(AFLAGS) $1 -o $2
endef
define ARCHIVE
echo "AR: $2"; \
$(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
endef
MKDEP = $(TOPDIR)/tools/mkdeps.sh
HOSTCC = gcc
HOSTINCLUDES = -I.
HOSTCFLAGS = -Wall -wstrict-prototypes -Wshadow -g -pipe
HOSTLDFLAGS =
MKDEP = $(TOPDIR)/tools/mkdeps.sh

View File

@ -51,15 +51,14 @@ CFLAGS += -I$(ARCH_SRCDIR)/chip -I$(ARCH_SRCDIR)/common
all: libboard$(LIBEXT)
$(AOBJS): %$(OBJEXT): %.S
$(CC) -c $(CFLAGS) -D__ASSEMBLY__ $< -o $@
$(call ASSEMBLE, $<, $@)
$(COBJS) $(LINKOBJS): %$(OBJEXT): %.c
$(CC) -c $(CFLAGS) $< -o $@
$(call COMPILE, $<, $@)
libboard$(LIBEXT): $(OBJS)
@( for obj in $(OBJS) ; do \
$(AR) $@ $${obj} || \
{ echo "$(AR) $@ $obj FAILED!" ; exit 1 ; } ; \
$(call ARCHIVE, $@, $${obj}); \
done ; )
.depend: Makefile $(SRCS)

View File

@ -59,6 +59,7 @@ OBJDUMP = $(CROSSDEV)objdump
CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
$(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) -pipe
AFLAGS = $(CFLAGS) -D__ASSEMBLY__
OBJEXT = .o
LIBEXT = .a
@ -68,9 +69,24 @@ ifeq ("${CONFIG_DEBUG}","y")
LDFLAGS += -g
endif
define COMPILE
@echo "CC: $1"
@$(CC) -c $(CFLAGS) $1 -o $2
endef
define ASSEMBLE
@echo "AS: $1"
@$(CC) -c $(AFLAGS) $1 -o $2
endef
define ARCHIVE
echo "AR: $2"; \
$(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
endef
MKDEP = $(TOPDIR)/tools/mkdeps.sh
HOSTCC = gcc
HOSTINCLUDES = -I.
HOSTCFLAGS = -Wall -wstrict-prototypes -Wshadow -g -pipe
HOSTLDFLAGS =
MKDEP = $(TOPDIR)/tools/mkdeps.sh

View File

@ -48,15 +48,14 @@ OBJS = $(AOBJS) $(COBJS)
all: libboard$(LIBEXT)
$(AOBJS): %$(OBJEXT): %.S
$(CC) -c $(CFLAGS) -D__ASSEMBLY__ $< -o $@
$(call ASSEMBLE, $<, $@)
$(COBJS) $(LINKOBJS): %$(OBJEXT): %.c
$(CC) -c $(CFLAGS) $< -o $@
$(call COMPILE, $<, $@)
libboard$(LIBEXT): $(OBJS)
@( for obj in $(OBJS) ; do \
$(AR) $@ $${obj} || \
{ echo "$(AR) $@ $obj FAILED!" ; exit 1 ; } ; \
$(call ARCHIVE, $@, $${obj}); \
done ; )
.depend: Makefile $(SRCS)

View File

@ -59,6 +59,7 @@ OBJDUMP = $(CROSSDEV)objdump
CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
$(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) -pipe
AFLAGS = $(CFLAGS) -D__ASSEMBLY__
OBJEXT = .o
LIBEXT = .a
@ -68,10 +69,25 @@ ifeq ("${CONFIG_DEBUG}","y")
LDFLAGS += -g
endif
define COMPILE
@echo "CC: $1"
@$(CC) -c $(CFLAGS) $1 -o $2
endef
define ASSEMBLE
@echo "AS: $1"
@$(CC) -c $(AFLAGS) $1 -o $2
endef
define ARCHIVE
echo "AR: $2"; \
$(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
endef
MKDEP = $(TOPDIR)/tools/mkdeps.sh
HOSTCC = gcc
HOSTINCLUDES = -I.
HOSTCFLAGS = -Wall -wstrict-prototypes -Wshadow -g -pipe
HOSTLDFLAGS =
MKDEP = $(TOPDIR)/tools/mkdeps.sh

View File

@ -51,15 +51,14 @@ CFLAGS += -I $(TOPDIR)/arch/$(CONFIG_ARCH)/src
all: libboard$(LIBEXT)
$(AOBJS): %$(OBJEXT): %.S
$(CC) -c $(CFLAGS) -D__ASSEMBLY__ $< -o $@
$(call ASSEMBLE, $<, $@)
$(COBJS) $(LINKOBJS): %$(OBJEXT): %.c
$(CC) -c $(CFLAGS) $< -o $@
$(call COMPILE, $<, $@)
libboard$(LIBEXT): $(OBJS)
@( for obj in $(OBJS) ; do \
$(AR) $@ $${obj} || \
{ echo "$(AR) $@ $obj FAILED!" ; exit 1 ; } ; \
$(call ARCHIVE, $@, $${obj}); \
done ; )
.depend: Makefile $(SRCS)

View File

@ -59,6 +59,7 @@ OBJDUMP = $(CROSSDEV)objdump
CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
$(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) -pipe
AFLAGS = $(CFLAGS) -D__ASSEMBLY__
OBJEXT = .o
LIBEXT = .a
@ -68,10 +69,25 @@ ifeq ("${CONFIG_DEBUG}","y")
LDFLAGS += -g
endif
define COMPILE
@echo "CC: $1"
@$(CC) -c $(CFLAGS) $1 -o $2
endef
define ASSEMBLE
@echo "AS: $1"
@$(CC) -c $(AFLAGS) $1 -o $2
endef
define ARCHIVE
echo "AR: $2"; \
$(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
endef
MKDEP = $(TOPDIR)/tools/mkdeps.sh
HOSTCC = gcc
HOSTINCLUDES = -I.
HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
HOSTLDFLAGS =
MKDEP = $(TOPDIR)/tools/mkdeps.sh

View File

@ -51,15 +51,14 @@ CFLAGS += -I$(ARCH_SRCDIR)/chip -I$(ARCH_SRCDIR)/common
all: libboard$(LIBEXT)
$(AOBJS): %$(OBJEXT): %.S
$(CC) -c $(CFLAGS) -D__ASSEMBLY__ $< -o $@
$(call ASSEMBLE, $<, $@)
$(COBJS) $(LINKOBJS): %$(OBJEXT): %.c
$(CC) -c $(CFLAGS) $< -o $@
$(call COMPILE, $<, $@)
libboard$(LIBEXT): $(OBJS)
@( for obj in $(OBJS) ; do \
$(AR) $@ $${obj} || \
{ echo "$(AR) $@ $obj FAILED!" ; exit 1 ; } ; \
$(call ARCHIVE, $@, $${obj}); \
done ; )
.depend: Makefile $(SRCS)

View File

@ -62,11 +62,26 @@ OBJEXT = .rel
LIBEXT = .lib
EXEEXT = .hex
define COMPILE
@echo "CC: $1"
@$(CC) -c $(CFLAGS) $1 -o $2
endef
define ASSEMBLE
@echo "AS: $1"
@$(AS) $(ASFLAGS) $1
endef
define ARCHIVE
echo "AR: $2"; \
$(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
endef
MKDEP = $(TOPDIR)/tools/mkdeps.sh
HOSTCC = gcc
HOSTINCLUDES = -I.
HOSTCFLAGS = -Wall -wstrict-prototypes -Wshadow -g -pipe
HOSTLDFLAGS =
MKDEP = $(TOPDIR)/tools/mkdeps.sh

View File

@ -50,15 +50,14 @@ CFLAGS += -I $(TOPDIR)/arch/$(CONFIG_ARCH)/src
all: libboard$(LIBEXT)
$(AOBJS): %$(OBJEXT): %.S
$(CC) -c $(CFLAGS) -D__ASSEMBLY__ $< -o $@
$(call ASSEMBLE, $<, $@)
$(COBJS) $(LINKOBJS): %$(OBJEXT): %.c
$(CC) -c $(CFLAGS) $< -o $@
$(call COMPILE, $<, $@)
libboard$(LIBEXT): $(OBJS)
@( for obj in $(OBJS) ; do \
$(AR) $@ $${obj} || \
{ echo "$(AR) $@ $obj FAILED!" ; exit 1 ; } ; \
$(call ARCHIVE, $@, $${obj}); \
done ; )
.depend: Makefile $(SRCS)

View File

@ -58,6 +58,7 @@ OBJDUMP = $(CROSSDEV)objdump
CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
$(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) -pipe
AFLAGS = $(CFLAGS) -D__ASSEMBLY__
OBJEXT = .o
LIBEXT = .a
@ -67,10 +68,25 @@ ifeq ("${CONFIG_DEBUG}","y")
LDFLAGS += -g
endif
define COMPILE
@echo "CC: $1"
@$(CC) -c $(CFLAGS) $1 -o $2
endef
define ASSEMBLE
@echo "AS: $1"
@$(CC) -c $(AFLAGS) $1 -o $2
endef
define ARCHIVE
echo "AR: $2"; \
$(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
endef
MKDEP = $(TOPDIR)/tools/mkdeps.sh
HOSTCC = gcc
HOSTINCLUDES = -I.
HOSTCFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
$(ARCHCPUFLAGS) $(HOSTINCLUDES) $(ARCHDEFINES) -pipe
HOSTLDFLAGS =
MKDEP = $(TOPDIR)/tools/mkdeps.sh

View File

@ -48,15 +48,14 @@ OBJS = $(AOBJS) $(COBJS)
all: libboard$(LIBEXT)
$(AOBJS): %$(OBJEXT): %.S
$(CC) -c $(CFLAGS) -D__ASSEMBLY__ $< -o $@
$(call ASSEMBLE, $<, $@)
$(COBJS) $(LINKOBJS): %$(OBJEXT): %.c
$(CC) -c $(CFLAGS) $< -o $@
$(call COMPILE, $<, $@)
libboard$(LIBEXT): $(OBJS)
@( for obj in $(OBJS) ; do \
$(AR) $@ $${obj} || \
{ echo "$(AR) $@ $obj FAILED!" ; exit 1 ; } ; \
$(call ARCHIVE, $@, $${obj}); \
done ; )
.depend: Makefile $(SRCS)

View File

@ -47,12 +47,12 @@ else
endif
ARCHASMCPUFLAGS = -cpu:Z16F2811AL -NOigcase
ARCHASMLIST = -NOlistmac -name -pagelen:56 -pagewidth:80 -quiet
ARCHASMLIST = -NOlistmac -name -pagelen:56 -pagewidth:80 -quiet
ARCHASMWARNINGS = -warn
ARCHASMDEFINES = -define:_Z16F2811AL=1 -define:_Z16K_SERIES=1 -define:_Z16F_SERIES=1
ARCHASMDEFINES = -define:_Z16F2811AL=1 -define:_Z16K_SERIES=1 -define:_Z16F_SERIES=1 \ -define:__ASSEMBLY__
ARCHASMINCLUDES = -include:$(ZDSINCDIR)/std;$(ZDSINCDIR)/zilog
AFLAGS = $(ARCHASMCPUFLAGS) $(ARCHASMINCLUDES) $(ARCHASMLIST) \
$(ARCHASMWARNINGS) $(ARCHASMOPTIMIZATION)
AFLAGS = $(ARCHASMCPUFLAGS) $(ARCHASMINCLUDES) $(ARCHASMLIST) \
$(ARCHASMWARN) $(ARCHASMOPTIMIZATION)
ifeq ("${CONFIG_DEBUG}","y")
ARCHOPTIMIZATION = -debug -NOregvar -reduceopt
@ -61,32 +61,49 @@ else
endif
ARCHCPUFLAGS = -chartype:S -model:L -NOmodsect -cpu:Z16F2811AL \
-asmsw:" $(ARCHASMCPUFLAGS) $(ARCHASMINCLUDES) $(ARCHASMWARNINGS) $(ARCHASMOPTIMIZATION)"
ARCHLIST = -NOgenprint -keeplst -NOlist -NOlistinc -NOkeepasm
-asmsw:" $(ARCHASMCPUFLAGS) $(ARCHASMINCLUDES) (ARCHASMWARN) $(ARCHASMOPTIMIZATION)"
ARCHLIST = -NOgenprint -keeplst -NOlist -NOlistinc -NOkeepasm
ARCHPICFLAGS =
ARCHWARNINGS = -warn
ARCHDEFINES = -define:_Z16F2811AL -define:_Z16K_SERIES \
-define:_Z16F_SERIES
ARCHINCLUDES = -stdinc:"$(ZDSINCDIR)/std;$(ZDSINCDIR)/zilog" \
-usrinc:".;$(TOPDIR)/include"
CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
$(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES)
ARCHDEFINES = -define:_Z16F2811AL -define:_Z16K_SERIES \
-define:_Z16F_SERIES -define:
ARCHSTDINCLUDES = -stdinc:"$(TOPDIR)/include;$(ZDSINCDIR)/std;$(ZDSINCDIR)/zilog"
ARCHUSRINCLUDES = -userinc:"."
ARCHINCLUDES = $(ARCHSTDINCLUDES) $(ARCHUSRINCLUDES)
CCFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
$(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES)
ARFLAGS = -quiet -warn
CROSSDEV =
CC = $(ZDSBINDIR)/zneocc.exe
CPP = $(ZDSBINDIR)/zneoasm.exe
LD = $(ZDSBINDIR)/zneolink.exe
AS = $(ZDSBINDIR)/zneoasm.exe
AR = $(ZDSBINDIR)/czneolib.exe
CROSSDEV =
CC = $(ZDSBINDIR)/zneocc.exe
CPP = $(ZDSBINDIR)/zneoasm.exe
LD = $(ZDSBINDIR)/zneolink.exe
AS = $(ZDSBINDIR)/zneoasm.exe
AR = $(ZDSBINDIR)/zneolib.exe
ASMEXT = .asm
OBJEXT = .obj
LIBEXT = .lib
EXEEXT = .hex
ASMEXT = .asm
OBJEXT = .obj
LIBEXT = .lib
EXEEXT = .hex
HOSTCC = gcc
HOSTINCLUDES = -I.
HOSTCFLAGS = -Wall -wstrict-prototypes -Wshadow -g -pipe
HOSTLDFLAGS =
define COMPILE
@echo "CC: $1"
@$(CC) $(CFLAGS) $1
endef
define ASSEMBLE
@echo "AS: $1"
@$(AS) -c $(AFLAGS) $1
endef
define ARCHIVE
echo "AR: $2"; \
$(AR) $(ARFLAGS) $1=-+$2 || { echo "$(AR) $1=-+$2 FAILED!" ; exit 1 ; }
endef
MKDEP = $(TOPDIR)/tools/mknulldeps.sh
HOSTCC = gcc
HOSTINCLUDES = -I.
HOSTCFLAGS = -Wall -wstrict-prototypes -Wshadow -g -pipe
HOSTLDFLAGS =

View File

@ -35,7 +35,10 @@
-include $(TOPDIR)/Make.defs
CFLAGS += -I$(TOPDIR)/sched
ARCH_SRCDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src
USRINCLUDES = -userinc:".;$(TOPDIR)/sched;$(ARCH_SRCDIR)/chip;$(ARCH_SRCDIR)/common"
INCLUDES = $(ARCHSTDINCLUDES) $(USRINCLUDES)
CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(INCLUDES) $(ARCHDEFINES)
ASRCS =
AOBJS = $(ASRCS:.S=$(OBJEXT))
@ -45,21 +48,18 @@ COBJS = $(CSRCS:.c=$(OBJEXT))
SRCS = $(ASRCS) $(CSRCS)
OBJS = $(AOBJS) $(COBJS)
ARCH_SRCDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src
CFLAGS += -I$(ARCH_SRCDIR)/chip -I$(ARCH_SRCDIR)/common
all: libboard$(LIBEXT)
$(AOBJS): %$(OBJEXT): %.S
$(CC) -c $(CFLAGS) -D__ASSEMBLY__ $< -o $@
$(call ASSEMBLE, $<, $@)
$(COBJS) $(LINKOBJS): %$(OBJEXT): %.c
$(CC) -c $(CFLAGS) $< -o $@
$(call COMPILE, $<, $@)
libboard$(LIBEXT): $(OBJS)
@( for obj in $(OBJS) ; do \
$(AR) $@ $${obj} || \
{ echo "$(AR) $@ $obj FAILED!" ; exit 1 ; } ; \
$(call ARCHIVE, $@, $${obj}); \
done ; )
.depend: Makefile $(SRCS)

View File

@ -67,9 +67,24 @@ OBJEXT = .o
LIBEXT = .lib
EXEEXT = .hex
define COMPILE
@echo "CC: $1"
@$(CC) -c $(CFLAGS) $1 -o $2
endef
define ASSEMBLE
@echo "AS: $1"
@$(AS) $(ASFLAGS) $2 $1
endef
define ARCHIVE
echo "AR: $2"; \
$(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
endef
MKDEP = $(TOPDIR)/tools/mkdeps.sh
HOSTCC = gcc
HOSTINCLUDES = -I.
HOSTCFLAGS = -Wall -wstrict-prototypes -Wshadow -g -pipe
HOSTLDFLAGS =
MKDEP = $(TOPDIR)/tools/mkdeps.sh

View File

@ -50,15 +50,14 @@ CFLAGS += -I $(TOPDIR)/arch/$(CONFIG_ARCH)/src
all: libboard$(LIBEXT)
$(AOBJS): %$(OBJEXT): %$(ASMEXT)
$(CC) -c $(CFLAGS) -D__ASSEMBLY__ $< -o $@
$(call ASSEMBLE, $<, $@)
$(COBJS) $(LINKOBJS): %$(OBJEXT): %.c
$(CC) -c $(CFLAGS) $< -o $@
$(call COMPILE, $<, $@)
libboard$(LIBEXT): $(OBJS)
@( for obj in $(OBJS) ; do \
$(AR) $@ $${obj} || \
{ echo "$(AR) $@ $obj FAILED!" ; exit 1 ; } ; \
$(call ARCHIVE, $@, $${obj}); \
done ; )
.depend: Makefile $(SRCS)