You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ag...@apache.org on 2020/02/24 21:37:39 UTC

[incubator-nuttx] 01/03: Build system: Get rid of the MOVEOBJ definition

This is an automated email from the ASF dual-hosted git repository.

aguettouche pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit d1a8a803e4f52bc0348a8915eb0043dca08fd885
Author: Gregory Nutt <gn...@nuttx.org>
AuthorDate: Mon Feb 24 12:06:11 2020 -0600

    Build system:  Get rid of the MOVEOBJ definition
    
    Eliminate the MOVEOBJ definition from tools/Config.mk, Makefiles, and other locations.  The MOVEOBJ definition was used to work around the case where the object output of a compile or assemble is in a different directory than the source file.  The ZDS-II tools have no command line option to perform this move; MOVEOBJ handled the move as a post-compiler operation.
    
    MOVEOBJ is no longer needed because this the ez80 COMPILE and ASSEMBLE definitions now handle all of the object file movement cases.
---
 boards/z16/z16f/z16f2800100zcog/scripts/Make.defs     | 10 ----------
 boards/z80/ez80/scripts/eZ80_Config.mk                | 15 +++++----------
 boards/z80/z8/z8encore000zco/configs/ostest/Make.defs | 12 ------------
 boards/z80/z8/z8f64200100kit/configs/ostest/Make.defs | 12 ------------
 libs/libc/Makefile                                    |  2 --
 libs/libnx/Makefile                                   |  2 --
 mm/Makefile                                           |  2 --
 tools/Config.mk                                       | 11 -----------
 8 files changed, 5 insertions(+), 61 deletions(-)

diff --git a/boards/z16/z16f/z16f2800100zcog/scripts/Make.defs b/boards/z16/z16f/z16f2800100zcog/scripts/Make.defs
index 95fcef0..456f417 100644
--- a/boards/z16/z16f/z16f2800100zcog/scripts/Make.defs
+++ b/boards/z16/z16f/z16f2800100zcog/scripts/Make.defs
@@ -188,11 +188,6 @@ define ASSEMBLE
 	$(Q) "$(AS)" $(AFLAGS) $($(strip $1)_AFLAGS) ${shell echo $1 | sed -e "s/\//\\/g"}
 endef
 
-define MOVEOBJ
-	$(call MOVEFILE, "$1.obj", "$2$(DELIM)$1.obj")
-	$(call MOVEFILE, "$1.lst", "$2$(DELIM)$1.lst")
-endef
-
 define ARCHIVE
 	for %%G in ($(2)) do ( "$(AR)" $(ARFLAGS) $1=-+%%G )
 endef
@@ -221,11 +216,6 @@ define ASSEMBLE
 	$(Q) "$(AS)" $(AFLAGS) $($(strip $1)_AFLAGS) `cygpath -w "$1"`
 endef
 
-define MOVEOBJ
-	$(call MOVEFILE, "$1.obj", "$2$(DELIM)$1.obj")
-	$(call MOVEFILE, "$1.lst", "$2$(DELIM)$1.lst")
-endef
-
 define ARCHIVE
 	for __obj in $(2) ; do \
 		"$(AR)" $(ARFLAGS) $1=-+$$__obj \
diff --git a/boards/z80/ez80/scripts/eZ80_Config.mk b/boards/z80/ez80/scripts/eZ80_Config.mk
index b2e9d14..7a4f98a 100644
--- a/boards/z80/ez80/scripts/eZ80_Config.mk
+++ b/boards/z80/ez80/scripts/eZ80_Config.mk
@@ -31,7 +31,7 @@ define PREPROCESS
 	$(Q) $(CPP) $(CPPFLAGS) $($(strip $(1))_CPPFLAGS) $(1) -o $(2)
 endef
 
-# COMPILE, ASSEMBLE, MOVEOBJ
+# COMPILE, ASSEMBLE, and helpers
 #
 # The ZDS-II compiler and assembler both generate object files in the
 # current directory with the same name as the source file, but with the .obj
@@ -40,12 +40,10 @@ endef
 #
 # 1. If the foo.obj object belongs in a lower level directory (such as bin/),
 #    then the relative path will be preface the object file name (such as
