reverting changes - this file is actually not used anymore
This commit is contained in:
parent
a80a754db0
commit
52370c0fb5
|
@ -1,84 +1,72 @@
|
|||
# ARM Cortex-Mx common makefile scripts and rules.
|
||||
|
||||
##############################################################################
|
||||
# Processing options coming from the upper Makefile.
|
||||
#
|
||||
# Output directory and files
|
||||
ifeq ($(BUILDDIR),)
|
||||
BUILDDIR = build
|
||||
endif
|
||||
ifeq ($(BUILDDIR),.)
|
||||
BUILDDIR = build
|
||||
endif
|
||||
OUTFILES = $(BUILDDIR)/$(PROJECT)
|
||||
|
||||
# Compiler options
|
||||
OPT := $(USE_OPT)
|
||||
COPT := $(USE_COPT)
|
||||
CPPOPT := $(USE_CPPOPT)
|
||||
|
||||
# Garbage collection
|
||||
# Automatic compiler options
|
||||
OPT = $(USE_OPT)
|
||||
COPT = $(USE_COPT)
|
||||
CPPOPT = $(USE_CPPOPT)
|
||||
ifeq ($(USE_LINK_GC),yes)
|
||||
OPT += -ffunction-sections -fdata-sections -fno-common
|
||||
LDOPT := ,--gc-sections
|
||||
OPT += -ffunction-sections -fdata-sections -fno-common
|
||||
endif
|
||||
|
||||
# Source files groups and paths
|
||||
ifeq ($(USE_THUMB),yes)
|
||||
TCSRC += $(CSRC)
|
||||
TCPPSRC += $(CPPSRC)
|
||||
else
|
||||
LDOPT :=
|
||||
ACSRC += $(CSRC)
|
||||
ACPPSRC += $(CPPSRC)
|
||||
endif
|
||||
|
||||
# Linker extra options
|
||||
ifneq ($(USE_LDOPT),)
|
||||
LDOPT := $(LDOPT),$(USE_LDOPT)
|
||||
endif
|
||||
|
||||
# Link time optimizations
|
||||
ifeq ($(USE_LTO),yes)
|
||||
OPT += -flto
|
||||
endif
|
||||
|
||||
# Process stack size
|
||||
ifeq ($(USE_PROCESS_STACKSIZE),)
|
||||
LDOPT := $(LDOPT),--defsym=__process_stack_size__=0x400
|
||||
else
|
||||
LDOPT := $(LDOPT),--defsym=__process_stack_size__=$(USE_PROCESS_STACKSIZE)
|
||||
endif
|
||||
|
||||
# Exceptions stack size
|
||||
ifeq ($(USE_EXCEPTIONS_STACKSIZE),)
|
||||
LDOPT := $(LDOPT),--defsym=__main_stack_size__=0x400
|
||||
else
|
||||
LDOPT := $(LDOPT),--defsym=__main_stack_size__=$(USE_EXCEPTIONS_STACKSIZE)
|
||||
endif
|
||||
|
||||
BUILDDIR = build
|
||||
OUTFILES := $(BUILDDIR)/$(PROJECT).exe
|
||||
SRCPATHS := $(sort $(dir $(ASMXSRC)) $(dir $(ASMSRC)) $(dir $(CSRC)) $(dir $(CPPSRC)))
|
||||
ASRC = $(ACSRC)$(ACPPSRC)
|
||||
TSRC = $(TCSRC)$(TCPPSRC)
|
||||
SRCPATHS = $(sort $(dir $(ASMXSRC)) $(dir $(ASMSRC)) $(dir $(ASRC)) $(dir $(TSRC)))
|
||||
|
||||
# Various directories
|
||||
OBJDIR := $(BUILDDIR)/obj
|
||||
LSTDIR := $(BUILDDIR)/lst
|
||||
OBJDIR = $(BUILDDIR)/obj
|
||||
LSTDIR = $(BUILDDIR)/lst
|
||||
|
||||
# Object files groups
|
||||
COBJS := $(addprefix $(OBJDIR)/, $(notdir $(CSRC:.c=.o)))
|
||||
CPPOBJS := $(addprefix $(OBJDIR)/, $(notdir $(CPPSRC:.cpp=.o)))
|
||||
ASMOBJS := $(addprefix $(OBJDIR)/, $(notdir $(ASMSRC:.s=.o)))
|
||||
ASMXOBJS := $(addprefix $(OBJDIR)/, $(notdir $(ASMXSRC:.S=.o)))
|
||||
OBJS := $(ASMXOBJS) $(ASMOBJS) $(COBJS) $(CPPOBJS)
|
||||
ACOBJS = $(addprefix $(OBJDIR)/, $(notdir $(ACSRC:.c=.o)))
|
||||
ACPPOBJS = $(addprefix $(OBJDIR)/, $(notdir $(ACPPSRC:.cpp=.o)))
|
||||
TCOBJS = $(addprefix $(OBJDIR)/, $(notdir $(TCSRC:.c=.o)))
|
||||
TCPPOBJS = $(addprefix $(OBJDIR)/, $(notdir $(TCPPSRC:.cpp=.o)))
|
||||
ASMOBJS = $(addprefix $(OBJDIR)/, $(notdir $(ASMSRC:.s=.o)))
|
||||
ASMXOBJS = $(addprefix $(OBJDIR)/, $(notdir $(ASMXSRC:.S=.o)))
|
||||
OBJS = $(ASMXOBJS) $(ASMOBJS) $(ACOBJS) $(TCOBJS) $(ACPPOBJS) $(TCPPOBJS)
|
||||
|
||||
# Paths
|
||||
IINCDIR := $(patsubst %,-I%,$(INCDIR) $(DINCDIR) $(UINCDIR))
|
||||
LLIBDIR := $(patsubst %,-L%,$(DLIBDIR) $(ULIBDIR))
|
||||
IINCDIR = $(patsubst %,-I%,$(INCDIR) $(DINCDIR) $(UINCDIR))
|
||||
LLIBDIR = $(patsubst %,-L%,$(DLIBDIR) $(ULIBDIR))
|
||||
|
||||
# Macros
|
||||
DEFS := $(DDEFS) $(UDEFS)
|
||||
ADEFS := $(DADEFS) $(UADEFS)
|
||||
DEFS = $(DDEFS) $(UDEFS)
|
||||
ADEFS = $(DADEFS) $(UADEFS)
|
||||
|
||||
# Libs
|
||||
LIBS := $(DLIBS) $(ULIBS)
|
||||
LIBS = $(DLIBS) $(ULIBS)
|
||||
|
||||
# Various settings
|
||||
MCFLAGS =
|
||||
#MCFLAGS = -mcpu=$(MCU)
|
||||
ODFLAGS = -x --syms
|
||||
ASFLAGS = $(MCFLAGS) -Wa,-amhls=$(LSTDIR)/$(notdir $(<:.s=.lst)) $(ADEFS)
|
||||
ASXFLAGS = $(MCFLAGS) -Wa,-amhls=$(LSTDIR)/$(notdir $(<:.S=.lst)) $(ADEFS)
|
||||
CFLAGS = $(MCFLAGS) $(OPT) $(COPT) $(CWARN) -Wa,-alms=$(LSTDIR)/$(notdir $(<:.c=.lst)) $(DEFS)
|
||||
CPPFLAGS = $(MCFLAGS) $(OPT) $(CPPOPT) $(CPPWARN) -Wa,-alms=$(LSTDIR)/$(notdir $(<:.cpp=.lst)) $(DEFS)
|
||||
LDFLAGS = $(MCFLAGS) $(OPT) $(LLIBDIR) -Wl,-Map=$(BUILDDIR)/$(PROJECT).map,--cref,--no-warn-mismatch$(LDOPT)
|
||||
ifeq ($(USE_LINK_GC),yes)
|
||||
LDFLAGS = $(MCFLAGS) -Wl,-Map=$(BUILDDIR)/$(PROJECT).map,--cref,--no-warn-mismatch,--gc-sections $(LLIBDIR)
|
||||
else
|
||||
LDFLAGS = $(MCFLAGS) -Wl,-Map=$(BUILDDIR)/$(PROJECT).map,--cref,--no-warn-mismatch $(LLIBDIR)
|
||||
endif
|
||||
|
||||
# Generate dependency information
|
||||
ASFLAGS += -MD -MP -MF .dep/$(@F).d
|
||||
ASXFLAGS += -MD -MP -MF .dep/$(@F).d
|
||||
CFLAGS += -MD -MP -MF .dep/$(@F).d
|
||||
CPPFLAGS += -MD -MP -MF .dep/$(@F).d
|
||||
|
||||
|
@ -89,40 +77,55 @@ VPATH = $(SRCPATHS)
|
|||
# Makefile rules
|
||||
#
|
||||
|
||||
all: $(OBJS) $(OUTFILES)
|
||||
all: $(OBJS) $(OUTFILES) MAKE_ALL_RULE_HOOK
|
||||
|
||||
$(OBJS): $(BUILDDIR) $(OBJDIR) $(LSTDIR)
|
||||
MAKE_ALL_RULE_HOOK:
|
||||
|
||||
$(BUILDDIR):
|
||||
$(OBJS): | $(BUILDDIR)
|
||||
|
||||
$(BUILDDIR) $(OBJDIR) $(LSTDIR):
|
||||
ifneq ($(USE_VERBOSE_COMPILE),yes)
|
||||
@echo Compiler Options
|
||||
@echo $(CC) -c $(CFLAGS) -I. $(IINCDIR) main.c -o main.o
|
||||
@echo $(CPPC) -c $(CPPFLAGS) -I. $(IINCDIR) main.cpp -o main.o
|
||||
@echo
|
||||
endif
|
||||
@mkdir -p $(BUILDDIR)
|
||||
mkdir -p $(OBJDIR)
|
||||
mkdir -p $(LSTDIR)
|
||||
|
||||
$(OBJDIR):
|
||||
@mkdir -p $(OBJDIR)
|
||||
|
||||
$(LSTDIR):
|
||||
@mkdir -p $(LSTDIR)
|
||||
|
||||
$(CPPOBJS) : $(OBJDIR)/%.o : %.cpp Makefile
|
||||
$(ACPPOBJS) : $(OBJDIR)/%.o : %.cpp Makefile
|
||||
ifeq ($(USE_VERBOSE_COMPILE),yes)
|
||||
@echo
|
||||
$(CPPC) -c $(CPPFLAGS) $(OPT) -I. $(IINCDIR) $< -o $@
|
||||
$(CPPC) -c $(CPPFLAGS) $(AOPT) -I. $(IINCDIR) $< -o $@
|
||||
else
|
||||
@echo Compiling $(<F)
|
||||
@$(CPPC) -c $(CPPFLAGS) $(OPT) -I. $(IINCDIR) $< -o $@
|
||||
@$(CPPC) -c $(CPPFLAGS) $(AOPT) -I. $(IINCDIR) $< -o $@
|
||||
endif
|
||||
|
||||
$(COBJS) : $(OBJDIR)/%.o : %.c Makefile
|
||||
$(TCPPOBJS) : $(OBJDIR)/%.o : %.cpp Makefile
|
||||
ifeq ($(USE_VERBOSE_COMPILE),yes)
|
||||
@echo
|
||||
$(CC) -c $(CFLAGS) $(OPT) -I. $(IINCDIR) $< -o $@
|
||||
$(CPPC) -c $(CPPFLAGS) $(TOPT) -I. $(IINCDIR) $< -o $@
|
||||
else
|
||||
@echo Compiling $(<F)
|
||||
@$(CC) -c $(CFLAGS) $(OPT) -I. $(IINCDIR) $< -o $@
|
||||
@$(CPPC) -c $(CPPFLAGS) $(TOPT) -I. $(IINCDIR) $< -o $@
|
||||
endif
|
||||
|
||||
$(ACOBJS) : $(OBJDIR)/%.o : %.c Makefile
|
||||
ifeq ($(USE_VERBOSE_COMPILE),yes)
|
||||
@echo
|
||||
$(CC) -c $(CFLAGS) $(AOPT) -I. $(IINCDIR) $< -o $@
|
||||
else
|
||||
@echo Compiling $(<F)
|
||||
@$(CC) -c $(CFLAGS) $(AOPT) -I. $(IINCDIR) $< -o $@
|
||||
endif
|
||||
|
||||
$(TCOBJS) : $(OBJDIR)/%.o : %.c Makefile
|
||||
ifeq ($(USE_VERBOSE_COMPILE),yes)
|
||||
@echo
|
||||
$(CC) -c $(CFLAGS) $(TOPT) -I. $(IINCDIR) $< -o $@
|
||||
else
|
||||
@echo Compiling $(<F)
|
||||
@$(CC) -c $(CFLAGS) $(TOPT) -I. $(IINCDIR) $< -o $@
|
||||
endif
|
||||
|
||||
$(ASMOBJS) : $(OBJDIR)/%.o : %.s Makefile
|
||||
|
@ -136,14 +139,14 @@ endif
|
|||
|
||||
$(ASMXOBJS) : $(OBJDIR)/%.o : %.S Makefile
|
||||
ifeq ($(USE_VERBOSE_COMPILE),yes)
|
||||
@echo
|
||||
@echo
|
||||
$(CC) -c $(ASXFLAGS) $(TOPT) -I. $(IINCDIR) $< -o $@
|
||||
else
|
||||
@echo Compiling $(<F)
|
||||
@$(CC) -c $(ASXFLAGS) $(TOPT) -I. $(IINCDIR) $< -o $@
|
||||
endif
|
||||
|
||||
$(BUILDDIR)/$(PROJECT).exe: $(OBJS) $(LDSCRIPT)
|
||||
$(BUILDDIR)/$(PROJECT): $(OBJS)
|
||||
ifeq ($(USE_VERBOSE_COMPILE),yes)
|
||||
@echo
|
||||
$(LD) $(OBJS) $(LDFLAGS) $(LIBS) -o $@
|
||||
|
@ -155,7 +158,6 @@ endif
|
|||
clean:
|
||||
@echo Cleaning
|
||||
-rm -fR .dep $(BUILDDIR)
|
||||
@echo
|
||||
@echo Done
|
||||
|
||||
#
|
||||
|
|
Loading…
Reference in New Issue