挂在网上,睡前手机看看;早上删- 小時不識月- 博客园
Makefile
#------------------------------------------------------------------------------
#              VARIABLES APPENDED TO BY INCLUDED MAKEFILE FRAGMENTS
#------------------------------------------------------------------------------

# List of include directories for -I compiler option (-I added when used).
# Includes the BSP.
ALT_INCLUDE_DIRS := SOPC

# List of library directories for -L linker option (-L added when used).
# Includes the BSP.
ALT_LIBRARY_DIRS :=

# List of library names for -l linker option (-l added when used).
# Includes the BSP.
ALT_LIBRARY_NAMES :=

# List of library names for -msys-lib linker option (-msys-lib added when used).
# These are libraries that might be located in the BSP and depend on the BSP
# library, or vice versa
ALT_BSP_DEP_LIBRARY_NAMES :=

# List of dependencies for the linker.  This is usually the full pathname
# of each library (*.a) file.
# Includes the BSP.
ALT_LDDEPS :=

# List of root library directories that support running make to build them.
# Includes the BSP and any ALT libraries.
MAKEABLE_LIBRARY_ROOT_DIRS :=

# Generic flags passed to the compiler for different types of input files.
ALT_CFLAGS :=
ALT_CXXFLAGS :=
ALT_CPPFLAGS :=
ALT_ASFLAGS :=
ALT_LDFLAGS :=

#------------------------------------------------------------------------------
#                                 TOOLS
#------------------------------------------------------------------------------
CROSS_COMPILE := nios2-elf-
CC      := $(CROSS_COMPILE)gcc -xc
CXX     := $(CROSS_COMPILE)gcc -xc++
AS      := $(CROSS_COMPILE)gcc
AR      := $(CROSS_COMPILE)ar
LD      := $(CROSS_COMPILE)g++
NM      := $(CROSS_COMPILE)nm
RM      := rm -f
OBJDUMP := $(CROSS_COMPILE)objdump
OBJCOPY := $(CROSS_COMPILE)objcopy
STACKREPORT := nios2-stackreport
DOWNLOAD := nios2-download
FLASHPROG := nios2-flash-programmer
ELFPATCH := nios2-elf-insert

MKDIR := mkdir -p
ECHO := echo


#------------------------------------------------------------------------------
#                         The adjust-path macro
# 
# If COMSPEC is defined, Make is launched from Windows through
# Cygwin.  This adjust-path macro will call 'cygpath -u' on all
# paths to ensure they are readable by Make.
#
# If COMSPEC is not defined, Make is launched from *nix, and no adjustment
# is necessary
#------------------------------------------------------------------------------

ifdef COMSPEC
    adjust-path = $(shell cygpath -u "$1")
    adjust-path-mixed = $(shell cygpath -m "$1")
else
    adjust-path = $1
    adjust-path-mixed = $1
endif

#------------------------------------------------------------------------------
#                           DEFAULT TARGET
#------------------------------------------------------------------------------

# Put "all" rule before included makefile fragments because they may
# define rules and we don't want one of those to become the default rule.
.PHONY : all

all:
    @$(ECHO) [$(APP_NAME) build complete]

all : build_pre_process libs app build_post_process 


#vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
#                           GENERATED SETTINGS START                         v
#vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv

#START GENERATED

# The following TYPE comment allows tools to identify the 'type' of target this 
# makefile is associated with. 
# TYPE: APP_MAKEFILE

# This following VERSION comment indicates the version of the tool used to 
# generate this makefile. A makefile variable is provided for VERSION as well. 
# ACDS_VERSION: 9.1sp1
ACDS_VERSION := 9.1sp1

# This following BUILD_NUMBER comment indicates the build number of the tool 
# used to generate this makefile. 
# BUILD_NUMBER: 304


# Define path to the application ELF. 
# It may be used by the makefile fragments so is defined before including them. 
# 
ELF := u.elf

# Paths to C, C++, and assembly source files.
C_SRCS := main.c
CXX_SRCS :=
ASM_SRCS :=


# Path to root of object file tree.
OBJ_ROOT_DIR := obj

# Options to control objdump.
CREATE_OBJDUMP := 1
OBJDUMP_INCLUDE_SOURCE := 1
OBJDUMP_FULL_CONTENTS := 0

# Options to enable/disable optional files.
CREATE_ELF_DERIVED_FILES := 0
CREATE_LINKER_MAP := 1

# Common arguments for ALT_CFLAGSs
APP_CFLAGS_DEFINED_SYMBOLS :=
APP_CFLAGS_UNDEFINED_SYMBOLS :=
APP_CFLAGS_OPTIMIZATION := -O0
APP_CFLAGS_DEBUG_LEVEL := -g
APP_CFLAGS_WARNINGS := -Wall
APP_CFLAGS_USER_FLAGS :=

APP_ASFLAGS_USER :=

# Linker options that have default values assigned later if not
# assigned here.
LINKER_SCRIPT :=
CRT0 :=
SYS_LIB :=

# Define path to the root of the BSP.
BSP_ROOT_DIR := ../u_bsp

# List of application specific include directories, library directories and library names
APP_INCLUDE_DIRS :=
APP_LIBRARY_DIRS :=
APP_LIBRARY_NAMES :=

# Pre- and post- processor settings.
BUILD_PRE_PROCESS :=
BUILD_POST_PROCESS :=

QUARTUS_PROJECT_DIR := ../../


#END GENERATED

#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
#                            GENERATED SETTINGS END                           ^
#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^


#------------------------------------------------------------------------------
#                 VARIABLES DEPENDENT ON GENERATED CONTENT
#------------------------------------------------------------------------------

ifeq ($(BSP_ROOT_DIR),)
$(error Edit Makefile and provide a value for BSP_ROOT_DIR)
endif

ifeq ($(wildcard $(BSP_ROOT_DIR)),)
$(error BSP directory does not exist: $(BSP_ROOT_DIR))
endif

# Define absolute path to the root of the BSP.
ABS_BSP_ROOT_DIR := $(call adjust-path-mixed,$(shell cd "$(BSP_ROOT_DIR)"; pwd))

# Include makefile fragments.  Define variable ALT_LIBRARY_ROOT_DIR before
# including each makefile fragment so that it knows the path to itself.
BSP_INCLUDE_FILE := $(BSP_ROOT_DIR)/public.mk
ALT_LIBRARY_ROOT_DIR := $(BSP_ROOT_DIR)
include $(BSP_INCLUDE_FILE)
# C2H will need this to touch the BSP public.mk and avoid the sopc file out-of-date error during a BSP make
ABS_BSP_INCLUDE_FILE := $(ABS_BSP_ROOT_DIR)/public.mk


# If the BSP public.mk indicates that ALT_SIM_OPTIMIZE is set, rename the ELF 
# by prefixing it with RUN_ON_HDL_SIMULATOR_ONLY_.  
ifneq ($(filter -DALT_SIM_OPTIMIZE,$(ALT_CPPFLAGS)),)
ELF := RUN_ON_HDL_SIMULATOR_ONLY_$(ELF)
endif


# If the BSP public.mk indicates that ALT_PROVIDE_GMON is set, add option to download_elf target
ifneq ($(filter -DALT_PROVIDE_GMON,$(ALT_CPPFLAGS)),)
GMON_OUT_FILENAME := gmon.out
WRITE_GMON_OPTION := --write-gmon $(GMON_OUT_FILENAME)
endif

# Name of ELF application.
APP_NAME := $(basename $(ELF))

# Set to defaults if variables not already defined in settings.
ifeq ($(LINKER_SCRIPT),)
LINKER_SCRIPT := $(BSP_LINKER_SCRIPT)
endif
ifeq ($(CRT0),)
CRT0 := $(BSP_CRT0)
endif
ifeq ($(SYS_LIB),)
SYS_LIB := $(BSP_SYS_LIB)
endif