-#    bin/foo.obj)).  In this case, the build system will call MOVEOBJ to
-#    move the objects in place and nothing special need be done here.
+#    bin/foo.obj)).
 # 2. In other cases, the build system may decorate the object file name such
 #    as a.b.c.foo.obj.  This case is distinguished here by because does not
-#    lie in a lower directory, but lies in the current directory and is
-#    handled within COMPILE and ASSEMBLE.
+#    lie in a lower directory, but lies in the current directory.
 
 define RMOBJS
 	$(call DELFILE, $(1))
@@ -56,7 +54,7 @@ endef
 ifeq ($(CONFIG_WINDOWS_NATIVE),y)
 
 define CONDMOVE
-	$(Q) if not exist $1 (move /Y $2 $3)
+	$(Q) if not exist $1 if exist $2 (move /Y $2 $3)
 endef
 
 define MVOBJS
@@ -80,7 +78,7 @@ endef
 else
 
 define CONDMOVE
-	$(Q) if [ ! -e $(1) ]; then mv -f $(2) $(3) ; fi
+	$(Q) if [ ! -e $(1) && -e $(2) ]; then mv -f $(2) $(3) ; fi
 endef
 
 define MVOBJS
@@ -103,9 +101,6 @@ endef
 
 endif
 
-define MOVEOBJ
-endef
-
 # ARCHIVE will move a list of object files into the library.  This is
 # complex because:
 #
diff --git a/boards/z80/z8/z8encore000zco/configs/ostest/Make.defs b/boards/z80/z8/z8encore000zco/configs/ostest/Make.defs
index 09a4d45..92c7a6c 100644
--- a/boards/z80/z8/z8encore000zco/configs/ostest/Make.defs
+++ b/boards/z80/z8/z8encore000zco/configs/ostest/Make.defs
@@ -216,12 +216,6 @@ define ASSEMBLE
 	$(Q) "$(AS)" $(AFLAGS) $($(strip $1)_AFLAGS) ${shell echo $1 | sed -e "s/\//\\/g"}
 endef
 
-define MOVEOBJ
-	$(call MOVEFILE, "$1.obj", "$2$(DELIM)$1.obj")
-	$(call MOVEFILE, "$1.lst", "$2$(DELIM)$1.lst")
-	$(call MOVEFILE, "$1.src", "$2$(DELIM)$1.src")
-endef
-
 define ARCHIVE
 	for %%G in ($(2)) do ( "$(AR)" $(ARFLAGS) $1=-+%%G )
 endef
@@ -250,12 +244,6 @@ define ASSEMBLE
 	$(Q) (wfile=`cygpath -w "$1"`; "$(AS)" $(AFLAGS) $($(strip $1)_AFLAGS) $$wfile)
 endef
 
-define MOVEOBJ
-	$(call MOVEFILE, "$1.obj", "$2$(DELIM)$1.obj")
-	$(call MOVEFILE, "$1.lst", "$2$(DELIM)$1.lst")
-	$(call MOVEFILE, "$1.src", "$2$(DELIM)$1.src")
-endef
-
 define ARCHIVE
 	for __obj in $(2) ; do \
 		"$(AR)" $(ARFLAGS) $1=-+$$__obj \
diff --git a/boards/z80/z8/z8f64200100kit/configs/ostest/Make.defs b/boards/z80/z8/z8f64200100kit/configs/ostest/Make.defs
index 3fae1b8..ed9ba2a 100644
--- a/boards/z80/z8/z8f64200100kit/configs/ostest/Make.defs
+++ b/boards/z80/z8/z8f64200100kit/configs/ostest/Make.defs
@@ -216,18 +216,6 @@ define ASSEMBLE
 	$(Q) "$(AS)" $(AFLAGS) $($(strip $1)_AFLAGS) ${shell echo $1 | sed -e "s/\//\\/g"}
 endef
 
-define MOVEOBJ
-	$(call MOVEFILE, "$1.obj", "$2$(DELIM)$1.obj")
-	$(call MOVEFILE, "$1.lst", "$2$(DELIM)$1.lst")
-	$(call MOVEFILE, "$1.src", "$2$(DELIM)$1.src")
-endef
-
-define MOVEOBJ
-	$(call MOVEFILE, "$1.obj", "$2$(DELIM)$1.obj")
-	$(call MOVEFILE, "$1.lst", "$2$(DELIM)$1.lst")
-	$(call MOVEFILE, "$1.src", "$2$(DELIM)$1.src")
-endef
-
 define ARCHIVE
 	for %%G in ($(2)) do ( "$(AR)" $(ARFLAGS) $1=-+%%G )
 endef
diff --git a/libs/libc/Makefile b/libs/libc/Makefile
index de648dc..0bfce42 100644
--- a/libs/libc/Makefile
+++ b/libs/libc/Makefile
@@ -152,11 +152,9 @@ all: $(BIN)
 
 $(AOBJS): $(BINDIR)$(DELIM)%$(OBJEXT): %.S
 	$(call ASSEMBLE, $<, $@)
-	$(call MOVEOBJ,$(patsubst $(BINDIR)$(DELIM)%$(OBJEXT),%,$@),$(BINDIR))
 
 $(COBJS): $(BINDIR)$(DELIM)%$(OBJEXT): %.c
 	$(call COMPILE, $<, $@)
-	$(call MOVEOBJ,$(patsubst $(BINDIR)$(DELIM)%$(OBJEXT),%,$@),$(BINDIR))
 
 # C library for the flat build
 
diff --git a/libs/libnx/Makefile b/libs/libnx/Makefile
index cdf9b4f..92b2bb4 100644
--- a/libs/libnx/Makefile
+++ b/libs/libnx/Makefile
@@ -229,11 +229,9 @@ gensources: gen1bppsources gen2bppsource gen4bppsource gen8bppsource gen16bppsou
 
 $(AOBJS): $(BINDIR)$(DELIM)%$(OBJEXT): %.S
 	$(call ASSEMBLE, $<, $@)
-	$(call MOVEOBJ,$(patsubst $(BINDIR)$(DELIM)%$(OBJEXT),%,$@),$(BINDIR))
 
 $(COBJS): $(BINDIR)$(DELIM)%$(OBJEXT): %.c
 	$(call COMPILE, $<, $@)
-	$(call MOVEOBJ,$(patsubst $(BINDIR)$(DELIM)%$(OBJEXT),%,$@),$(BINDIR))
 
 # NX library for the flat build
 
diff --git a/mm/Makefile b/mm/Makefile
index 7f1dbcf..f200830 100644
--- a/mm/Makefile
+++ b/mm/Makefile
@@ -76,11 +76,9 @@ all: $(BIN)
 
 $(AOBJS): $(BINDIR)$(DELIM)%$(OBJEXT): %.S
 	$(call ASSEMBLE, $<, $@)
-	$(call MOVEOBJ,$(patsubst $(BINDIR)$(DELIM)%$(OBJEXT),%,$@),$(BINDIR))
 
 $(COBJS): $(BINDIR)$(DELIM)%$(OBJEXT): %.c
 	$(call COMPILE, $<, $@)
-	$(call MOVEOBJ,$(patsubst $(BINDIR)$(DELIM)%$(OBJEXT),%,$@),$(BINDIR))
 
 # Memory manager for the flat build
 
diff --git a/tools/Config.mk b/tools/Config.mk
index bb647cd..43870aa 100644
--- a/tools/Config.mk
+++ b/tools/Config.mk
@@ -186,17 +186,6 @@ define INSTALL_LIB
 	$(Q) install -m 0644 $1 $2
 endef
 
-# MOVEOBJ - Default macro to move an object file to the correct location
-# Example: $(call MOVEOBJ, prefix, directory)
-#
-# This is only used in directories that keep object files in sub-directories.
-# Certain compilers (ZDS-II) always place the resulting files in the
-# directory where the compiler was invoked with no option to generate objects
-# in a different location.
-
-define MOVEOBJ
-endef
-
 # ARCHIVE - Add a list of files to an archive
 # Example: $(call ARCHIVE, archive-file, "file1 file2 file3 ...")
 #