OpenCores
URL https://opencores.org/ocsvn/openmsp430/openmsp430/trunk

Subversion Repositories openmsp430

[/] [openmsp430/] [trunk/] [fpga/] [altera_de0_nano_soc/] [doc/] [Terasic/] [DE0_NANO_SOC/] [Demonstrations/] [FPGA/] [DE0_NANO_SOC_ADC/] [software/] [DE0_NANO_SOC_ADC_bsp/] [Makefile] - Blame information for rev 221

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 221 olivier.gi
#------------------------------------------------------------------------------
2
#                                BSP MAKEFILE
3
#
4
# This makefile was automatically generated by the nios2-bsp-generate-files
5
# command. Its purpose is to build a custom Board Support Package (BSP)
6
# targeting a specific Nios II processor in an SOPC Builder-based design.
7
#
8
# To create an application or library Makefile which uses this BSP, try the
9
# nios2-app-generate-makefile or nios2-lib-generate-makefile commands.
10
#------------------------------------------------------------------------------
11
 
12
#------------------------------------------------------------------------------
13
#                                 TOOLS
14
#------------------------------------------------------------------------------
15
 
16
MKDIR := mkdir -p
17
ECHO := echo
18
SPACE := $(empty) $(empty)
19
 
20
#------------------------------------------------------------------------------
21
#                         The adjust-path macro
22
#
23
# If COMSPEC is defined, Make is launched from Windows through
24
# Cygwin.  This adjust-path macro will call 'cygpath -u' on all
25
# paths to ensure they are readable by Make.
26
#
27
# If COMSPEC is not defined, Make is launched from *nix, and no adjustment
28
# is necessary
29
#------------------------------------------------------------------------------
30
 
31
ifndef COMSPEC
32
ifdef ComSpec
33
COMSPEC = $(ComSpec)
34
endif # ComSpec
35
endif # !COMSPEC
36
 
37
ifdef COMSPEC
38
        adjust-path = $(subst $(SPACE),\$(SPACE),$(shell cygpath -u "$1"))
39
        adjust-path-mixed = $(subst $(SPACE),\$(SPACE),$(shell cygpath -m "$1"))
40
else
41
        adjust-path = $(subst $(SPACE),\$(SPACE),$1)
42
        adjust-path-mixed = $(subst $(SPACE),\$(SPACE),$1)
43
endif
44
 
45
#------------------------------------------------------------------------------
46
#                               DEFAULT TARGET
47
#
48
# The default target, "all", must appear before any other target in the
49
# Makefile. Note that extra prerequisites are added to the "all" rule later.
50
#------------------------------------------------------------------------------
51
.PHONY: all
52
all:
53
        @$(ECHO) [BSP build complete]
54
 
55
 
56
#------------------------------------------------------------------------------
57
#                           PATHS & DIRECTORY NAMES
58
#
59
# Explicitly locate absolute path of the BSP root
60
#------------------------------------------------------------------------------
61
 
62
BSP_ROOT_DIR := .
63
 
64
# Define absolute path to the root of the BSP.
65
ABS_BSP_ROOT := $(call adjust-path-mixed,$(shell pwd))
66
 
67
# Stash all BSP object files here
68
OBJ_DIR := ./obj
69
 
70
 
71
#------------------------------------------------------------------------------
72
#                              MANAGED CONTENT
73
#
74
# All content between the lines "START MANAGED" and "END MANAGED" below is
75
# generated based on variables in the BSP settings file when the
76
# nios2-bsp-generate-files command is invoked. If you wish to persist any
77
# information pertaining to the build process, it is recomended that you
78
# utilize the BSP settings mechanism to do so.
79
#
80
# Note that most variable assignments in this section have a corresponding BSP
81
# setting that can be changed by using the nios2-bsp-create-settings or
82
# nios2-bsp-update-settings command before nios2-bsp-generate-files; if you
83
# want any variable set to a specific value when this Makefile is re-generated
84
# (to prevent hand-edits from being over-written), use the BSP settings
85
# facilities above.
86
#------------------------------------------------------------------------------
87
 
88
#START MANAGED
89
 
90
# The following TYPE comment allows tools to identify the 'type' of target this
91
# makefile is associated with.
92
# TYPE: BSP_PRIVATE_MAKEFILE
93
 
94
# This following VERSION comment indicates the version of the tool used to
95
# generate this makefile. A makefile variable is provided for VERSION as well.
96
# ACDS_VERSION: 14.0
97
ACDS_VERSION := 14.0
98
 
99
# This following BUILD_NUMBER comment indicates the build number of the tool
100
# used to generate this makefile.
101
# BUILD_NUMBER: 209
102
 
103
SETTINGS_FILE := settings.bsp
104
SOPC_FILE := ../../DE0_NANO_SOC_QSYS.sopcinfo
105
 
106
#-------------------------------------------------------------------------------
107
#                             TOOL & COMMAND DEFINITIONS
108
#
109
# The base command for each build operation are expressed here. Additional
110
# switches may be expressed here. They will run for all instances of the
111
# utility.
112
#-------------------------------------------------------------------------------
113
 