OBJDUMP_NAME := $(APP_NAME).objdump
OBJDUMP_FLAGS := --disassemble --syms --all-header
ifeq ($(OBJDUMP_INCLUDE_SOURCE),1)
OBJDUMP_FLAGS += --source
endif
ifeq ($(OBJDUMP_FULL_CONTENTS),1)
OBJDUMP_FLAGS += --full-contents
endif

# Create list of linker dependencies (*.a files).
APP_LDDEPS := $(ALT_LDDEPS) $(LDDEPS)

# Take lists and add required prefixes.
APP_INC_DIRS := $(addprefix -I, $(ALT_INCLUDE_DIRS) $(APP_INCLUDE_DIRS) $(INC_DIRS))
ASM_INC_PREFIX := -Wa,-I
APP_ASM_INC_DIRS := $(addprefix $(ASM_INC_PREFIX), $(ALT_INCLUDE_DIRS) $(APP_INCLUDE_DIRS) $(INC_DIRS))
APP_LIB_DIRS := $(addprefix -L, $(ALT_LIBRARY_DIRS) $(APP_LIBRARY_DIRS) $(LIB_DIRS))
APP_LIBS := $(addprefix -l, $(ALT_LIBRARY_NAMES) $(APP_LIBRARY_NAMES) $(LIBS))
APP_BSP_DEP_LIBS := $(addprefix -msys-lib=, $(ALT_BSP_DEP_LIBRARY_NAMES))

# Arguments for the C preprocessor, C/C++ compiler, assembler, and linker.
APP_CFLAGS := $(APP_CFLAGS_DEFINED_SYMBOLS)               $(APP_CFLAGS_UNDEFINED_SYMBOLS)               $(APP_CFLAGS_OPTIMIZATION)               $(APP_CFLAGS_DEBUG_LEVEL)               $(APP_CFLAGS_WARNINGS)               $(APP_CFLAGS_USER_FLAGS)               $(ALT_CFLAGS)               $(CFLAGS)

# Arguments only for the C++ compiler.
APP_CXXFLAGS := $(ALT_CXXFLAGS) $(CXXFLAGS)

# Arguments only for the C preprocessor.
# Prefix each include directory with -I.
APP_CPPFLAGS := $(APP_INC_DIRS)                 $(ALT_CPPFLAGS)                 $(CPPFLAGS)

# Arguments only for the assembler.
APP_ASFLAGS := $(APP_ASM_INC_DIRS)                $(ALT_ASFLAGS)                $(APP_ASFLAGS_USER)                $(ASFLAGS)

# Arguments only for the linker.
APP_LDFLAGS := 

ifneq ($(LINKER_SCRIPT),)
APP_LDFLAGS += -T'$(LINKER_SCRIPT)'
endif

ifneq ($(CRT0),)
APP_LDFLAGS += -msys-crt0='$(CRT0)'
endif

ifneq ($(SYS_LIB),)
APP_LDFLAGS += -msys-lib=$(SYS_LIB)
endif

APP_LDFLAGS +=            $(APP_LIB_DIRS)            $(ALT_LDFLAGS)            $(LDFLAGS)

LINKER_MAP_NAME := $(APP_NAME).map
ifeq ($(CREATE_LINKER_MAP), 1)
APP_LDFLAGS += -Wl,-Map=$(LINKER_MAP_NAME)
endif

# If SOPC_NAME is not set and QUARTUS_PROJECT_DIR is set, then derive SOPC_NAME.
ifeq ($(SOPC_NAME),)
ifneq ($(QUARTUS_PROJECT_DIR),)
SOPC_NAME := $(basename $(notdir $(wildcard $(QUARTUS_PROJECT_DIR)/*.sopcinfo)))
endif
endif

# If JDI_FILE is not set and QUARTUS_PROJECT_DIR is set, then derive JDI_FILE.
ifeq ($(JDI_FILE),)
ifneq ($(QUARTUS_PROJECT_DIR),)
JDI_FILE := $(wildcard $(QUARTUS_PROJECT_DIR)/*.jdi)
endif
endif


#------------------------------------------------------------------------------
#           MAKEFILE INCLUDES DEPENDENT ON GENERATED CONTENT
#------------------------------------------------------------------------------
# mem_init.mk is a generated makefile fragment. This file defines all targets
# used to generate HDL initialization simulation files and pre-initialized
# onchip memory files.
MEM_INIT_FILE :=  $(BSP_ROOT_DIR)/mem_init.mk
include $(MEM_INIT_FILE)

# Create list of object files to be built using the list of source files.
# The source file hierarchy is preserved in the object tree.
# The supported file extensions are:
#
# .c            - for C files
# .cxx .cc .cpp - for C++ files
# .S .s         - for assembler files
#
# Handle source files specified by --src-dir & --src-rdir differently, to
# save some processing time in calling the adjust-path macro.


OBJ_LIST := $(sort $(C_SRCS:.c=.o)                $(patsubst %.cxx, %.o,                                              $(patsubst %.cc, %.o,                                               $(patsubst %.cpp, %.o, $(CXX_SRCS))))                         $(patsubst %.S, %.o, $(patsubst %.s, %.o, $(ASM_SRCS))))

SDIR_OBJ_LIST := $(sort $(SDIR_C_SRCS:.c=.o)                $(patsubst %.cxx, %.o,                                              $(patsubst %.cc, %.o,                                               $(patsubst %.cpp, %.o, $(SDIR_CXX_SRCS))))                         $(patsubst %.S, %.o, $(patsubst %.s, %.o, $(SDIR_ASM_SRCS))))

# Relative-pathed objects that being with "../" are handled differently.
#
# Regular objects are created as 
#   $(OBJ_ROOT_DIR)/<path>/<filename>.o
# where the path structure is maintained under the obj directory.  This
# applies for both absolute and relative paths; in the absolute path
# case this means the entire source path will be recreated under the obj
# directory.  This is done to allow two source files with the same name
# to be included as part of the project.
#
# Note: On Cygwin, the path recreated under the obj directory will be 
# the cygpath -u output path.
#
# Relative-path objects that begin with "../" cause problems under this 
# scheme, as $(OBJ_ROOT_DIR)/../<rest of path>/ can potentially put the object
# files anywhere in the system, creating clutter and polluting the source tree.
# As such, their paths are flattened - the object file created will be 
# $(OBJ_ROOT_DIR)/<filename>.o.  Due to this, two files specified with 
# "../" in the beginning cannot have the same name in the project.  VPATH 
# will be set for these sources to allow make to relocate the source file 
# via %.o rules.
#
# The following lines separate the object list into the flatten and regular
# lists, and then handles them as appropriate.

FLATTEN_OBJ_LIST += $(strip $(foreach s,$(OBJ_LIST),$(if $(filter ../%,$s),$s)))
REGULAR_OBJ_LIST += $(filter-out $(FLATTEN_OBJ_LIST),$(OBJ_LIST))

FLATTEN_APP_OBJS := $(addprefix $(OBJ_ROOT_DIR)/,             $(foreach s,$(FLATTEN_OBJ_LIST),$(notdir $s)))

FLATTEN_SDIR_OBJ_LIST += $(strip $(foreach s,$(SDIR_OBJ_LIST),$(if $(filter ../%,$s),$s)))
REGULAR_SDIR_OBJ_LIST += $(filter-out $(FLATTEN_SDIR_OBJ_LIST),$(SDIR_OBJ_LIST))

FLATTEN_SDIR_APP_OBJS := $(addprefix $(OBJ_ROOT_DIR)/,             $(foreach s,$(FLATTEN_SDIR_OBJ_LIST),$(notdir $s)))

VPATH := $(sort $(dir $(FLATTEN_OBJ_LIST)) $(dir $(FLATTEN_SDIR_OBJ_LIST)))

APP_OBJS := $(addprefix $(OBJ_ROOT_DIR)/,         $(foreach s,$(REGULAR_OBJ_LIST),$(call adjust-path,$s)))             $(addprefix $(OBJ_ROOT_DIR)/,         $(REGULAR_SDIR_OBJ_LIST))         $(FLATTEN_APP_OBJS) $(FLATTEN_SDIR_APP_OBJS)

# Add any extra user-provided object files.
APP_OBJS += $(OBJS)

# Create list of dependancy files for each object file.
APP_DEPS := $(APP_OBJS:.o=.d)

# Patch the Elf file with system specific information

# Patch the Elf with the name of the sopc system
ifneq ($(SOPC_NAME),)
ELF_PATCH_FLAG += --sopc_system_name $(SOPC_NAME)
endif

# Patch the Elf with the absolute path to the Quartus Project Directory
ifneq ($(QUARTUS_PROJECT_DIR),)
ABS_QUARTUS_PROJECT_DIR := $(call adjust-path-mixed,$(shell cd "$(QUARTUS_PROJECT_DIR)"; pwd))
ELF_PATCH_FLAG += --quartus_project_dir "$(ABS_QUARTUS_PROJECT_DIR)"
endif

# Patch the Elf and download args with the JDI_FILE if specified
ifneq ($(wildcard $(JDI_FILE)),)
ELF_PATCH_FLAG += --jdi $(JDI_FILE)
DOWNLOAD_JDI_FLAG := --jdi $(JDI_FILE)
endif

# Use the DOWNLOAD_CABLE variable to specify which JTAG cable to use. 
# This is not needed if you only have one cable.
ifneq ($(DOWNLOAD_CABLE),)
DOWNLOAD_CABLE_FLAG := --cable '$(DOWNLOAD_CABLE)'
endif

#------------------------------------------------------------------------------
#                           BUILD PRE/POST PROCESS
#------------------------------------------------------------------------------
build_pre_process :
    $(BUILD_PRE_PROCESS)

build_post_process :
    $(BUILD_POST_PROCESS)

.PHONY: build_pre_process build_post_process

#------------------------------------------------------------------------------
#                     PATTERN RULES TO BUILD OBJECTS
#------------------------------------------------------------------------------

$(OBJ_ROOT_DIR)/%.o: %.c
    @$(ECHO) Info: Compiling $< to $@
    @$(MKDIR) $(@D)
    $(CC) -MP -MMD -c $(APP_CPPFLAGS) $(APP_CFLAGS) -o $@ $<
    $(CC_POST_PROCESS)

$(OBJ_ROOT_DIR)/%.o: %.cpp
    @$(ECHO) Info: Compiling $< to $@
    @$(MKDIR) $(@D)
    $(CXX) -MP -MMD -c $(APP_CPPFLAGS) $(APP_CXXFLAGS) $(APP_CFLAGS) -o $@ $<
    $(CXX_POST_PROCESS)

$(OBJ_ROOT_DIR)/%.o: %.cc
    @$(ECHO) Info: Compiling $< to $@
    @$(MKDIR) $(@D)
    $(CXX) -MP -MMD -c $(APP_CPPFLAGS) $(APP_CXXFLAGS) $(APP_CFLAGS) -o $@ $<
    $(CXX_POST_PROCESS)

$(OBJ_ROOT_DIR)/%.o: %.cxx
    @$(ECHO) Info: Compiling $< to $@
    @$(MKDIR) $(@D)
    $(CXX) -MP -MMD -c $(APP_CPPFLAGS) $(APP_CXXFLAGS) $(APP_CFLAGS) -o $@ $<
    $(CXX_POST_PROCESS)

$(OBJ_ROOT_DIR)/%.o: %.S
    @$(ECHO) Info: Assembling $< to $@
    @$(MKDIR) $(@D)
    $(AS) -MP -MMD -c $(APP_CPPFLAGS) $(APP_CFLAGS) $(APP_ASFLAGS) -o $@ $<
    $(AS_POST_PROCESS)

$(OBJ_ROOT_DIR)/%.o: %.s
    @$(ECHO) Info: Assembling $< to $@
    @$(MKDIR) $(@D)
    $(AS) -MP -MMD -c $(APP_CFLAGS) $(APP_ASFLAGS) -o $@ $<
    $(AS_POST_PROCESS)

#------------------------------------------------------------------------------
#                     PATTERN RULES TO INTERMEDIATE FILES
#------------------------------------------------------------------------------

$(OBJ_ROOT_DIR)/%.s: %.c
    @$(ECHO) Info: Compiling $< to $@
    @$(MKDIR) $(@D)
    $(CC) -S $(APP_CPPFLAGS) $(APP_CFLAGS) -o $@ $<

$(OBJ_ROOT_DIR)/%.s: %.cpp
    @$(ECHO) Info: Compiling $< to $@
    @$(MKDIR) $(@D)
    $(CXX) -S $(APP_CPPFLAGS) $(APP_CXXFLAGS) $(APP_CFLAGS) -o $@ $<

$(OBJ_ROOT_DIR)/%.s: %.cc
    @$(ECHO) Info: Compiling $< to $@
    @$(MKDIR) $(@D)
    $(CXX) -S $(APP_CPPFLAGS) $(APP_CXXFLAGS) $(APP_CFLAGS) -o $@ $<

$(OBJ_ROOT_DIR)/%.s: %.cxx
    @$(ECHO) Info: Compiling $< to $@
    @$(MKDIR) $(@D)
    $(CXX) -S $(APP_CPPFLAGS) $(APP_CXXFLAGS) $(APP_CFLAGS) -o $@ $<

$(OBJ_ROOT_DIR)/%.i: %.c
    @$(ECHO) Info: Compiling $< to $@
    @$(MKDIR) $(@D)
    $(CC) -E $(APP_CPPFLAGS) $(APP_CFLAGS) -o $@ $<

$(OBJ_ROOT_DIR)/%.i: %.cpp
    @$(ECHO) Info: Compiling $< to $@
    @$(MKDIR) $(@D)
    $(CXX) -E $(APP_CPPFLAGS) $(APP_CXXFLAGS) $(APP_CFLAGS) -o $@ $<

$(OBJ_ROOT_DIR)/%.i: %.cc
    @$(ECHO) Info: Compiling $< to $@
    @$(MKDIR) $(@D)
    $(CXX) -E $(APP_CPPFLAGS) $(APP_CXXFLAGS) $(APP_CFLAGS) -o $@ $<

$(OBJ_ROOT_DIR)/%.i: %.cxx
    @$(ECHO) Info: Compiling $< to $@
    @$(MKDIR) $(@D)
    $(CXX) -E $(APP_CPPFLAGS) $(APP_CXXFLAGS) $(APP_CFLAGS) -o $@ $<

#------------------------------------------------------------------------------
#                        TARGET RULES
#------------------------------------------------------------------------------

.PHONY : help
help :
    @$(ECHO) "Summary of Makefile targets"
    @$(ECHO) "  Build targets:"
    @$(ECHO) "    all (default)    - Application and all libraries (including BSP)"
    @$(ECHO) "    bsp              - Just the BSP"
    @$(ECHO) "    libs             - All libraries (including BSP)"
    @$(ECHO) "    flash            - All flash files"    
    @$(ECHO) "    mem_init_install - All memory initialization files"
    @$(ECHO) "  Clean targets:"
    @$(ECHO) "    clean_all        - Application and all libraries (including BSP)"
    @$(ECHO) "    clean            - Just the application"
    @$(ECHO) "    clean_bsp        - Just the BSP"
    @$(ECHO) "    clean_libs       - All libraries (including BSP)"
    @$(ECHO) "  Run targets:"
    @$(ECHO) "    download-elf     - Download and run your elf executable"
    @$(ECHO) "    program-flash    - Program flash contents to the board"

# Handy rule to skip making libraries and just make application.
.PHONY : app
app : $(ELF)

ifeq ($(CREATE_OBJDUMP), 1)
app : $(OBJDUMP_NAME)
endif

ifeq ($(CREATE_ELF_DERIVED_FILES),1)
app : elf_derived_files
endif

.PHONY: elf_derived_files
elf_derived_files: mem_init_install

# Handy rule for making just the BSP.
.PHONY : bsp
bsp :
    @$(ECHO) Info: Building $(BSP_ROOT_DIR)
    @$(MAKE) --no-print-directory -C $(BSP_ROOT_DIR)


# Make sure all makeable libraries (including the BSP) are up-to-date.
LIB_TARGETS := $(patsubst %,%-recurs-make-lib,$(MAKEABLE_LIBRARY_ROOT_DIRS))

.PHONY : libs
libs : $(LIB_TARGETS)

ifneq ($(strip $(LIB_TARGETS)),)
$(LIB_TARGETS): %-recurs-make-lib:
    @$(ECHO) Info: Building $*
    $(MAKE) --no-print-directory -C $*
endif

ifneq ($(strip $(APP_LDDEPS)),)
$(APP_LDDEPS): libs
    @true
endif

# Rules to force your project to rebuild or relink
# .force_relink file will cause any application that depends on this project to relink 
# .force_rebuild file will cause this project to rebuild object files
# .force_rebuild_all file will cause this project and any project that depends on this project to rebuild object files

FORCE_RELINK_DEP  := .force_relink
FORCE_REBUILD_DEP := .force_rebuild
FORCE_REBUILD_ALL_DEP := .force_rebuild_all
FORCE_REBUILD_DEP_LIST := $(FORCE_RELINK_DEP) $(FORCE_REBUILD_DEP) $(FORCE_REBUILD_ALL_DEP)

$(FORCE_REBUILD_DEP_LIST):

$(APP_OBJS): $(wildcard $(FORCE_REBUILD_DEP)) $(wildcard $(addsuffix /$(FORCE_REBUILD_ALL_DEP), . $(ALT_LIBRARY_DIRS)))

$(ELF): $(wildcard $(addsuffix /$(FORCE_RELINK_DEP), . $(ALT_LIBRARY_DIRS)))


# Clean just the application.
.PHONY : clean
ifeq ($(CREATE_ELF_DERIVED_FILES),1)
clean : clean_elf_derived_files
endif

clean :
    @$(RM) -r $(ELF) $(OBJDUMP_NAME) $(LINKER_MAP_NAME) $(OBJ_ROOT_DIR) $(FORCE_REBUILD_DEP_LIST)
    @$(ECHO) [$(APP_NAME) clean complete]

# Clean just the BSP.
.PHONY : clean_bsp
clean_bsp :
    @$(ECHO) Info: Cleaning $(BSP_ROOT_DIR)
    @$(MAKE) --no-print-directory -C $(BSP_ROOT_DIR) clean

# Clean all makeable libraries including the BSP.
LIB_CLEAN_TARGETS := $(patsubst %,%-recurs-make-clean-lib,$(MAKEABLE_LIBRARY_ROOT_DIRS))

.PHONY : clean_libs
clean_libs : $(LIB_CLEAN_TARGETS)

ifneq ($(strip $(LIB_CLEAN_TARGETS)),)
$(LIB_CLEAN_TARGETS): %-recurs-make-clean-lib:
    @$(ECHO) Info: Cleaning $*
    $(MAKE) --no-print-directory -C $* clean
endif

# Clean application and all makeable libraries including the BSP.
.PHONY : clean_all
clean_all : clean mem_init_clean clean_libs


# Include the dependency files unless the make goal is performing a clean
# of the application.
ifneq ($(firstword $(MAKECMDGOALS)),clean)
ifneq ($(firstword $(MAKECMDGOALS)),clean_all)
-include $(APP_DEPS)
endif
endif

.PHONY : download-elf
download-elf : $(ELF)
    @$(ECHO) Info: Downloading $(ELF)
    $(DOWNLOAD) --go --cpu_name=$(CPU_NAME) $(DOWNLOAD_CABLE_FLAG) $(SOPC_SYSID_FLAG) $(DOWNLOAD_JDI_FLAG) $(WRITE_GMON_OPTION) $(ELF)

# Delete the target of a rule if it has changed and its commands exit 
# with a nonzero exit status.
.DELETE_ON_ERROR:

# Rules for flash programming commands
PROGRAM_FLASH_SUFFIX := -program
PROGRAM_FLASH_TARGET := $(addsuffix $(PROGRAM_FLASH_SUFFIX), $(FLASH_FILES))

.PHONY : program-flash
program-flash : $(PROGRAM_FLASH_TARGET)

.PHONY : $(PROGRAM_FLASH_TARGET)
$(PROGRAM_FLASH_TARGET) : flash
    @$(ECHO) Info: Programming $(basename $@).flash
    @if [ -z "$($(basename $@)_EPCS_FLAGS)" ];     then         $(ECHO) $(FLASHPROG) $(SOPC_SYSID_FLAG) --base=$($(basename $@)_START) $(basename $@).flash;         $(FLASHPROG) $(DOWNLOAD_CABLE_FLAG) $(SOPC_SYSID_FLAG) --base=$($(basename $@)_START) $(basename $@).flash;     else         $(ECHO) $(FLASHPROG) $(SOPC_SYSID_FLAG) --epcs --base=$($(basename $@)_START) $(basename $@).flash;         $(FLASHPROG) $(DOWNLOAD_CABLE_FLAG) $(SOPC_SYSID_FLAG) --epcs --base=$($(basename $@)_START) $(basename $@).flash;     fi

#------------------------------------------------------------------------------
#                         ELF TARGET RULE
#------------------------------------------------------------------------------
# Rule for constructing the executable elf file.
$(ELF) : $(APP_OBJS) $(LINKER_SCRIPT) $(APP_LDDEPS)
    @$(ECHO) Info: Linking $@
    $(LD) $(APP_LDFLAGS) $(APP_CFLAGS) -o $@ $(filter-out $(CRT0),$(APP_OBJS)) $(APP_LIBS) $(APP_BSP_DEP_LIBS)
ifneq ($(DISABLE_ELFPATCH),1)
    $(ELFPATCH) $@ $(ELF_PATCH_FLAG)
endif
ifneq ($(DISABLE_STACKREPORT),1)
    @$(STACKREPORT) $@
endif

$(OBJDUMP_NAME) : $(ELF)
    @$(ECHO) Info: Creating $@
    $(OBJDUMP) $(OBJDUMP_FLAGS) $< >$@

#------------------------------------------------------------------------------
#                         INFO TARGET RULE
#------------------------------------------------------------------------------
# Rule for printing the name of the elf file
.PHONY: print-elf-name
print-elf-name:
    @$(ECHO) $(ELF)
Makefile_cn
#------------------------------------------------- -----------------------------
#变量追加到由包含的MAKEFILE片段
#------------------------------------------------- -----------------------------

#名单包含目录的,我的编译器选项(-我说时使用)。
#包括的BSP。
ALT_INCLUDE_DIRS :=

#图书馆目录目录- L的链接器选项(- L的添加时使用)。
#包括的BSP。
ALT_LIBRARY_DIRS:=

#图书馆名称目录- 1连接器的选项(- 1使用时添加)。
#包括的BSP。
ALT_LIBRARY_NAMES:=

#图书馆名称目录- msys - lib的连接器的选项(- msys - lib中添加使用时)。
#这些都是可能将设在BSP和依赖于BSP图书馆
#库,反之亦然
ALT_BSP_DEP_LIBRARY_NAMES:=

#名单依赖的连接器。这通常是完整的路径
每个库(*. 1#)文件。
#包括的BSP。
ALT_LDDEPS:=

#名单库根目录,运行make来构建支持他们。
#包括BSP和任何ALT键库。
MAKEABLE_LIBRARY_ROOT_DIRS:=

#通用标志传递给不同类型的输入文件的编译器。
ALT_CFLAGS:=
ALT_CXXFLAGS:=
ALT_CPPFLAGS:=
ALT_ASFLAGS:=
ALT_LDFLAGS:=

#------------------------------------------------- -----------------------------
#工具
#------------------------------------------------- -----------------------------
CROSS_COMPILE:= nios2小精灵,
抄送:= $(CROSS_COMPILE)海湾合作委员会,越野
百二十号:= $(CROSS_COMPILE)gcc的-越野+ +
正如:= $(CROSS_COMPILE)海湾合作委员会
铁:= $(CROSS_COMPILE)河
劳工处:= $(CROSS_COMPILE)克+ +
新墨西哥州:= $(CROSS_COMPILE)纳米
瑞奇:=室- F座
OBJDUMP:= $(CROSS_COMPILE)objdump
Objcopy的:= $(CROSS_COMPILE)Objcopy的
STACKREPORT:= nios2 - stackreport
下载:= nios2下载
FLASHPROG:= nios2闪光程序员
ELFPATCH:= nios2小精灵插入

MKDIR:= mkdir - P的
回响:=回声


#------------------------------------------------- -----------------------------
#的调整路径宏
#
#如果COMSPEC定义,请通过从Windows启动
#Cygwin的。这种调整路径宏称'cygpath - u'的所有
#路径以确保它们被设为可读。
#
#如果COMSPEC没有定义,请从* nix中推出,并没有调整
#是必要的
#------------------------------------------------- -----------------------------

ifdef COMSPEC
调整路径= $(壳cygpath - ü“$ 1”)
调整路径混合= $(壳cygpath米“$ 1”)
其他
调整路径= 1美元
调整路径混合= 1美元
endif

#------------------------------------------------- -----------------------------
#默认目标
#------------------------------------------------- -----------------------------

#把“所有”的规定,包括生成文件碎片前,因为他们可能
#定义规则,我们不想成为其中的一个默认的规则。
。假:所有

所有:
@ $(欧共体)[$(APP_NAME)建立完整]

所有:build_pre_process LIBS技术应用build_post_process


#vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
#生成的设定开始v
#vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv

#开始生成

#允许以下类型的评论工具,以确定'型的目标这个'
#生成文件关联。
#类型:APP_MAKEFILE

#这下面的版本注释说明了使用的工具版本
#生成此生成文件。一个makefile的变量提供了版本。
#ACDS_VERSION:9.1sp1
ACDS_VERSION:= 9.1sp1

#这下面BUILD_NUMBER评论表明生成的工具数量
#用来生成此生成文件。
#BUILD_NUMBER:304


#定义路径申请精灵。
#它可以使用的生成文件的片段,包括他们之前定义。
#
极低频:= u.elf

#之路的C,C + +和汇编源文件。
C_SRCS:= main.c
CXX_SRCS:=
ASM_SRCS:=


#路径的目标文件树的根。
OBJ_ROOT_DIR:= obj的

#选项来控制objdump。
CREATE_OBJDUMP:= 1
OBJDUMP_INCLUDE_SOURCE:= 1
OBJDUMP_FULL_CONTENTS:= 0

#选项来启用/禁用可选文件。
CREATE_ELF_DERIVED_FILES:= 0
CREATE_LINKER_MAP:= 1

为ALT_CFLAGSs#普通论据
APP_CFLAGS_DEFINED_SYMBOLS:=
APP_CFLAGS_UNDEFINED_SYMBOLS:=
APP_CFLAGS_OPTIMIZATION:= - O0
APP_CFLAGS_DEBUG_LEVEL:= -克
APP_CFLAGS_WARNINGS:=墙
APP_CFLAGS_USER_FLAGS:=

APP_ASFLAGS_USER:=

#链接器选项,有默认值分配后,如果不
#指定浏览。
LINKER_SCRIPT:=
CRT0:=
SYS_LIB:=

#定义路径的BSP的根。
BSP_ROOT_DIR:= .. / u_bsp

#应用程序的具体名单,包括目录,目录和库库名
APP_INCLUDE_DIRS:=
APP_LIBRARY_DIRS:=
APP_LIBRARY_NAMES:=

#前和后处理的设置。
BUILD_PRE_PROCESS:=
BUILD_POST_PROCESS:=

QUARTUS_PROJECT_DIR:= ../../


#完生成

#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
#生成的设置完^
#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^


#------------------------------------------------- -----------------------------
#变量依赖于生成的内容
#------------------------------------------------- -----------------------------

ifeq($(BSP_ROOT_DIR),)
$(错误编辑Makefile文件,并提供一个BSP_ROOT_DIR值)
endif

ifeq($(通配符$(BSP_ROOT_DIR)))
$(错误BSP的目录不存在:$(BSP_ROOT_DIR))
endif

#定义{jd1}路径的BSP的根。
ABS_BSP_ROOT_DIR:= $(请调整路径的混合,$(壳光盘“$(BSP_ROOT_DIR)”;密码))

#包括生成文件碎片。定义变量ALT_LIBRARY_ROOT_DIR前
#包括每个片段生成文件,以便它知道自己的道路。
BSP_INCLUDE_FILE:= $(BSP_ROOT_DIR)/ public.mk
ALT_LIBRARY_ROOT_DIR:= $(BSP_ROOT_DIR)
包括$(BSP_INCLUDE_FILE)
#生成C2H将需要此接触的BSP public.mk SOPC的文件,避免在一个BSP的过时的错误使
ABS_BSP_INCLUDE_FILE:= $(ABS_BSP_ROOT_DIR)/ public.mk


#如果BSP的public.mk表明ALT_SIM_OPTIMIZE设置,重命名的ELF
#与RUN_ON_HDL_SIMULATOR_ONLY_它的前缀。
ifneq($(过滤DALT_SIM_OPTIMIZE,$(ALT_CPPFLAGS)))
极低频:= RUN_ON_HDL_SIMULATOR_ONLY_ $(精灵)
endif


#如果BSP的public.mk表明ALT_PROVIDE_GMON设置,添加选项download_elf目标
ifneq($(过滤DALT_PROVIDE_GMON,$(ALT_CPPFLAGS)))
GMON_OUT_FILENAME:= gmon.out
WRITE_GMON_OPTION:= - 写gmon $(GMON_OUT_FILENAME)
endif

#名称极低频应用。
APP_NAME:= $(主档名$(精灵))

#设置为默认值,如果不变量已经设置定义。
ifeq($(LINKER_SCRIPT),)
LINKER_SCRIPT:= $(BSP_LINKER_SCRIPT)
endif
ifeq($(CRT0),)
CRT0:= $(BSP_CRT0)
endif
ifeq($(SYS_LIB),)
SYS_LIB:= $(BSP_SYS_LIB)
endif

OBJDUMP_NAME:= $(APP_NAME)。objdump
OBJDUMP_FLAGS:= - 分解 - 赛姆斯 - 全头
ifeq($(OBJDUMP_INCLUDE_SOURCE),1)
OBJDUMP_FLAGS + = - 源
endif
ifeq($(OBJDUMP_FULL_CONTENTS),1)
OBJDUMP_FLAGS + = - 全内容
endif

#依赖的连接器(*.一个文件)创建名单。
APP_LDDEPS:= $(ALT_LDDEPS)$(LDDEPS)

#以列表和添加所需的前缀。
APP_INC_DIRS:= $(addprefix - 1,$(ALT_INCLUDE_DIRS)$(APP_INCLUDE_DIRS)$(INC_DIRS))
ASM_INC_PREFIX:=娃,,我
APP_ASM_INC_DIRS:= $(addprefix $(ASM_INC_PREFIX),$(ALT_INCLUDE_DIRS)$(APP_INCLUDE_DIRS)$(INC_DIRS))
APP_LIB_DIRS:= $(addprefix - L时,$(ALT_LIBRARY_DIRS)$(APP_LIBRARY_DIRS)$(LIB_DIRS))
APP_LIBS:= $(addprefix - 1,$(ALT_LIBRARY_NAMES)$(APP_LIBRARY_NAMES)$(LIBS技术))
APP_BSP_DEP_LIBS:= $(addprefix - msys - lib的=,$(ALT_BSP_DEP_LIBRARY_NAMES))

为C预处理器#参数的C / C + +的编译器,汇编器和链接器。
APP_CFLAGS:= $(APP_CFLAGS_DEFINED_SYMBOLS)              $(APP_CFLAGS_UNDEFINED_SYMBOLS)              $(APP_CFLAGS_OPTIMIZATION)              $(APP_CFLAGS_DEBUG_LEVEL)              $(APP_CFLAGS_WARNINGS)              $(APP_CFLAGS_USER_FLAGS)              $(ALT_CFLAGS)              $(的CFLAGS)

只为C + +编译器#参数。
APP_CXXFLAGS:= $(ALT_CXXFLAGS)$(CXXFLAGS)

只为C预处理器#参数。
#前缀每个包括目录与-我。
APP_CPPFLAGS:= $(APP_INC_DIRS)                $(ALT_CPPFLAGS)                $(CPPFLAGS)

只为汇编#参数。
APP_ASFLAGS:= $(APP_ASM_INC_DIRS)               $(ALT_ASFLAGS)               $(APP_ASFLAGS_USER)               $(ASFLAGS)

#只适用于连接器的参数。
APP_LDFLAGS:=

ifneq($(LINKER_SCRIPT),)
APP_LDFLAGS + = - T的'$(LINKER_SCRIPT)'
endif

ifneq($(CRT0),)
APP_LDFLAGS + = - msys - crt0 ='$(CRT0)'
endif

ifneq($(SYS_LIB),)
APP_LDFLAGS + = - msys - lib的= $(SYS_LIB)
endif

APP_LDFLAGS + =            $(APP_LIB_DIRS)           $(ALT_LDFLAGS)           $(LDFLAGS)

LINKER_MAP_NAME:= $(APP_NAME)。地图
ifeq($(CREATE_LINKER_MAP),1)
APP_LDFLAGS + = -妻子凡,地图= $(LINKER_MAP_NAME)
endif

#如果SOPC_NAME未设置和QUARTUS_PROJECT_DIR设置,然后得出SOPC_NAME。
ifeq($(SOPC_NAME),)
ifneq($(QUARTUS_PROJECT_DIR),)
SOPC_NAME:= $(主档名$(notdir $(通配符$(QUARTUS_PROJECT_DIR)/ *. sopcinfo)))
endif
endif

#如果JDI_FILE未设置和QUARTUS_PROJECT_DIR设置,然后得出JDI_FILE。
ifeq($(JDI_FILE),)
ifneq($(QUARTUS_PROJECT_DIR),)
JDI_FILE:= $(通配符$(QUARTUS_PROJECT_DIR)/ *.直连盒)
endif
endif


#------------------------------------------------- -----------------------------
#的MAKEFILE包括对生成的内容依赖
#------------------------------------------------- -----------------------------
#mem_init.mk是一个生成的makefile片段。这个文件定义了所有目标
#用来生成HDL仿真初始化文件和预初始化
#onchip内存文件。
MEM_INIT_FILE:= $(BSP_ROOT_DIR)/ mem_init.mk
包括$(MEM_INIT_FILE)

#创建对象的文件清单,建立使用的源文件列表。
#源文件的层次结构是保存在对象树。
#支持的文件扩展名是:
#
#。?对C - 文件
#。百二十号。消委会的。cpp的C + + - 文件
#。查阅全文。S - 可汇编文件
#
#源文件中指定的处理 - 型钢混凝土-迪尔& - 型钢混凝土- rdir不同,以
#调用保存一些调整路径宏处理时间。


OBJ_LIST:= $(排序$(C_SRCS:。? =.海外)              $(patsubst%。百二十号,%。邻,                $(patsubst%。抄送%。邻,                  $(patsubst%。cpp的,%。邻,$(CXX_SRCS))))              $(patsubst%。秒,%。邻,$(patsubst%。秒,%。邻,$(ASM_SRCS))))

SDIR_OBJ_LIST:= $(排序$(SDIR_C_SRCS:。? =.海外)              $(patsubst%。百二十号,%。邻,                $(patsubst%。抄送%。邻,                  $(patsubst%。cpp的,%。邻,$(SDIR_CXX_SRCS))))              $(patsubst%。秒,%。邻,$(patsubst%。秒,%。邻,$(SDIR_ASM_SRCS))))

#相对- pathed,与"../"正在处理不同的对象。
#
#经常创建为对象
#$(OBJ_ROOT_DIR)/ <路径> / <文件名>。?
#其中的路径结构是obj的目录下的维持。这
#适用;的{jd1}和相对路径的{jd1}路径
#情况下,这意味着整个源路径将根据obj的再创造
#目录。这样做是为了让两个同名的源文件
#被列为该项目的一部分。
#
#注:在Cygwin的路径与obj目录下重新将
#的cygpath - u输出路径。
#
#相对路径对象与"../"这个问题的原因正在开始
#的计划,$(OBJ_ROOT_DIR )/../<路径>休息/有可能把对象
#文件系统中的任何位置,创造杂波和污染的源代码树。
因此,他们的路径是扁平# - 将对象创建的文件
#$(OBJ_ROOT_DIR)/文件名>。岛由于这两个文件中指定
在开始#"../"不能在该项目中相同的名称。 VPATH
#将被设置为使这些资源,使搬迁源文件
#通过%。?规则。
#
#以下几行分成了扁平化和经常的对象列表
#名单,然后酌情处理它们。

FLATTEN_OBJ_LIST + = $(带$(的foreach秒,$(OBJ_LIST),$(如果$(过滤../%,$ S)和$ s的)))
REGULAR_OBJ_LIST + = $(过滤出$(FLATTEN_OBJ_LIST),$(OBJ_LIST))

FLATTEN_APP_OBJS:= $(addprefix $(OBJ_ROOT_DIR)/,$(的foreach秒,$(FLATTEN_OBJ_LIST),$(notdir $ s的)))

FLATTEN_SDIR_OBJ_LIST + = $(带$(的foreach秒,$(SDIR_OBJ_LIST),$(如果$(过滤../%,$ S)和$ s的)))
REGULAR_SDIR_OBJ_LIST + = $(过滤出$(FLATTEN_SDIR_OBJ_LIST),$(SDIR_OBJ_LIST))

FLATTEN_SDIR_APP_OBJS:= $(addprefix $(OBJ_ROOT_DIR)/,$(的foreach秒,$(FLATTEN_SDIR_OBJ_LIST),$(notdir $ s的)))

VPATH:= $(排序$(目录$(FLATTEN_OBJ_LIST))$(目录$(FLATTEN_SDIR_OBJ_LIST)))

APP_OBJS:= $(addprefix $(OBJ_ROOT_DIR)/,$(的foreach秒,$(REGULAR_OBJ_LIST),$(呼叫调整路径,$ s的)))            $(addprefix $(OBJ_ROOT_DIR)/,$(REGULAR_SDIR_OBJ_LIST))$(FLATTEN_APP_OBJS)$(FLATTEN_SDIR_APP_OBJS)

#添加任何额外的用户提供的对象文件。
APP_OBJS + = $(OBJS)

#创建的dependancy文件列表为每个对象文件。
APP_DEPS:= $(APP_OBJS:。? =.四)

#补丁与系统的具体信息elf文件

#补丁精灵与SOPC的系统名称
ifneq($(SOPC_NAME),)
ELF_PATCH_FLAG + = - sopc_system_name $(SOPC_NAME)
endif

#补丁埃尔夫的{jd1}路径的Quartus项目目录
ifneq($(QUARTUS_PROJECT_DIR),)
ABS_QUARTUS_PROJECT_DIR:= $(请调整路径的混合,$(壳光盘“$(QUARTUS_PROJECT_DIR)”;密码))
ELF_PATCH_FLAG + = - quartus_project_dir“$(ABS_QUARTUS_PROJECT_DIR)”
endif

#补丁埃尔夫和下载与指定参数,如果指定JDI_FILE
ifneq($(通配符$(JDI_FILE)))
ELF_PATCH_FLAG + = - $直连盒(JDI_FILE)
DOWNLOAD_JDI_FLAG:= - 直连盒$(JDI_FILE)
endif

#使用DOWNLOAD_CABLE变量指定的JTAG电缆使用。
#这是不需要的,如果你只有一条电缆。
ifneq($(DOWNLOAD_CABLE),)
DOWNLOAD_CABLE_FLAG:= - 电缆'$(DOWNLOAD_CABLE)'
endif

#------------------------------------------------- -----------------------------
#建立前/后过程
#------------------------------------------------- -----------------------------
build_pre_process:
$(BUILD_PRE_PROCESS)

build_post_process:
$(BUILD_POST_PROCESS)

。假:build_pre_process build_post_process

#------------------------------------------------- -----------------------------
#模式的规则构建对象
#------------------------------------------------- -----------------------------

$(OBJ_ROOT_DIR)/%。?:%。?
@ $(ECHO)的信息:编译$ <$ @到
@ $(MKDIR)$(@丁)
$(CC)的- MP的MMD的,加元(APP_CPPFLAGS)$(APP_CFLAGS)邻$ @ $ <
$(CC_POST_PROCESS)

$(OBJ_ROOT_DIR)/%。?:%。cpp的
@ $(ECHO)的信息:编译$ <$ @到
@ $(MKDIR)$(@丁)
$(百二十号)- MP的MMD的,加元(APP_CPPFLAGS)$(APP_CXXFLAGS)$(APP_CFLAGS)邻$ @ $ <
$(CXX_POST_PROCESS)

$(OBJ_ROOT_DIR)/%。?:%。毫升
@ $(ECHO)的信息:编译$ <$ @到
@ $(MKDIR)$(@丁)
$(百二十号)- MP的MMD的,加元(APP_CPPFLAGS)$(APP_CXXFLAGS)$(APP_CFLAGS)邻$ @ $ <
$(CXX_POST_PROCESS)

$(OBJ_ROOT_DIR)/%。?:%。百二十号
@ $(ECHO)的信息:编译$ <$ @到
@ $(MKDIR)$(@丁)
$(百二十号)- MP的MMD的,加元(APP_CPPFLAGS)$(APP_CXXFLAGS)$(APP_CFLAGS)邻$ @ $ <
$(CXX_POST_PROCESS)

$(OBJ_ROOT_DIR)/%。?:%。查阅全文
@ $(ECHO)的信息:组装$ <$ @到
@ $(MKDIR)$(@丁)
$(AS)的- MP的MMD的,加元(APP_CPPFLAGS)$(APP_CFLAGS)$(APP_ASFLAGS)邻$ @ $ <
$(AS_POST_PROCESS)

$(OBJ_ROOT_DIR)/%。?:%。查阅全文
@ $(ECHO)的信息:组装$ <$ @到
@ $(MKDIR)$(@丁)
$(AS)的- MP的MMD的,加元(APP_CFLAGS)$(APP_ASFLAGS)邻$ @ $ <
$(AS_POST_PROCESS)

#------------------------------------------------- -----------------------------
#为中间文件格式规则
#------------------------------------------------- -----------------------------

$(OBJ_ROOT_DIR)/%。查阅全文:%。?
@ $(ECHO)的信息:编译$ <$ @到
@ $(MKDIR)$(@丁)
$(CC)的- S的$(APP_CPPFLAGS)$(APP_CFLAGS)邻$ @ $ <

$(OBJ_ROOT_DIR)/%。查阅全文:%。cpp的
@ $(ECHO)的信息:编译$ <$ @到
@ $(MKDIR)$(@丁)
$(百二十号),新加坡元(APP_CPPFLAGS)$(APP_CXXFLAGS)$(APP_CFLAGS)邻$ @ $ <

$(OBJ_ROOT_DIR)/%。查阅全文:%。毫升
@ $(ECHO)的信息:编译$ <$ @到
@ $(MKDIR)$(@丁)
$(百二十号),新加坡元(APP_CPPFLAGS)$(APP_CXXFLAGS)$(APP_CFLAGS)邻$ @ $ <

$(OBJ_ROOT_DIR)/%。查阅全文:%。百二十号
@ $(ECHO)的信息:编译$ <$ @到
@ $(MKDIR)$(@丁)
$(百二十号),新加坡元(APP_CPPFLAGS)$(APP_CXXFLAGS)$(APP_CFLAGS)邻$ @ $ <

$(OBJ_ROOT_DIR)/%。我:%。?
@ $(ECHO)的信息:编译$ <$ @到
@ $(MKDIR)$(@丁)
$(CC)的- E的$(APP_CPPFLAGS)$(APP_CFLAGS)邻$ @ $ <

$(OBJ_ROOT_DIR)/%。我:%。cpp的
@ $(ECHO)的信息:编译$ <$ @到
@ $(MKDIR)$(@丁)
$(百二十号)- E的$(APP_CPPFLAGS)$(APP_CXXFLAGS)$(APP_CFLAGS)邻$ @ $ <

$(OBJ_ROOT_DIR)/%。我:%。毫升
@ $(ECHO)的信息:编译$ <$ @到
@ $(MKDIR)$(@丁)
$(百二十号)- E的$(APP_CPPFLAGS)$(APP_CXXFLAGS)$(APP_CFLAGS)邻$ @ $ <

$(OBJ_ROOT_DIR)/%。我:%。百二十号
@ $(ECHO)的信息:编译$ <$ @到
@ $(MKDIR)$(@丁)
$(百二十号)- E的$(APP_CPPFLAGS)$(APP_CXXFLAGS)$(APP_CFLAGS)邻$ @ $ <

#------------------------------------------------- -----------------------------
#靶规则
#------------------------------------------------- -----------------------------

。假:帮助
帮助:
@ $(欧共体)“的Makefile文件摘要的目标”
@ $(ECHO)的“建设目标:”
@ $(ECHO)的“所有(默认) - 应用与所有的图书馆(包括BSP)的”
@ $(ECHO)的“建华 - 只需的BSP”
@ $(ECHO)的“LIBS技术 - 所有图书馆(包括BSP)的”
@ $(ECHO)的“闪光 - 所有Flash文件”
@ $(ECHO)的“mem_init_install - 所有内存初始化文件”
@ $(ECHO)的“清洁的目标:”
@ $(ECHO)的“clean_all - 应用与所有的图书馆(包括BSP)的”
@ $(ECHO)的“清洁 - 只需申请”
@ $(ECHO)的“clean_bsp - 只需的BSP”
@ $(ECHO)的“clean_libs - 所有图书馆(包括BSP)的”
@ $(ECHO)的“运行目标:”
@ $(ECHO)的“下载小精灵 - 下载并运行可执行文件的小精灵”
@ $(ECHO)的“方案闪光 - 计划内容的闪光板”

#手持规则跳过使得图书馆和公正提出申请。
。假:应用程序
应用程序:$(精灵)

ifeq($(CREATE_OBJDUMP),1)
应用程序:$(OBJDUMP_NAME)
endif

ifeq($(CREATE_ELF_DERIVED_FILES),1)
应用程序:elf_derived_files
endif

。假:elf_derived_files
elf_derived_files:mem_init_install

#作出公正的BSP汉迪的统治。
。假:建华
BSP的:
@ $(ECHO)的信息:建筑$(BSP_ROOT_DIR)
@ $(使) - 无印刷的目录加元(BSP_ROOT_DIR)


#确保所有makeable库(包括BSP)的是{zx1}的更新。
LIB_TARGETS:= $(patsubst%,%,复发,化妆lib中,$(MAKEABLE_LIBRARY_ROOT_DIRS))

。假:LIBS技术
LIBS技术:$(LIB_TARGETS)

ifneq($(带$(LIB_TARGETS)))
$(LIB_TARGETS):%,复发,化妆lib目录:
@ $(ECHO)的信息:建筑$ *
$(使) - 无印刷的目录加元*
endif

ifneq($(带$(APP_LDDEPS)))
$(APP_LDDEPS):LIBS技术
@真
endif

#规则迫使你的项目,以重建或重新链接
#。force_relink文件将导致任何应用程序,这取决于项目的重新链接
#。force_rebuild文件将导致此项目,以重建对象文件
#。force_rebuild_all文件将导致此项目的任何项目,这个项目的重建目标文件依赖

FORCE_RELINK_DEP:=。force_relink
FORCE_REBUILD_DEP:=。force_rebuild
FORCE_REBUILD_ALL_DEP:=。force_rebuild_all
FORCE_REBUILD_DEP_LIST:= $(FORCE_RELINK_DEP)$(FORCE_REBUILD_DEP)$(FORCE_REBUILD_ALL_DEP)

$(FORCE_REBUILD_DEP_LIST):

$(APP_OBJS):$(通配符$(FORCE_REBUILD_DEP))$(通配符$(addsuffix / $(FORCE_REBUILD_ALL_DEP)。$(ALT_LIBRARY_DIRS)))

$(精灵):$(通配符$(addsuffix / $(FORCE_RELINK_DEP)。$(ALT_LIBRARY_DIRS)))


#清洁只是该应用程序。
。假:清洁
ifeq($(CREATE_ELF_DERIVED_FILES),1)
清洁:clean_elf_derived_files
endif

清洁:
@ $(RM)的- R的$(极低频)$(OBJDUMP_NAME)$(LINKER_MAP_NAME)$(OBJ_ROOT_DIR)$(FORCE_REBUILD_DEP_LIST)
@ $(欧共体)[$(APP_NAME)清洁完成]

#清洁公正的BSP。
。假:clean_bsp
clean_bsp:
@ $(ECHO)的信息:清洁$(BSP_ROOT_DIR)
@ $(使) - 无印刷的目录加元(BSP_ROOT_DIR)清洁

#包括清洁所有的BSP makeable库。
LIB_CLEAN_TARGETS:= $(patsubst%,%,复发,使清洁- lib中,$(MAKEABLE_LIBRARY_ROOT_DIRS))

。假:clean_libs
clean_libs:$(LIB_CLEAN_TARGETS)

ifneq($(带$(LIB_CLEAN_TARGETS)))
$(LIB_CLEAN_TARGETS):%,复发,使清洁- lib的:
@ $(ECHO)的信息:清洗$ *
$(使) - 无印刷的目录加元*清洁
endif

#清洁应用外,还包括BSP的所有makeable库。
。假:clean_all
clean_all:清洁mem_init_clean clean_libs


#包含了相关文件,除非目标是使执行干净
#应用程序。
ifneq($(firstword $(MAKECMDGOALS)),清洁)
ifneq($(firstword $(MAKECMDGOALS)),clean_all)
,包括$(APP_DEPS)
endif
endif

。假:下载小精灵
下载小精灵:$(精灵)
@ $(ECHO)的信息:下载$(精灵)
$(下载) - 去 - cpu_name = $(CPU_NAME)$(DOWNLOAD_CABLE_FLAG)$(SOPC_SYSID_FLAG)$(DOWNLOAD_JDI_FLAG)$(WRITE_GMON_OPTION)$(精灵)

#删除一个规则的目标是否已发生变化,其命令退出
#以非零退出状态。
。DELETE_ON_ERROR:

为闪存编程命令#规则
PROGRAM_FLASH_SUFFIX:=计划
PROGRAM_FLASH_TARGET:= $(addsuffix $(PROGRAM_FLASH_SUFFIX),$(FLASH_FILES))

。假:方案闪光
方案闪光:$(PROGRAM_FLASH_TARGET)

。假:$(PROGRAM_FLASH_TARGET)
$(PROGRAM_FLASH_TARGET):闪光
@ $(ECHO)的信息:编程$(主档名$ @)。闪光
@如果[- Z的"$($(的basename $ @)_EPCS_FLAGS)“]; 然后$(欧共体)$(FLASHPROG)$(SOPC_SYSID_FLAG) - 基=$($(的basename $ @)_START)$(主档名$ @)。闪光灯; $(FLASHPROG)$(DOWNLOAD_CABLE_FLAG)$(SOPC_SYSID_FLAG) - 基=$($(的basename $ @)_START)$(主档名$ @)。闪光灯; 其他$(欧共体)$(FLASHPROG)$(SOPC_SYSID_FLAG) - 内皮祖细胞 - 基=$($(的basename $ @)_START)$(主档名$ @)。闪光灯; $(FLASHPROG)$(DOWNLOAD_CABLE_FLAG)$(SOPC_SYSID_FLAG) - 内皮祖细胞 - 基=$($(的basename $ @)_START)$(主档名$ @)。闪光灯; 科幻

#------------------------------------------------- -----------------------------
#极低频靶规则
#------------------------------------------------- -----------------------------
#规则构建可执行ELF文件。
$(精灵):$(APP_OBJS)$(LINKER_SCRIPT)$(APP_LDDEPS)
@ $(ECHO)的信息:将$ @
$(LD)的$(APP_LDFLAGS)$(APP_CFLAGS)邻$ @ $(过滤出$(CRT0),$(APP_OBJS))$(APP_LIBS)$(APP_BSP_DEP_LIBS)
ifneq($(DISABLE_ELFPATCH),1)
$(ELFPATCH)$ @ $(ELF_PATCH_FLAG)
endif
ifneq($(DISABLE_STACKREPORT),1)
@ $(STACKREPORT)$ @
endif

$(OBJDUMP_NAME):$(精灵)
@ $(ECHO)的信息:创建$ @
$(OBJDUMP)$(OBJDUMP_FLAGS)$ <> $ @

#------------------------------------------------- -----------------------------
#信息靶规则
#------------------------------------------------- -----------------------------
#第印制的精灵文件的名称
。假:打印小精灵的名称
打印小精灵的名称:
@ $(欧共体)$(精灵)
郑重声明:资讯 【挂在网上,睡前手机看看;早上删- 小時不識月- 博客园】由 发布,版权归原作者及其所在单位,其原创性以及文中陈述文字和内容未经(企业库qiyeku.com)证实,请读者仅作参考,并请自行核实相关内容。若本文有侵犯到您的版权, 请你提供相关证明及申请并与我们联系(qiyeku # qq.com)或【在线投诉】,我们审核后将会尽快处理。
—— 相关资讯 ——