Copy more logic from nuttx/tools/Config.mk into the Make.defs file. Plus trivial related changes

This commit is contained in:
Gregory Nutt 2014-09-05 11:26:27 -06:00
parent c38a108343
commit 1193499a4b

View File

@ -51,30 +51,99 @@ export Q := @
endif endif
endif endif
# Environment-specific settings # Some defaults just to prohibit some bad behavior if for some reason they
# are not defined
OBJEXT ?= .o
LIBEXT ?= .a
# Common default defintions
# #
# DELIM - Environment-specific file path separator # PREPROCESS - Default macro to run the C pre-processor
# DELFILE - Delete one file # COMPILE - Default macro to compile one C file
# DELDIR - Delete one directory # COMPILEXX - Default macro to compile one C++ file
# ASSEMBLE - Default macro to assemble one assembly language file
define PREPROCESS
@echo "CPP: $1->$2"
$(Q) $(CPP) $(CPPFLAGS) $1 -o $2
endef
define COMPILE
@echo "CC: $1"
$(Q) $(CC) -c $(CFLAGS) $1 -o $2
endef
define COMPILEXX
@echo "CXX: $1"
$(Q) $(CXX) -c $(CXXFLAGS) $1 -o $2
endef
define ASSEMBLE
@echo "AS: $1"
$(Q) $(CC) -c $(AFLAGS) $1 -o $2
endef
# Environment-specific definitions
#
# DELIM - Environment-specific file path separator
# ARCHIVE - Add a list of files to an archive
# DELFILE - Delete one file
# DELDIR - Delete one directory
# MOVEFILE - Move one file
# CLEAN - Default clean target
ifeq ($(CONFIG_WINDOWS_NATIVE),y) ifeq ($(CONFIG_WINDOWS_NATIVE),y)
DELIM = $(strip \) DELIM = $(strip \)
define ARCHIVE
@echo AR: $2
$(Q) $(AR) $1 $(2)
endef
define DELFILE define DELFILE
$(Q) if exist $1 (del /f /q $1) $(Q) if exist $1 (del /f /q $1)
endef endef
define DELDIR define DELDIR
$(Q) if exist $(1) (rmdir /q /s $(1)) $(Q) if exist $(1) (rmdir /q /s $(1))
endef endef
define MOVEFILE
$(Q) if exist $1 (move /Y $1 $2)
endef
define CLEAN
$(Q) if exist *$(OBJEXT) (del /f /q *$(OBJEXT))
$(Q) if exist *$(LIBEXT) (del /f /q *$(LIBEXT))
$(Q) if exist *~ (del /f /q *~)
$(Q) if exist (del /f /q .*.swp)
endef
else else
DELIM = $(strip /) DELIM = $(strip /)
define ARCHIVE
@echo "AR: $2"
$(Q) $(AR) $1 $(2) || { echo "$(AR) $1 FAILED!" ; exit 1 ; }
endef
define DELFILE define DELFILE
$(Q) rm -f $1 $(Q) rm -f $1
endef endef
define DELDIR define DELDIR
$(Q) rm -rf $(1) $(Q) rm -rf $(1)
endef endef
define MOVEFILE
$(Q) mv -f $1 $2
endef
define CLEAN
$(Q) rm -f *$(OBJEXT) *$(LIBEXT) *~ .*.swp
endef
endif endif