114
# Archiver command. Creates library files.
115
AR = nios2-elf-ar
116
 
117
# Assembler command. Note that CC is used for .S files.
118
AS = nios2-elf-gcc
119
 
120
# Custom flags only passed to the archiver. This content of this variable is
121
# directly passed to the archiver rather than the more standard "ARFLAGS". The
122
# reason for this is that GNU Make assumes some default content in ARFLAGS.
123
# This setting defines the value of BSP_ARFLAGS in Makefile.
124
BSP_ARFLAGS = -src
125
 
126
# Custom flags only passed to the assembler. This setting defines the value of
127
# BSP_ASFLAGS in Makefile.
128
BSP_ASFLAGS = -Wa,-gdwarf2
129
 
130
# C/C++ compiler debug level. '-g' provides the default set of debug symbols
131
# typically required to debug a typical application. Omitting '-g' removes
132
# debug symbols from the ELF. This setting defines the value of
133
# BSP_CFLAGS_DEBUG in Makefile.
134
BSP_CFLAGS_DEBUG = -g
135
 
136
# C/C++ compiler optimization level. "-O0" = no optimization,"-O2" = "normal"
137
# optimization, etc. "-O0" is recommended for code that you want to debug since
138
# compiler optimization can remove variables and produce non-sequential
139
# execution of code while debugging. This setting defines the value of
140
# BSP_CFLAGS_OPTIMIZATION in Makefile.
141
BSP_CFLAGS_OPTIMIZATION = -O0
142
 
143
# C/C++ compiler warning level. "-Wall" is commonly used.This setting defines
144
# the value of BSP_CFLAGS_WARNINGS in Makefile.
145
BSP_CFLAGS_WARNINGS = -Wall
146
 
147
# C compiler command.
148
CC = nios2-elf-gcc -xc
149
 
150
# C++ compiler command.
151
CXX = nios2-elf-gcc -xc++
152
 
153
# Command used to remove files during 'clean' target.
154
RM = rm -f
155
 
156
 
157
#-------------------------------------------------------------------------------
158
#                         BUILD PRE & POST PROCESS COMMANDS
159
#
160
# The following variables are treated as shell commands in the rule
161
# definitions for each file-type associated with the BSP build, as well as
162
# commands run at the beginning and end of the entire BSP build operation.
163
# Pre-process commands are executed before the relevant command (for example,
164
# a command defined in the "CC_PRE_PROCESS" variable executes before the C
165
# compiler for building .c files), while post-process commands are executed
166
# immediately afterwards.
167
#
168
# You can view each pre/post-process command in the "Build Rules: All &
169
# Clean", "Pattern Rules to Build Objects", and "Library Rules" sections of
170
# this Makefile.
171
#-------------------------------------------------------------------------------
172
 
173
 
174
#-------------------------------------------------------------------------------
175
#                     BSP SOURCE BUILD SETTINGS (FLAG GENERATION)
176
#
177
# Software build settings such as compiler optimization, debug level, warning
178
# flags, etc., may be defined in the following variables. The variables below
179
# are concatenated together in the 'Flags' section of this Makefile to form
180
# final variables of flags passed to the build tools.
181
#
182
# These settings are considered private to the BSP and apply to all library &
183
# driver files in it; they do NOT automatically propagate to, for example, the
184
# build settings for an application.
185
# # For additional detail and syntax requirements, please refer to GCC help
186
# (example: "nios2-elf-gcc --help --verbose").
187
#
188
# Unless indicated otherwise, multiple entries in each variable should be
189
# space-separated.
190
#-------------------------------------------------------------------------------
191
 
192
# Altera HAL alt_sys_init.c generated source file
193
GENERATED_C_FILES := $(ABS_BSP_ROOT)/alt_sys_init.c
194
GENERATED_C_LIB_SRCS += alt_sys_init.c
195
 
196
 
197
#-------------------------------------------------------------------------------
198
#                            BSP SOURCE FILE LISTING
199
#
200
# All source files that comprise the BSP are listed here, along with path
201
# information to each file expressed relative to the BSP root. The precise
202
# list and location of each file is derived from the driver, operating system,
203
# or software package source file declarations.
204
#
205
# Following specification of the source files for each component, driver, etc.,
206
# each source file type (C, assembly, etc.) is concatenated together and used
207
# to construct a list of objects. Pattern rules to build each object are then
208
# used to build each file.
209
#-------------------------------------------------------------------------------
210
 
211
# altera_avalon_jtag_uart_driver sources root
212
altera_avalon_jtag_uart_driver_SRCS_ROOT := drivers
213
 
214
# altera_avalon_jtag_uart_driver sources
215
altera_avalon_jtag_uart_driver_C_LIB_SRCS := \
216
        $(altera_avalon_jtag_uart_driver_SRCS_ROOT)/src/altera_avalon_jtag_uart_init.c \
