📄 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 :=# 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 versaALT_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#------------------------------------------------------------------------------CC := nios2-elf-gcc -xcCXX := nios2-elf-gcc -xc++AS := nios2-elf-gccAR := nios2-elf-arLD := nios2-elf-g++NM := nios2-elf-nmRM := rm -fOBJDUMP := nios2-elf-objdumpOBJCOPY := nios2-elf-objcopySTACKREPORT := nios2-stackreportDOWNLOAD := nios2-downloadFLASHPROG := nios2-flash-programmer#------------------------------------------------------------------------------# 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 : allall : build_pre_process libs app build_post_process #vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv# GENERATED SETTINGS START v#vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv#START GENERATED
# Define path to the application ELF. # It may be used by the makefile fragments so is defined before including them. #
ELF := validation.elf
# Paths to C, C++, and assembly source files.
C_SRCS += hardware_routines.c
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 := 1OBJDUMP_INCLUDE_SOURCE := 0OBJDUMP_FULL_CONTENTS := 0
# Options to enable/disable optional files.CREATE_ELF_DERIVED_FILES := 0CREATE_LINKER_MAP := 1
# Common arguments for ALT_CFLAGSs
APP_CFLAGS_DEFINED_SYMBOLS := -DALT_DEBUG
APP_CFLAGS_UNDEFINED_SYMBOLS :=
APP_CFLAGS_OPTIMIZATION := -O3
APP_CFLAGS_DEBUG_LEVEL := -g
APP_CFLAGS_WARNINGS := -Wall
APP_CFLAGS_USER_FLAGS := -mcustom-fwrx=0xF -mcustom-fwry=0xE -mcustom-frdxlo=0xC -mcustom-frdxhi=0xD -mcustom-frdy=0xB -mcustom-faddd=0xA -mcustom-fsubd=0x9 -mcustom-fmuld=0x8 -mcustom-fdivd=0x7 -mcustom-fadds=0x6 -mcustom-fsubs=0x5 -mcustom-fmuls=0x4 -mcustom-fdivs=0x3 -mcustom-ftruncds=0x1B -mcustom-fextsd=0x1A -mcustom-fixdu=0x19 -mcustom-fixdi=0x18 -mcustom-floatud=0x17 -mcustom-floatid=0x16 -mcustom-fcmpned=0x15 -mcustom-fcmpeqd=0x14 -mcustom-fcmpged=0x13 -mcustom-fcmpgtd=0x12 -mcustom-fcmpled=0x11 -mcustom-fcmpltd=0x10
# 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 := ../../bsp/hal_default
# Define absolute path to the root of the BSP.
ABS_BSP_ROOT_DIR := $(shell cd "$(BSP_ROOT_DIR)"; pwd)
ifeq ($(BSP_ROOT_DIR),)$(error Edit Makefile and provide a value for BSP_ROOT_DIR)endif
# 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.mkALT_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 makeABS_BSP_INCLUDE_FILE := $(ABS_BSP_ROOT_DIR)/public.mk
# 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 :=
OBJDUMP_INCLUDE_SOURCE := 1
#END GENERATED#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^# GENERATED SETTINGS END ^#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^#------------------------------------------------------------------------------# VARIABLES DEPENDENT ON GENERATED CONTENT#------------------------------------------------------------------------------# 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 targetifneq ($(filter -DALT_PROVIDE_GMON,$(ALT_CPPFLAGS)),)GMON_OUT_FILENAME := gmon.outWRITE_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)endififeq ($(CRT0),)CRT0 := $(BSP_CRT0)endififeq ($(SYS_LIB),)SYS_LIB := $(BSP_SYS_LIB)endifOBJDUMP_NAME := $(APP_NAME).objdumpOBJDUMP_FLAGS := --disassemble --syms --all-headerifeq ($(OBJDUMP_INCLUDE_SOURCE),1)OBJDUMP_FLAGS += --sourceendififeq ($(OBJDUMP_FULL_CONTENTS),1)OBJDUMP_FLAGS += --full-contentsendif# 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,-IAPP_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) \ $(ASFLAGS)# Arguments only for the linker.APP_LDFLAGS := \ -msys-crt0='$(CRT0)' \ -msys-lib=$(SYS_LIB) \ $(APP_LIB_DIRS) \ $(ALT_LDFLAGS) \ $(LDFLAGS)LINKER_MAP_NAME := $(APP_NAME).mapifeq ($(CREATE_LINKER_MAP), 1)APP_LDFLAGS += -Wl,-Map=$(LINKER_MAP_NAME)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.mkinclude $(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 filesOBJ_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))))# 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 necessaryifdef COMSPEC adjust-path = $(shell cygpath -u "$1")else adjust-path = $1endif# Relative-pathed objects that being with "../" are handled differently.#
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -