2014-10-04 07:12:33 +00:00
|
|
|
#
|
|
|
|
# This file is subject to the terms of the GFX License. If a copy of
|
|
|
|
# the license was not distributed with this file, you can obtain one at:
|
|
|
|
#
|
2018-10-01 15:32:39 +00:00
|
|
|
# http://ugfx.io/license.html
|
2014-10-04 07:12:33 +00:00
|
|
|
#
|
|
|
|
|
|
|
|
#
|
2014-09-27 15:42:30 +00:00
|
|
|
# See readme.txt for the make API
|
2014-10-04 07:12:33 +00:00
|
|
|
#
|
2014-09-27 15:42:30 +00:00
|
|
|
|
2014-11-23 03:08:54 +00:00
|
|
|
# Copy this pseudo variable so we can path expand it
|
|
|
|
MLIST := $(MAKEFILE_LIST)
|
|
|
|
|
2014-10-06 05:50:19 +00:00
|
|
|
# Win32 Nasty - must convert all paths into a format make can handle
|
2014-10-02 09:52:28 +00:00
|
|
|
ifeq ($(basename $(OPT_OS)),win32)
|
2014-11-23 03:08:54 +00:00
|
|
|
PATHEXPAND := ARCH XCC XCXX XAS XLD XOC XOD XSZ XAR PROJECT BUILDDIR SRC DEFS LIBS INCPATH LIBPATH MLIST $(PATHLIST)
|
2014-10-04 07:12:33 +00:00
|
|
|
|
|
|
|
# First convert \'s to /'s
|
|
|
|
$(foreach var,$(PATHEXPAND),$(eval $(var):=$$(subst \,/,$($(var)))))
|
|
|
|
|
|
|
|
# For cygwin gmake - need to convert all absolute paths (mingw gmake doesn't need this)
|
|
|
|
ifneq ($(findstring cygdrive,$(PATH)),)
|
|
|
|
DRIVELETTERS := a b c d e f g h i j k l m n o p q r s t u v w x y z A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
|
|
|
|
$(foreach drv,$(DRIVELETTERS),$(foreach var,$(PATHEXPAND),$(eval $(var):=$$(patsubst $(drv):%,/cygdrive/$(drv)%,$($(var))))))
|
|
|
|
endif
|
2014-10-02 09:52:28 +00:00
|
|
|
endif
|
|
|
|
|
2014-10-06 05:50:19 +00:00
|
|
|
# Where are we
|
2014-11-23 03:08:54 +00:00
|
|
|
CURRENTDIR := $(dir $(abspath $(lastword $(MLIST))))
|
2014-10-06 05:50:19 +00:00
|
|
|
|
|
|
|
# Handle cpu specific options
|
|
|
|
ifneq ($(OPT_CPU),)
|
|
|
|
include $(CURRENTDIR)cpu_$(OPT_CPU).mk
|
|
|
|
endif
|
|
|
|
|
2014-10-02 09:52:28 +00:00
|
|
|
# Path resolution - Functions to convert a source path to a object path and visa-versa
|
|
|
|
src_obj_fn := $$(1)
|
|
|
|
obj_src_fn := $$(1)
|
2014-10-04 07:12:33 +00:00
|
|
|
$(foreach var,$(PATHLIST),$(eval obj_src_fn := $$$$(patsubst $(var)/%,$$$$($(var))/%,$$(obj_src_fn))))
|
|
|
|
$(foreach var,$(PATHLIST),$(eval src_obj_fn := $$$$(patsubst $$$$($(var))/%,$(var)/%,$$(src_obj_fn))))
|
2014-10-02 09:52:28 +00:00
|
|
|
src_obj_fn := $$(subst :,_drv_drv_,$$(subst ../,_dot_dot/,$(src_obj_fn)))
|
|
|
|
obj_src_fn := $$(subst _drv_drv_,:,$$(subst _dot_dot/,../,$(obj_src_fn)))
|
|
|
|
$(eval src_obj=$(src_obj_fn))
|
|
|
|
$(eval obj_src=$(obj_src_fn))
|
|
|
|
|
2014-09-27 15:42:30 +00:00
|
|
|
# Add ARCH to each of the compiler programs
|
|
|
|
ifeq ($(XCC),)
|
2014-10-04 07:12:33 +00:00
|
|
|
XCC = $(ARCH)gcc
|
2014-09-27 15:42:30 +00:00
|
|
|
endif
|
|
|
|
ifeq ($(XCXX),)
|
2014-10-04 07:12:33 +00:00
|
|
|
XCXX = $(ARCH)g++
|
2014-09-27 15:42:30 +00:00
|
|
|
endif
|
|
|
|
ifeq ($(XAS),)
|
2014-10-04 07:12:33 +00:00
|
|
|
XAS = $(ARCH)gcc -x assembler-with-cpp
|
2014-09-27 15:42:30 +00:00
|
|
|
endif
|
|
|
|
ifeq ($(XLD),)
|
2014-10-04 07:12:33 +00:00
|
|
|
XLD = $(ARCH)gcc
|
2014-09-27 15:42:30 +00:00
|
|
|
endif
|
2014-09-30 14:44:40 +00:00
|
|
|
ifeq ($(XOC),)
|
2014-10-04 07:12:33 +00:00
|
|
|
XOC = $(ARCH)objcopy
|
2014-09-30 14:44:40 +00:00
|
|
|
endif
|
|
|
|
ifeq ($(XOD),)
|
2014-10-04 07:12:33 +00:00
|
|
|
XOD = $(ARCH)objdump
|
2014-09-30 14:44:40 +00:00
|
|
|
endif
|
2014-10-04 07:12:33 +00:00
|
|
|
ifeq ($(XSZ),)
|
|
|
|
XSZ = $(ARCH)size
|
2014-10-06 05:50:19 +00:00
|
|
|
endif
|
|
|
|
ifeq ($(XAR),)
|
|
|
|
XAR = $(ARCH)ar
|
|
|
|
endif
|
2014-09-27 15:42:30 +00:00
|
|
|
|
|
|
|
# Default project name is the project directory name
|
|
|
|
ifeq ($(PROJECT),)
|
2014-11-23 03:08:54 +00:00
|
|
|
ifneq ($(firstword $(abspath $(firstword $(MLIST)))),$(lastword $(abspath $(firstword $(MLIST)))))
|
2014-10-04 07:12:33 +00:00
|
|
|
$(error Your directory contains spaces. Gmake barfs at that. Please define PROJECT)
|
|
|
|
endif
|
2014-11-23 03:08:54 +00:00
|
|
|
PROJECT := $(notdir $(patsubst %/,%,$(dir $(abspath $(firstword $(MLIST))))))
|
2014-09-27 15:42:30 +00:00
|
|
|
endif
|
|
|
|
|
2014-10-02 09:52:28 +00:00
|
|
|
# Output directories
|
2014-09-27 15:42:30 +00:00
|
|
|
ifeq ($(BUILDDIR),)
|
2014-10-04 07:12:33 +00:00
|
|
|
ifeq ($(MAKECMDGOALS),Debug)
|
|
|
|
BUILDDIR = bin/Debug
|
|
|
|
endif
|
|
|
|
ifeq ($(MAKECMDGOALS),Release)
|
|
|
|
BUILDDIR = bin/Release
|
|
|
|
endif
|
|
|
|
ifeq ($(MAKECMDGOALS),cleanDebug)
|
|
|
|
BUILDDIR = bin/Debug
|
|
|
|
endif
|
|
|
|
ifeq ($(MAKECMDGOALS),cleanRelease)
|
|
|
|
BUILDDIR = bin/Release
|
|
|
|
endif
|
|
|
|
ifeq ($(BUILDDIR),)
|
|
|
|
BUILDDIR = .build
|
|
|
|
endif
|
2014-09-27 15:42:30 +00:00
|
|
|
endif
|
|
|
|
OBJDIR = $(BUILDDIR)/obj
|
|
|
|
DEPDIR = $(BUILDDIR)/dep
|
|
|
|
|
2014-10-02 09:52:28 +00:00
|
|
|
# Output files
|
2014-09-27 15:42:30 +00:00
|
|
|
MAPFILE = $(BUILDDIR)/$(PROJECT).map
|
2014-10-06 05:50:19 +00:00
|
|
|
LIBFILE = $(BUILDDIR)/lib$(PROJECT).a
|
2014-10-04 07:12:33 +00:00
|
|
|
FAKEFILE= fakefile.o
|
2014-09-30 14:44:40 +00:00
|
|
|
EXEFILE =
|
|
|
|
ifeq ($(basename $(OPT_OS)),win32)
|
2014-10-04 07:12:33 +00:00
|
|
|
EXEFILE = $(BUILDDIR)/$(PROJECT).exe
|
|
|
|
TARGETS = $(EXEFILE)
|
2014-09-30 14:44:40 +00:00
|
|
|
endif
|
|
|
|
ifeq ($(basename $(OPT_OS)),linux)
|
2014-10-04 07:12:33 +00:00
|
|
|
EXEFILE = $(BUILDDIR)/$(PROJECT)
|
|
|
|
TARGETS = $(EXEFILE)
|
2014-09-30 14:44:40 +00:00
|
|
|
endif
|
|
|
|
ifeq ($(basename $(OPT_OS)),osx)
|
2014-10-04 07:12:33 +00:00
|
|
|
EXEFILE = $(BUILDDIR)/$(PROJECT)
|
|
|
|
TARGETS = $(EXEFILE)
|
2014-09-30 14:44:40 +00:00
|
|
|
endif
|
|
|
|
ifeq ($(EXEFILE),)
|
2014-10-04 07:12:33 +00:00
|
|
|
LDFLAGS += -nostartfiles
|
|
|
|
EXEFILE = $(BUILDDIR)/$(PROJECT).elf
|
|
|
|
TARGETS = $(EXEFILE) $(BUILDDIR)/$(PROJECT).hex $(BUILDDIR)/$(PROJECT).bin $(BUILDDIR)/$(PROJECT).dmp elfstats
|
2014-09-27 15:42:30 +00:00
|
|
|
endif
|
|
|
|
|
2014-10-04 07:12:33 +00:00
|
|
|
# Generate our object file lists
|
|
|
|
OBJS_THUMB += $(addprefix $(OBJDIR)/,$(call src_obj,$(addsuffix .o,$(basename $(SRC_THUMB)))))
|
|
|
|
OBJS_NOTHUMB += $(addprefix $(OBJDIR)/,$(call src_obj,$(addsuffix .o,$(basename $(SRC_NOTHUMB)))))
|
|
|
|
ifeq ($(OPT_THUMB),yes)
|
|
|
|
OBJS_THUMB += $(OBJS) $(addprefix $(OBJDIR)/,$(call src_obj,$(addsuffix .o,$(basename $(SRC)))))
|
|
|
|
else
|
|
|
|
OBJS_NOTHUMB += $(OBJS) $(addprefix $(OBJDIR)/,$(call src_obj,$(addsuffix .o,$(basename $(SRC)))))
|
|
|
|
endif
|
|
|
|
ifneq ($(OBJS_THUMB),)
|
|
|
|
ifneq ($(OBJS_NOTHUMB),)
|
|
|
|
# Mixed ARM and THUMB mode - enabled only if needed because it kills performance.
|
|
|
|
SRCFLAGS += -mthumb-interwork
|
|
|
|
LDFLAGS += -mthumb-interwork
|
|
|
|
DEFS += THUMB_PRESENT
|
|
|
|
else
|
|
|
|
# Pure THUMB mode, THUMB C code cannot be called by ARM asm code directly.
|
|
|
|
LDFLAGS += -mthumb
|
|
|
|
DEFS += THUMB_PRESENT THUMB_NO_INTERWORKING
|
|
|
|
FAKEFILE= fakethumbfile.o
|
|
|
|
endif
|
|
|
|
endif
|
2014-09-27 15:42:30 +00:00
|
|
|
|
2014-10-02 09:52:28 +00:00
|
|
|
# Handle make API options that affect compiler arguments
|
2014-09-30 14:44:40 +00:00
|
|
|
ifneq ($(OPT_NONSTANDARD_FLAGS),yes)
|
2014-10-04 07:12:33 +00:00
|
|
|
SRCFLAGS += -fomit-frame-pointer -Wall -Wextra -Wstrict-prototypes -fverbose-asm
|
2014-09-30 14:44:40 +00:00
|
|
|
endif
|
|
|
|
ifeq ($(OPT_LINK_OPTIMIZE),yes)
|
2014-10-04 07:12:33 +00:00
|
|
|
SRCFLAGS += -ffunction-sections -fdata-sections -fno-common -flto
|
2014-10-06 05:50:19 +00:00
|
|
|
LDFLAGS += -Wl,--gc-sections
|
2014-09-30 14:44:40 +00:00
|
|
|
endif
|
2014-09-27 15:42:30 +00:00
|
|
|
ifeq ($(OPT_GENERATE_MAP),yes)
|
2014-10-06 05:50:19 +00:00
|
|
|
LDFLAGS += -Wl,-Map=$(MAPFILE),--cref
|
2014-09-27 15:42:30 +00:00
|
|
|
endif
|
|
|
|
ifeq ($(OPT_GENERATE_LISTINGS),yes)
|
2014-10-04 07:12:33 +00:00
|
|
|
CFLAGS += -Wa,-alms=$(@:.o=.lst)
|
|
|
|
CXXFLAGS += -Wa,-alms=$(@:.o=.lst)
|
|
|
|
ASFLAGS += -Wa,-amhls=$(@:.o=.lst)
|
2014-09-27 15:42:30 +00:00
|
|
|
endif
|
2014-09-30 14:44:40 +00:00
|
|
|
ifneq ($(LDSCRIPT),)
|
2014-10-04 07:12:33 +00:00
|
|
|
LDFLAGS += -T$(LDSCRIPT)
|
|
|
|
endif
|
2014-09-27 15:42:30 +00:00
|
|
|
|
|
|
|
# Generate dependency information
|
|
|
|
SRCFLAGS += -MMD -MP -MF $(DEPDIR)/$(@F).d
|
|
|
|
|
2014-10-04 07:12:33 +00:00
|
|
|
# Combine all our compiler arguments
|
|
|
|
SRCFLAGS += -I. $(patsubst %,-I%,$(INCPATH)) $(patsubst %,-D%,$(patsubst -D%,%,$(DEFS)))
|
|
|
|
LDFLAGS += $(patsubst %,-L%,$(LIBPATH)) $(patsubst %,-l%,$(patsubst -l%,%,$(LIBS)))
|
|
|
|
|
2014-10-06 05:50:19 +00:00
|
|
|
################# Targets ######################
|
2014-09-27 15:42:30 +00:00
|
|
|
|
2014-10-06 05:50:19 +00:00
|
|
|
.PHONY: builddirs fakefile.o fakethumbfile.o elfstats all exe lib clean Debug Release cleanDebug cleanRelease
|
|
|
|
|
|
|
|
# Many IDE's use these targets instead.
|
2014-09-27 15:42:30 +00:00
|
|
|
Debug Release: all
|
|
|
|
cleanDebug cleanRelease: clean
|
|
|
|
|
2014-10-06 05:50:19 +00:00
|
|
|
# Make a program or a library?
|
|
|
|
ifeq ($(OPT_MAKE_LIB),yes)
|
|
|
|
all: lib
|
|
|
|
else
|
|
|
|
all: exe
|
|
|
|
endif
|
|
|
|
|
|
|
|
exe: builddirs $(FAKEFILE) $(TARGETS)
|
|
|
|
lib: builddirs $(FAKEFILE) $(LIBFILE)
|
2014-09-27 15:42:30 +00:00
|
|
|
|
|
|
|
builddirs:
|
|
|
|
@mkdir -p $(BUILDDIR)
|
|
|
|
@mkdir -p $(OBJDIR)
|
|
|
|
@mkdir -p $(DEPDIR)
|
|
|
|
|
2014-10-04 07:12:33 +00:00
|
|
|
$(FAKEFILE):
|
2014-09-27 15:42:30 +00:00
|
|
|
ifneq ($(OPT_VERBOSE_COMPILE),yes)
|
2014-10-04 07:12:33 +00:00
|
|
|
ifneq ($(filter %.cpp,$(SRC) $(SRC_NOTHUMB) $(SRC_THUMB)),)
|
2015-07-11 06:13:05 +00:00
|
|
|
@echo .
|
2015-07-10 14:42:06 +00:00
|
|
|
@echo C++ Compiler Options..
|
|
|
|
@echo $(XCXX) -c $(CPPFLAGS) $(CXXFLAGS) $(SRCFLAGS) $(@:.o=.cpp) -o $(OBJDIR)/$@
|
2014-10-04 07:12:33 +00:00
|
|
|
else
|
|
|
|
ifneq ($(filter %.c++,$(SRC) $(SRC_NOTHUMB) $(SRC_THUMB)),)
|
2015-07-11 06:13:05 +00:00
|
|
|
@echo .
|
2015-07-10 14:42:06 +00:00
|
|
|
@echo C++ Compiler Options..
|
|
|
|
@echo $(XCXX) -c $(CPPFLAGS) $(CXXFLAGS) $(SRCFLAGS) $(@:.o=.c++) -o $(OBJDIR)/$@
|
2014-10-04 07:12:33 +00:00
|
|
|
endif
|
|
|
|
endif
|
|
|
|
ifneq ($(filter %.c,$(SRC) $(SRC_NOTHUMB) $(SRC_THUMB)),)
|
2015-07-11 06:13:05 +00:00
|
|
|
@echo .
|
2015-07-10 14:42:06 +00:00
|
|
|
@echo C Compiler Options....
|
|
|
|
@echo $(XCC) -c $(CPPFLAGS) $(CFLAGS) $(SRCFLAGS) $(@:.o=.c) -o $(OBJDIR)/$@
|
2014-10-04 07:12:33 +00:00
|
|
|
endif
|
|
|
|
ifneq ($(filter %.s,$(SRC) $(SRC_NOTHUMB) $(SRC_THUMB)),)
|
2015-07-11 06:13:05 +00:00
|
|
|
@echo .
|
2015-07-10 14:42:06 +00:00
|
|
|
@echo Assembler Options.....
|
2017-06-24 07:12:42 +00:00
|
|
|
@echo $(XAS) -c $(CPPFLAGS) $(CFLAGS) $(SRCFLAGS) $(@:.o=.s) -o $(OBJDIR)/$@
|
|
|
|
else
|
|
|
|
ifneq ($(filter %.S,$(SRC) $(SRC_NOTHUMB) $(SRC_THUMB)),)
|
|
|
|
@echo .
|
|
|
|
@echo Assembler Options.....
|
|
|
|
@echo $(XAS) -c $(CPPFLAGS) $(CFLAGS) $(SRCFLAGS) $(@:.o=.S) -o $(OBJDIR)/$@
|
|
|
|
endif
|
2014-10-04 07:12:33 +00:00
|
|
|
endif
|
2014-10-06 05:50:19 +00:00
|
|
|
ifneq ($(OPT_MAKE_LIB),yes)
|
2015-07-11 06:13:05 +00:00
|
|
|
@echo .
|
2015-07-10 14:42:06 +00:00
|
|
|
@echo Linker Options........
|
|
|
|
@echo $(XLD) $(LDFLAGS) $(OBJDIR)/$@ -o $(EXEFILE)
|
2014-10-06 05:50:19 +00:00
|
|
|
endif
|
2015-07-11 06:13:05 +00:00
|
|
|
@echo .
|
2014-10-04 07:12:33 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
fakethumbfile.o $(OBJS_THUMB): SRCFLAGS += -mthumb -DTHUMB
|
|
|
|
|
|
|
|
elfstats: $(EXEFILE)
|
|
|
|
@echo .
|
|
|
|
ifeq ($(USE_VERBOSE_COMPILE),yes)
|
|
|
|
$(XSZ) $<
|
|
|
|
else
|
|
|
|
@$(XSZ) $<
|
2014-09-27 15:42:30 +00:00
|
|
|
endif
|
|
|
|
|
2014-10-02 09:52:28 +00:00
|
|
|
# Implicit Rules
|
|
|
|
|
2014-09-27 15:42:30 +00:00
|
|
|
.SECONDEXPANSION:
|
2014-10-02 09:52:28 +00:00
|
|
|
$(OBJDIR)/%.o : $$(call obj_src,%.c)
|
2014-09-27 15:42:30 +00:00
|
|
|
@mkdir -p $(dir $@)
|
|
|
|
ifeq ($(OPT_VERBOSE_COMPILE),yes)
|
2014-10-04 07:12:33 +00:00
|
|
|
@echo .
|
2014-09-27 15:42:30 +00:00
|
|
|
$(XCC) -c $(CPPFLAGS) $(CFLAGS) $(SRCFLAGS) $< -o $@
|
|
|
|
else
|
|
|
|
@echo Compiling $<
|
|
|
|
@$(XCC) -c $(CPPFLAGS) $(CFLAGS) $(SRCFLAGS) $< -o $@
|
|
|
|
endif
|
|
|
|
|
2014-10-02 09:52:28 +00:00
|
|
|
$(OBJDIR)/%.o : $$(call obj_src,%.cpp)
|
2014-09-27 15:42:30 +00:00
|
|
|
@mkdir -p $(dir $@)
|
|
|
|
ifeq ($(OPT_VERBOSE_COMPILE),yes)
|
2014-10-04 07:12:33 +00:00
|
|
|
@echo .
|
2014-09-27 15:42:30 +00:00
|
|
|
$(XCXX) -c $(CPPFLAGS) $(CXXFLAGS) $(SRCFLAGS) $< -o $@
|
|
|
|
else
|
|
|
|
@echo Compiling $<
|
|
|
|
@$(XCXX) -c $(CPPFLAGS) $(CXXFLAGS) $(SRCFLAGS) $< -o $@
|
|
|
|
endif
|
|
|
|
|
2014-10-02 09:52:28 +00:00
|
|
|
$(OBJDIR)/%.o : $$(call obj_src,%.c++)
|
2014-09-27 15:42:30 +00:00
|
|
|
@mkdir -p $(dir $@)
|
|
|
|
ifeq ($(OPT_VERBOSE_COMPILE),yes)
|
2014-10-04 07:12:33 +00:00
|
|
|
@echo .
|
2014-09-27 15:42:30 +00:00
|
|
|
$(XCXX) -c $(CPPFLAGS) $(CXXFLAGS) $(SRCFLAGS) $< -o $@
|
|
|
|
else
|
|
|
|
@echo Compiling $<
|
|
|
|
@$(XCXX) -c $(CPPFLAGS) $(CXXFLAGS) $(SRCFLAGS) $< -o $@
|
|
|
|
endif
|
|
|
|
|
2014-10-02 09:52:28 +00:00
|
|
|
$(OBJDIR)/%.o : $$(call obj_src,%.s)
|
2014-09-27 15:42:30 +00:00
|
|
|
@mkdir -p $(dir $@)
|
|
|
|
ifeq ($(OPT_VERBOSE_COMPILE),yes)
|
2014-10-04 07:12:33 +00:00
|
|
|
@echo .
|
2014-09-27 15:42:30 +00:00
|
|
|
$(XAS) -c $(CPPFLAGS) $(ASFLAGS) $(SRCFLAGS) $< -o $@
|
|
|
|
else
|
|
|
|
@echo Compiling $<
|
|
|
|
@$(XAS) -c $(CPPFLAGS) $(ASFLAGS) $(SRCFLAGS) $< -o $@
|
|
|
|
endif
|
|
|
|
|
2017-06-24 07:12:42 +00:00
|
|
|
$(OBJDIR)/%.o : $$(call obj_src,%.S)
|
|
|
|
@mkdir -p $(dir $@)
|
|
|
|
ifeq ($(OPT_VERBOSE_COMPILE),yes)
|
|
|
|
@echo .
|
|
|
|
$(XAS) -c $(CPPFLAGS) $(ASFLAGS) $(SRCFLAGS) $< -o $@
|
|
|
|
else
|
|
|
|
@echo Compiling $<
|
|
|
|
@$(XAS) -c $(CPPFLAGS) $(ASFLAGS) $(SRCFLAGS) $< -o $@
|
|
|
|
endif
|
|
|
|
|
2014-10-04 07:12:33 +00:00
|
|
|
$(EXEFILE): $(OBJS_THUMB) $(OBJS_NOTHUMB) $(LDSCRIPT)
|
2014-09-27 15:42:30 +00:00
|
|
|
@mkdir -p $(dir $@)
|
|
|
|
ifeq ($(OPT_VERBOSE_COMPILE),yes)
|
2014-10-04 07:12:33 +00:00
|
|
|
@echo .
|
|
|
|
$(XLD) $(OBJS_THUMB) $(OBJS_NOTHUMB) $(LDFLAGS) -o $@
|
2014-09-27 15:42:30 +00:00
|
|
|
else
|
|
|
|
@echo Linking $@
|
2014-10-04 07:12:33 +00:00
|
|
|
@$(XLD) $(OBJS_THUMB) $(OBJS_NOTHUMB) $(LDFLAGS) -o $@
|
2014-09-27 15:42:30 +00:00
|
|
|
endif
|
|
|
|
ifeq ($(OPT_COPY_EXE),yes)
|
2014-09-30 14:44:40 +00:00
|
|
|
@cp $@ .
|
|
|
|
endif
|
|
|
|
|
2014-10-06 05:50:19 +00:00
|
|
|
$(LIBFILE): $(OBJS_THUMB) $(OBJS_NOTHUMB)
|
|
|
|
ifeq ($(OPT_VERBOSE_COMPILE),yes)
|
|
|
|
@echo .
|
|
|
|
$(XAR) -r $@ $^
|
|
|
|
else
|
|
|
|
@echo Creating Library $@
|
|
|
|
@$(XAR) -r $@ $^
|
|
|
|
endif
|
|
|
|
ifeq ($(OPT_COPY_EXE),yes)
|
|
|
|
@cp $@ .
|
|
|
|
endif
|
|
|
|
|
2014-10-02 09:52:28 +00:00
|
|
|
%.hex: %.elf
|
2014-09-30 14:44:40 +00:00
|
|
|
ifeq ($(OPT_VERBOSE_COMPILE),yes)
|
|
|
|
$(XOC) -O ihex $< $@
|
|
|
|
else
|
|
|
|
@echo Creating $@
|
|
|
|
@$(XOC) -O ihex $< $@
|
|
|
|
endif
|
|
|
|
ifeq ($(OPT_COPY_EXE),yes)
|
|
|
|
@cp $@ .
|
|
|
|
endif
|
|
|
|
|
2014-10-02 09:52:28 +00:00
|
|
|
%.bin: %.elf
|
2014-10-06 05:50:19 +00:00
|
|
|
ifeq ($(OPT_VERBOSE_COMPILE),yes)
|
2014-09-30 14:44:40 +00:00
|
|
|
$(XOC) -O binary $< $@
|
|
|
|
else
|
|
|
|
@echo Creating $@
|
|
|
|
@$(XOC) -O binary $< $@
|
|
|
|
endif
|
|
|
|
ifeq ($(OPT_COPY_EXE),yes)
|
|
|
|
@cp $@ .
|
|
|
|
endif
|
|
|
|
|
2014-10-02 09:52:28 +00:00
|
|
|
%.dmp: %.elf
|
2014-10-06 05:50:19 +00:00
|
|
|
ifeq ($(OPT_VERBOSE_COMPILE),yes)
|
2014-09-30 14:44:40 +00:00
|
|
|
$(XOD) -x --syms $< > $@
|
|
|
|
else
|
|
|
|
@echo Creating $@
|
|
|
|
@$(XOD) -x --syms $< > $@
|
|
|
|
endif
|
|
|
|
ifeq ($(OPT_COPY_EXE),yes)
|
|
|
|
@cp $@ .
|
2014-09-27 15:42:30 +00:00
|
|
|
endif
|
|
|
|
|
2014-10-02 09:52:28 +00:00
|
|
|
# Goodness knows why we would want this.
|
2014-09-27 15:42:30 +00:00
|
|
|
gcov:
|
|
|
|
-mkdir gcov
|
2014-10-06 05:50:19 +00:00
|
|
|
$(COV) -u $(subst /,\,$(SRC_NOTHUMB) $(SRC_THUMB))
|
2014-09-27 15:42:30 +00:00
|
|
|
-mv *.gcov ./gcov
|
|
|
|
|
|
|
|
# Include the dependency files, should be the last of the makefile except for clean
|
|
|
|
-include $(shell mkdir -p $(DEPDIR) 2>/dev/null) $(wildcard $(DEPDIR)/*)
|
|
|
|
|
2014-10-02 09:52:28 +00:00
|
|
|
# Clean
|
2014-09-27 15:42:30 +00:00
|
|
|
clean:
|
|
|
|
-rm -fR $(BUILDDIR)
|
|
|
|
|
|
|
|
# *** EOF ***
|