217
        $(altera_avalon_jtag_uart_driver_SRCS_ROOT)/src/altera_avalon_jtag_uart_read.c \
218
        $(altera_avalon_jtag_uart_driver_SRCS_ROOT)/src/altera_avalon_jtag_uart_write.c \
219
        $(altera_avalon_jtag_uart_driver_SRCS_ROOT)/src/altera_avalon_jtag_uart_ioctl.c \
220
        $(altera_avalon_jtag_uart_driver_SRCS_ROOT)/src/altera_avalon_jtag_uart_fd.c
221
 
222
# altera_avalon_pio_driver sources root
223
altera_avalon_pio_driver_SRCS_ROOT := drivers
224
 
225
# altera_avalon_pio_driver sources
226
# altera_avalon_sysid_qsys_driver sources root
227
altera_avalon_sysid_qsys_driver_SRCS_ROOT := drivers
228
 
229
# altera_avalon_sysid_qsys_driver sources
230
altera_avalon_sysid_qsys_driver_C_LIB_SRCS := \
231
        $(altera_avalon_sysid_qsys_driver_SRCS_ROOT)/src/altera_avalon_sysid_qsys.c
232
 
233
# altera_nios2_qsys_hal_driver sources root
234
altera_nios2_qsys_hal_driver_SRCS_ROOT := HAL
235
 
236
# altera_nios2_qsys_hal_driver sources
237
altera_nios2_qsys_hal_driver_C_LIB_SRCS := \
238
        $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/altera_nios2_qsys_irq.c \
239
        $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/alt_usleep.c \
240
        $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/alt_busy_sleep.c \
241
        $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/alt_irq_vars.c \
242
        $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/alt_icache_flush.c \
243
        $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/alt_icache_flush_all.c \
244
        $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/alt_dcache_flush.c \
245
        $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/alt_dcache_flush_all.c \
246
        $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/alt_dcache_flush_no_writeback.c \
247
        $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/alt_ecc_fatal_exception.c \
248
        $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/alt_instruction_exception_entry.c \
249
        $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/alt_irq_register.c \
250
        $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/alt_iic.c \
251
        $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/alt_remap_cached.c \
252
        $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/alt_remap_uncached.c \
253
        $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/alt_uncached_free.c \
254
        $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/alt_uncached_malloc.c \
255
        $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/alt_do_ctors.c \
256
        $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/alt_do_dtors.c \
257
        $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/alt_gmon.c
258
 
259
altera_nios2_qsys_hal_driver_ASM_LIB_SRCS := \
260
        $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/alt_ecc_fatal_entry.S \
261
        $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/alt_exception_entry.S \
262
        $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/alt_exception_trap.S \
263
        $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/alt_exception_muldiv.S \
264
        $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/alt_irq_entry.S \
265
        $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/alt_software_exception.S \
266
        $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/alt_mcount.S \
267
        $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/alt_log_macro.S \
268
        $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/crt0.S
269
 
270
# hal sources root
271
hal_SRCS_ROOT := HAL
272
 
273
# hal sources
274
hal_C_LIB_SRCS := \
275
        $(hal_SRCS_ROOT)/src/alt_alarm_start.c \
276
        $(hal_SRCS_ROOT)/src/alt_close.c \
277
        $(hal_SRCS_ROOT)/src/alt_dev.c \
278
        $(hal_SRCS_ROOT)/src/alt_dev_llist_insert.c \
279
        $(hal_SRCS_ROOT)/src/alt_dma_rxchan_open.c \
280
        $(hal_SRCS_ROOT)/src/alt_dma_txchan_open.c \
281
        $(hal_SRCS_ROOT)/src/alt_environ.c \
282
        $(hal_SRCS_ROOT)/src/alt_env_lock.c \
283
        $(hal_SRCS_ROOT)/src/alt_errno.c \
284
        $(hal_SRCS_ROOT)/src/alt_execve.c \
285
        $(hal_SRCS_ROOT)/src/alt_exit.c \
286
        $(hal_SRCS_ROOT)/src/alt_fcntl.c \
287
        $(hal_SRCS_ROOT)/src/alt_fd_lock.c \
288
        $(hal_SRCS_ROOT)/src/alt_fd_unlock.c \
289
        $(hal_SRCS_ROOT)/src/alt_find_dev.c \
290
        $(hal_SRCS_ROOT)/src/alt_find_file.c \
291
        $(hal_SRCS_ROOT)/src/alt_flash_dev.c \
292
        $(hal_SRCS_ROOT)/src/alt_fork.c \
293
        $(hal_SRCS_ROOT)/src/alt_fs_reg.c \
294
        $(hal_SRCS_ROOT)/src/alt_fstat.c \
295
        $(hal_SRCS_ROOT)/src/alt_get_fd.c \
296
        $(hal_SRCS_ROOT)/src/alt_getchar.c \
297
        $(hal_SRCS_ROOT)/src/alt_getpid.c \
298
        $(hal_SRCS_ROOT)/src/alt_gettod.c \
299
        $(hal_SRCS_ROOT)/src/alt_iic_isr_register.c \
300
        $(hal_SRCS_ROOT)/src/alt_instruction_exception_register.c \
301
        $(hal_SRCS_ROOT)/src/alt_ioctl.c \
302
        $(hal_SRCS_ROOT)/src/alt_io_redirect.c \
303
        $(hal_SRCS_ROOT)/src/alt_irq_handler.c \
304
        $(hal_SRCS_ROOT)/src/alt_isatty.c \
305
        $(hal_SRCS_ROOT)/src/alt_kill.c \
306
        $(hal_SRCS_ROOT)/src/alt_link.c \
307
        $(hal_SRCS_ROOT)/src/alt_load.c \
308
        $(hal_SRCS_ROOT)/src/alt_log_printf.c \
309
        $(hal_SRCS_ROOT)/src/alt_lseek.c \
310
        $(hal_SRCS_ROOT)/src/alt_main.c \
311
        $(hal_SRCS_ROOT)/src/alt_malloc_lock.c \
312
        $(hal_SRCS_ROOT)/src/alt_open.c \
313
        $(hal_SRCS_ROOT)/src/alt_printf.c \
314
        $(hal_SRCS_ROOT)/src/alt_putchar.c \
315
        $(hal_SRCS_ROOT)/src/alt_putstr.c \
316
        $(hal_SRCS_ROOT)/src/alt_read.c \
317
        $(hal_SRCS_ROOT)/src/alt_release_fd.c \
318
        $(hal_SRCS_ROOT)/src/alt_rename.c \
319
        $(hal_SRCS_ROOT)/src/alt_sbrk.c \
320
        $(hal_SRCS_ROOT)/src/alt_settod.c \
321
        $(hal_SRCS_ROOT)/src/alt_stat.c \
322
        $(hal_SRCS_ROOT)/src/alt_tick.c \
323
        $(hal_SRCS_ROOT)/src/alt_times.c \
324
        $(hal_SRCS_ROOT)/src/alt_unlink.c \
325
        $(hal_SRCS_ROOT)/src/alt_wait.c \
326
        $(hal_SRCS_ROOT)/src/alt_write.c
327
 
328
 
329
# Assemble all component C source files
330
COMPONENT_C_LIB_SRCS += \
331
        $(altera_avalon_jtag_uart_driver_C_LIB_SRCS) \
332
        $(altera_avalon_sysid_qsys_driver_C_LIB_SRCS) \
333
        $(altera_nios2_qsys_hal_driver_C_LIB_SRCS) \
334
        $(hal_C_LIB_SRCS)
335
 
336
# Assemble all component assembly source files
337
COMPONENT_ASM_LIB_SRCS += \
338
        $(altera_nios2_qsys_hal_driver_ASM_LIB_SRCS)
339
 
340
# Assemble all component C++ source files
341
COMPONENT_CPP_LIB_SRCS += \
342
 
343
#END MANAGED
344
 
345
#------------------------------------------------------------------------------
346
#                                 PUBLIC.MK
347
#
348
# The generated public.mk file contains BSP information that is shared with
349
# other external makefiles, such as a Nios II application makefile. System-
350
# dependent information such as hardware-specific compiler flags and
351
# simulation file generation are stored here.
352
#
353
# In addition, public.mk contains include paths that various software,
354
# such as a device driver, may need for the C compiler. These paths are
355
# written to public.mk with respect to the BSP root. In public.mk, each
356
# path is prefixed with a special variable, $(ALT_LIBRARY_ROOT_DIR). The
357
# purpose of this variable is to allow an external Makefile to append on
358
# path information to precisely locate paths expressed in public.mk
359
# Since this is the BSP Makefile, we set ALT_LIBRARY_ROOT_DIR to point right
360
# here ("."), at the BSP root.
361
#
362
# ALT_LIBRARY_ROOT_DIR must always be set before public.mk is included.
363
#------------------------------------------------------------------------------
364
ALT_LIBRARY_ROOT_DIR := .
365
include public.mk
366
 
367
 
368
#------------------------------------------------------------------------------
369
#                                FLAGS
370
#
371
# Include paths for BSP files are written into the public.mk file and must
372
# be added to the existing list of pre-processor flags. In addition, "hooks"
373
# for standard flags left intentionally empty (CFLAGS, CPPFLAGS, ASFLAGS,
374
# and CXXFLAGS) are provided for conveniently adding to the relevant flags
375
# on the command-line or via script that calls make.
376
#------------------------------------------------------------------------------
377
# Assemble final list of compiler flags from generated content
378
BSP_CFLAGS += \
379
  $(BSP_CFLAGS_DEFINED_SYMBOLS) \
380
  $(BSP_CFLAGS_UNDEFINED_SYMBOLS) \
381
  $(BSP_CFLAGS_OPTIMIZATION) \
382
  $(BSP_CFLAGS_DEBUG) \
383
  $(BSP_CFLAGS_WARNINGS) \
384
  $(BSP_CFLAGS_USER_FLAGS) \
385
  $(ALT_CFLAGS) \
386
  $(CFLAGS)
387
 
388
# Make ready the final list of include directories and other C pre-processor
389
# flags. Each include path is made ready by prefixing it with "-I".
390
BSP_CPPFLAGS += \
391
  $(addprefix -I, $(BSP_INC_DIRS)) \
392
  $(addprefix -I, $(ALT_INCLUDE_DIRS)) \
393
  $(ALT_CPPFLAGS) \
394
  $(CPPFLAGS)
395
 
396
# Finish off assembler flags with any user-provided flags
397
BSP_ASFLAGS += $(ASFLAGS)
398
 
399
# Finish off C++ flags with any user-provided flags
400
BSP_CXXFLAGS += $(CXXFLAGS)
401
 
402
# And finally, the ordered list
403
C_SRCS += $(GENERATED_C_LIB_SRCS) \
404
          $(COMPONENT_C_LIB_SRCS)
405
 
406
CXX_SRCS += $(GENERATED_CPP_LIB_SRCS) \
407
          $(COMPONENT_CPP_LIB_SRCS)
408
 
409
ASM_SRCS += $(GENERATED_ASM_LIB_SRCS) \
410
            $(COMPONENT_ASM_LIB_SRCS)
411
 
412
 
413
#------------------------------------------------------------------------------
414
#                         LIST OF GENERATED FILES
415
#
416
# A Nios II BSP relies on the generation of several source files used
417
# by both the BSP and any applications referencing the BSP.
418
#------------------------------------------------------------------------------
419
 
420
 
421
GENERATED_H_FILES := $(ABS_BSP_ROOT)/system.h
422
 
423
GENERATED_LINKER_SCRIPT := $(ABS_BSP_ROOT)/linker.x
424
 
425
GENERATED_FILES += $(GENERATED_H_FILES) \
426
                   $(GENERATED_LINKER_SCRIPT)
427
 
428
 
429
#------------------------------------------------------------------------------
430
#                        SETUP TO BUILD OBJECTS
431
#
432
# List of object files which are to be built. This is constructed from the input
433
# list of C source files (C_SRCS), C++ source files (CXX_SRCS), and assembler
434
# source file (ASM_SRCS). The permitted file extensions are:
435
#
436
# .c .C                       - for C files
437
# .cxx .cc .cpp .CXX .CC .CPP - for C++ files
438
# .S .s                       - for assembly files
439
#
440
# Extended description: The list of objects is a sorted list (duplicates
441
# removed) of all possible objects, placed beneath the ./obj directory,
442
# including any path information stored in the "*_SRCS" variable. The
443
# "patsubst" commands are used to concatenate together multiple file suffix
444
# types for common files (i.e. c++ as .cxx, .cc, .cpp).
445
#
446
# File extensions are case-insensitive in build rules with the exception of
447
# assembly sources. Nios II assembly sources with the ".S" extension are first
448
# run through the C preprocessor. Sources with the ".s" extension are not.
449
#------------------------------------------------------------------------------
450
OBJS = $(sort $(addprefix $(OBJ_DIR)/,                                        \
451
               $(patsubst %.c, %.o,   $(patsubst %.C, %.o, $(C_SRCS)))        \
452
               $(patsubst %.cxx, %.o, $(patsubst %.CXX, %.o,                  \
453
               $(patsubst %.cc, %.o,  $(patsubst %.CC, %.o,                   \
454
               $(patsubst %.cpp, %.o, $(patsubst %.CPP, %.o,                  \
455
                 $(CXX_SRCS) ))))))                                           \
456
               $(patsubst %.S, %.o, $(patsubst %.s, %.o, $(ASM_SRCS))) ))
457
 
458
# List of dependancy files for each object file.
459
DEPS = $(OBJS:.o=.d)
460
 
461
 
462
# Rules to force your project to rebuild or relink
463
# .force_relink file will cause any application that depends on this project to relink
464
# .force_rebuild file will cause this project to rebuild object files
465
# .force_rebuild_all file will cause this project and any project that depends on this project to rebuild object files
466
 
467
FORCE_RELINK_DEP  := .force_relink
468
FORCE_REBUILD_DEP := .force_rebuild
469
FORCE_REBUILD_ALL_DEP := .force_rebuild_all
470
FORCE_REBUILD_DEP_LIST := $(FORCE_RELINK_DEP) $(FORCE_REBUILD_DEP) $(FORCE_REBUILD_ALL_DEP)
471
 
472
$(FORCE_REBUILD_DEP_LIST):
473
 
474
$(OBJS): $(wildcard $(FORCE_REBUILD_DEP)) $(wildcard $(FORCE_REBUILD_ALL_DEP))
475
 
476
 
477
#------------------------------------------------------------------------------
478
#                          BUILD RULES: ALL & CLEAN
479
#------------------------------------------------------------------------------
480
.DELETE_ON_ERROR:
481
 
482
.PHONY: all
483
all: build_pre_process
484
all: Makefile $(GENERATED_FILES) $(BSP_LIB) $(NEWLIB_DIR)
485
all: build_post_process
486
 
487
 
488
# clean: remove .o/.a/.d
489
.PHONY: clean
490
clean:
491
        @$(RM) -r $(BSP_LIB) $(OBJ_DIR) $(FORCE_REBUILD_DEP_LIST)
492
ifneq ($(wildcard $(NEWLIB_DIR)),)
493
        @$(RM) -r $(NEWLIB_DIR)
494
endif
495
        @$(ECHO) [BSP clean complete]
496
 
497
 
498
#------------------------------------------------------------------------------
499
#                           BUILD PRE/POST PROCESS
500
#------------------------------------------------------------------------------
501
build_pre_process :
502
        $(BUILD_PRE_PROCESS)
503
 
504
build_post_process :
505
        $(BUILD_POST_PROCESS)
506
 
507
.PHONY: build_pre_process build_post_process
508
 
509
 
510
 
511
#------------------------------------------------------------------------------
512
#                             MAKEFILE UP TO DATE?
513
#
514
# Is this very Makefile up to date? Someone may have changed the BSP settings
515
# file or the associated target hardware.
516
#------------------------------------------------------------------------------
517
# Skip this check when clean is the only target
518
ifneq ($(MAKECMDGOALS),clean)
519
 
520
ifneq ($(wildcard $(SETTINGS_FILE)),$(SETTINGS_FILE))
521
$(warning Warning: BSP Settings File $(SETTINGS_FILE) could not be found.)
522
endif
523
 
524
Makefile: $(wildcard $(SETTINGS_FILE))
525
        @$(ECHO) Makefile not up to date.
526
        @$(ECHO) $(SETTINGS_FILE) has been modified since the BSP Makefile was generated.
527
        @$(ECHO)
528
        @$(ECHO) Generate the BSP to update the Makefile, and then build again.
529
        @$(ECHO)
530
        @$(ECHO) To generate from Eclipse:
531
        @$(ECHO) " 1. Right-click the BSP project."
532
        @$(ECHO) " 2. In the Nios II Menu, click Generate BSP."
533
        @$(ECHO)
534
        @$(ECHO) To generate from the command line:
535
        @$(ECHO) " nios2-bsp-generate-files --settings= --bsp-dir="
536
        @$(ECHO)
537
        @exit 1
538
 
539
ifneq ($(wildcard $(SOPC_FILE)),$(SOPC_FILE))
540
$(warning Warning: SOPC File $(SOPC_FILE) could not be found.)
541
endif
542
 
543
public.mk: $(wildcard $(SOPC_FILE))
544
        @$(ECHO) Makefile not up to date.
545
        @$(ECHO) $(SOPC_FILE) has been modified since the BSP was generated.
546
        @$(ECHO)
547
        @$(ECHO) Generate the BSP to update the Makefile, and then build again.
548
        @$(ECHO)
549
        @$(ECHO) To generate from Eclipse:
550
        @$(ECHO) " 1. Right-click the BSP project."
551
        @$(ECHO) " 2. In the Nios II Menu, click Generate BSP."
552
        @$(ECHO)
553
        @$(ECHO) To generate from the command line:
554
        @$(ECHO) " nios2-bsp-generate-files --settings= --bsp-dir="
555
        @$(ECHO)
556
        @exit 1
557
 
558
endif # $(MAKECMDGOALS) != clean
559
 
560
#------------------------------------------------------------------------------
561
#                     PATTERN RULES TO BUILD OBJECTS
562
#------------------------------------------------------------------------------
563
$(OBJ_DIR)/%.o: %.c
564
        @$(ECHO) Compiling $(
565
        @$(MKDIR) $(@D)
566
        $(CC_PRE_PROCESS)
567
        $(CC) -MP -MMD -c $(BSP_CPPFLAGS) $(BSP_CFLAGS) -o $@ $<
568
        $(CC_POST_PROCESS)
569
 
570
$(OBJ_DIR)/%.o: %.C
571
        @$(ECHO) Compiling $(
572
        @$(MKDIR) $(@D)
573
        $(CC_PRE_PROCESS)
574
        $(CC) -MP -MMD -c $(BSP_CPPFLAGS) $(BSP_CFLAGS) -o $@ $<
575
        $(CC_POST_PROCESS)
576
 
577
$(OBJ_DIR)/%.o: %.cpp
578
        @$(ECHO) Compiling $(
579
        @$(MKDIR) $(@D)
580
        $(CXX_PRE_PROCESS)
581
        $(CXX) -MP -MMD -c $(BSP_CPPFLAGS) $(BSP_CXXFLAGS) $(BSP_CFLAGS) -o $@ $<
582
        $(CXX_POST_PROCESS)
583
 
584
$(OBJ_DIR)/%.o: %.CPP
585
        @$(ECHO) Compiling $(
586
        @$(MKDIR) $(@D)
587
        $(CXX_PRE_PROCESS)
588
        $(CXX) -MP -MMD -c $(BSP_CPPFLAGS) $(BSP_CXXFLAGS) $(BSP_CFLAGS) -o $@ $<
589
        $(CXX_POST_PROCESS)
590
 
591
$(OBJ_DIR)/%.o: %.cc
592
        @$(ECHO) Compiling $(
593
        @$(MKDIR) $(@D)
594
        $(CXX_PRE_PROCESS)
595
        $(CXX) -MP -MMD -c $(BSP_CPPFLAGS) $(BSP_CXXFLAGS) $(BSP_CFLAGS) -o $@ $<
596
        $(CXX_POST_PROCESS)
597
 
598
$(OBJ_DIR)/%.o: %.CC
599
        @$(ECHO) Compiling $(
600
        @$(MKDIR) $(@D)
601
        $(CXX_PRE_PROCESS)
602
        $(CXX) -MP -MMD -c $(BSP_CPPFLAGS) $(BSP_CXXFLAGS) $(BSP_CFLAGS) -o $@ $<
603
        $(CXX_POST_PROCESS)
604
 
605
$(OBJ_DIR)/%.o: %.cxx
606
        @$(ECHO) Compiling $(
607
        @$(MKDIR) $(@D)
608
        $(CXX_PRE_PROCESS)
609
        $(CXX) -MP -MMD -c $(BSP_CPPFLAGS) $(BSP_CXXFLAGS) $(BSP_CFLAGS) -o $@ $<
610
        $(CXX_POST_PROCESS)
611
 
612
$(OBJ_DIR)/%.o: %.CXX
613
        @$(ECHO) Compiling $(
614
        @$(MKDIR) $(@D)
615
        $(CXX_PRE_PROCESS)
616
        $(CXX) -MP -MMD -c $(BSP_CPPFLAGS) $(BSP_CXXFLAGS) $(BSP_CFLAGS) -o $@ $<
617
        $(CXX_POST_PROCESS)
618
 
619
$(OBJ_DIR)/%.o: %.S
620
        @$(ECHO) Compiling $(
621
        @$(MKDIR) $(@D)
622
        $(AS_PRE_PROCESS)
623
        $(AS) -MP -MMD -c $(BSP_CFLAGS) $(BSP_CPPFLAGS) $(BSP_ASFLAGS) -o $@ $<
624
        $(AS_POST_PROCESS)
625
 
626
$(OBJ_DIR)/%.o: %.s
627
        @$(ECHO) Compiling $(
628
        @$(MKDIR) $(@D)
629
        $(AS_PRE_PROCESS)
630
        $(AS) -MP -MMD -c $(BSP_ASFLAGS) $(BSP_CFLAGS) -o $@ $<
631
        $(AS_POST_PROCESS)
632
 
633
# Pattern rules for making useful intermediate files
634
$(OBJ_DIR)/%.s: %.c
635
        @$(ECHO) Compiling $(
636
        @$(MKDIR) $(@D)
637
        $(CC_PRE_PROCESS)
638
        $(CC) -MP -MMD -c $(BSP_CPPFLAGS) $(BSP_CFLAGS) -o $@ $<
639
        $(CC_POST_PROCESS)
640
 
641
$(OBJ_DIR)/%.s: %.cpp
642
        @$(ECHO) Compiling $(
643
        @$(MKDIR) $(@D)
644
        $(CXX_PRE_PROCESS)
645
        $(CXX) -MP -MMD -c $(BSP_CPPFLAGS) $(BSP_CXXFLAGS) $(BSP_CFLAGS) -o $@ $<
646
        $(CXX_PRE_PROCESS)
647
 
648
$(OBJ_DIR)/%.s: %.cc
649
        @$(ECHO) Compiling $(
650
        @$(MKDIR) $(@D)
651
        $(CXX_PRE_PROCESS)
652
        $(CXX) -MP -MMD -c $(BSP_CPPFLAGS) $(BSP_CXXFLAGS) $(BSP_CFLAGS) -o $@ $<
653
        $(CXX_PRE_PROCESS)
654
 
655
$(OBJ_DIR)/%.s: %.cxx
656
        @$(ECHO) Compiling $(
657
        @$(MKDIR) $(@D)
658
        $(CXX_PRE_PROCESS)
659
        $(CXX) -MP -MMD -c $(BSP_CPPFLAGS) $(BSP_CXXFLAGS) $(BSP_CFLAGS) -o $@ $<
660
        $(CXX_PRE_PROCESS)
661
 
662
$(OBJ_DIR)/%.i: %.c
663
        @$(ECHO) Compiling $(
664
        @$(MKDIR) $(@D)
665
        $(CC_PRE_PROCESS)
666
        $(CC) -E $(CPPFLAGS) $(ALT_CFLAGS) $(CFLAGS) -o $@ $<
667
        $(CC_PRE_PROCESS)
668
 
669
$(OBJ_DIR)/%.i: %.cpp
670
        @$(ECHO) Compiling $(
671
        @$(MKDIR) $(@D)
672
        $(CXX_PRE_PROCESS)
673
        $(CXX) -MP -MMD -c $(BSP_CPPFLAGS) $(BSP_CXXFLAGS) $(BSP_CFLAGS) -o $@ $<
674
        $(CXX_PRE_PROCESS)
675
 
676
$(OBJ_DIR)/%.i: %.cc
677
        @$(ECHO) Compiling $(
678
        @$(MKDIR) $(@D)
679
        $(CXX_PRE_PROCESS)
680
        $(CXX) -MP -MMD -c $(BSP_CPPFLAGS) $(BSP_CXXFLAGS) $(BSP_CFLAGS) -o $@ $<
681
        $(CXX_PRE_PROCESS)
682
 
683
$(OBJ_DIR)/%.i: %.cxx
684
        @$(ECHO) Compiling $(
685
        @$(MKDIR) $(@D)
686
        $(CXX_PRE_PROCESS)
687
        $(CXX) -MP -MMD -c $(BSP_CPPFLAGS) $(BSP_CXXFLAGS) $(BSP_CFLAGS) -o $@ $<
688
        $(CXX_PRE_PROCESS)
689
 
690
# Pattern rules for building other object files.
691
%.o: %.c
692
        @$(ECHO) Compiling $(
693
        @$(MKDIR) $(@D)
694
        $(CC_PRE_PROCESS)
695
        $(CC) -MP -MMD -c $(CPPFLAGS) $(ALT_CFLAGS) $(CFLAGS) -o $@ $<
696
        $(CC_POST_PROCESS)
697
 
698
%.o: %.cpp
699
        @$(ECHO) Compiling $(
700
        @$(MKDIR) $(@D)
701
        $(CXX_POST_PROCESS)
702
        $(CXX) -MP -MMD -c $(BSP_CPPFLAGS) $(BSP_CXXFLAGS) $(BSP_CFLAGS) -o $@ $<
703
        $(CXX_POST_PROCESS)
704
 
705
%.o: %.cc
706
        @$(ECHO) Compiling $(
707
        @$(MKDIR) $(@D)
708
        $(CXX_POST_PROCESS)
709
        $(CXX) -MP -MMD -c $(BSP_CPPFLAGS) $(BSP_CXXFLAGS) $(BSP_CFLAGS) -o $@ $<
710
        $(CXX_POST_PROCESS)
711
 
712
%.o: %.cxx
713
        @$(ECHO) Compiling $(
714
        @$(MKDIR) $(@D)
715
        $(CXX_PRE_PROCESS)
716
        $(CXX) -MP -MMD -c $(BSP_CPPFLAGS) $(BSP_CXXFLAGS) $(BSP_CFLAGS) -o $@ $<
717
        $(CXX_POST_PROCESS)
718
 
719
%.o: %.S
720
        @$(ECHO) Compiling $(
721
        @$(MKDIR) $(@D)
722
        $(AS_PRE_PROCESS)
723
        $(AS) -MP -MMD -c $(BSP_CFLAGS) $(BSP_CPPFLAGS) $(BSP_ASFLAGS) -o $@ $<
724
        $(AS_POST_PROCESS)
725
 
726
%.o: %.s
727
        @$(ECHO) Compiling $(
728
        @$(MKDIR) $(@D)
729
        $(AS_PRE_PROCESS)
730
        $(AS) -MP -MMD -c $(BSP_ASFLAGS) $(BSP_CFLAGS) -o $@ $<
731
        $(AS_POST_PROCESS)
732
 
733
 
734
#------------------------------------------------------------------------------
735
#                               NEWLIB RULES
736
#------------------------------------------------------------------------------
737
 
738
ifneq ($(COMPILE_NEWLIB),)
739
NEWLIB_FLAGS += $(BSP_CFLAGS)
740
endif
741
 
742
ifneq ($(NEWLIB_DIR),)
743
$(NEWLIB_DIR):
744
        @$(ECHO) Creating $(NEWLIB_DIR)...
745
        nios2-newlib-gen --no-multilib $(NEWLIB_DIR)-build-tmp $(NEWLIB_DIR) --custom "$(NEWLIB_FLAGS)"
746
        @$(ECHO) Removing $(NEWLIB_DIR)-build-tmp...
747
        @$(RM) -rf $(NEWLIB_DIR)-build-tmp
748
endif
749
 
750
#------------------------------------------------------------------------------
751
#                               LIBRARY RULES
752
#------------------------------------------------------------------------------
753
$(BSP_LIB): $(OBJS)
754
        @$(ECHO) Creating $@...
755
        $(AR_PRE_PROCESS)
756
        $(RM) -f $@
757
        $(AR) $(BSP_ARFLAGS) $@ $^
758
        $(AR_POST_PROCESS)
759
 
760
 
761
#------------------------------------------------------------------------------
762
#                                DEPENDENCY FILES
763
#------------------------------------------------------------------------------
764
ifneq ($(findstring clean, $(MAKECMDGOALS)),clean)
765
-include $(DEPS)
766
endif
767
 
768
# End of Makefile
769
 
770
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.