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

Subversion Repositories ao486

[/] [ao486/] [trunk/] [syn/] [components/] [sd_card/] [firmware/] [bsp/] [Makefile] - Blame information for rev 8

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 8 alfik
#------------------------------------------------------------------------------
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: 200
102
 
103
SETTINGS_FILE := settings.bsp
104
SOPC_FILE := ../../system.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 = -Os
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_nios2_qsys_hal_driver sources root
223
altera_nios2_qsys_hal_driver_SRCS_ROOT := HAL
224
 
225
# altera_nios2_qsys_hal_driver sources
226
altera_nios2_qsys_hal_driver_C_LIB_SRCS := \
227
        $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/altera_nios2_qsys_irq.c \
228
        $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/alt_usleep.c \
229
        $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/alt_busy_sleep.c \
230
        $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/alt_irq_vars.c \
231
        $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/alt_icache_flush.c \
232
        $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/alt_icache_flush_all.c \
233
        $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/alt_dcache_flush.c \
234
        $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/alt_dcache_flush_all.c \
235
        $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/alt_dcache_flush_no_writeback.c \
236
        $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/alt_ecc_fatal_exception.c \
237
        $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/alt_instruction_exception_entry.c \
238
        $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/alt_irq_register.c \
239
        $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/alt_iic.c \
240
        $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/alt_remap_cached.c \
241
        $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/alt_remap_uncached.c \
242
        $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/alt_uncached_free.c \
243
        $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/alt_uncached_malloc.c \
244
        $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/alt_do_ctors.c \
245
        $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/alt_do_dtors.c \
246
        $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/alt_gmon.c
247
 
248
altera_nios2_qsys_hal_driver_ASM_LIB_SRCS := \
249
        $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/alt_ecc_fatal_entry.S \
250
        $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/alt_exception_entry.S \
251
        $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/alt_exception_trap.S \
252
        $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/alt_exception_muldiv.S \
253
        $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/alt_irq_entry.S \
254
        $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/alt_software_exception.S \
255
        $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/alt_mcount.S \
256
        $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/alt_log_macro.S \
257
        $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/crt0.S
258
 
259
# hal sources root
260
hal_SRCS_ROOT := HAL
261
 
262
# hal sources
263
hal_C_LIB_SRCS := \
264
        $(hal_SRCS_ROOT)/src/alt_alarm_start.c \
265
        $(hal_SRCS_ROOT)/src/alt_close.c \
266
        $(hal_SRCS_ROOT)/src/alt_dev.c \
267
        $(hal_SRCS_ROOT)/src/alt_dev_llist_insert.c \
268
        $(hal_SRCS_ROOT)/src/alt_dma_rxchan_open.c \
269
        $(hal_SRCS_ROOT)/src/alt_dma_txchan_open.c \
270
        $(hal_SRCS_ROOT)/src/alt_environ.c \
271
        $(hal_SRCS_ROOT)/src/alt_env_lock.c \
272
        $(hal_SRCS_ROOT)/src/alt_errno.c \
273
        $(hal_SRCS_ROOT)/src/alt_execve.c \
274
        $(hal_SRCS_ROOT)/src/alt_exit.c \
275
        $(hal_SRCS_ROOT)/src/alt_fcntl.c \
276
        $(hal_SRCS_ROOT)/src/alt_fd_lock.c \
277
        $(hal_SRCS_ROOT)/src/alt_fd_unlock.c \
278
        $(hal_SRCS_ROOT)/src/alt_find_dev.c \
279
        $(hal_SRCS_ROOT)/src/alt_find_file.c \
280
        $(hal_SRCS_ROOT)/src/alt_flash_dev.c \
281
        $(hal_SRCS_ROOT)/src/alt_fork.c \
282
        $(hal_SRCS_ROOT)/src/alt_fs_reg.c \
283
        $(hal_SRCS_ROOT)/src/alt_fstat.c \
284
        $(hal_SRCS_ROOT)/src/alt_get_fd.c \
285
        $(hal_SRCS_ROOT)/src/alt_getchar.c \
286
        $(hal_SRCS_ROOT)/src/alt_getpid.c \
287
        $(hal_SRCS_ROOT)/src/alt_gettod.c \
288
        $(hal_SRCS_ROOT)/src/alt_iic_isr_register.c \
289
        $(hal_SRCS_ROOT)/src/alt_instruction_exception_register.c \
290
        $(hal_SRCS_ROOT)/src/alt_ioctl.c \
291
        $(hal_SRCS_ROOT)/src/alt_io_redirect.c \
292
        $(hal_SRCS_ROOT)/src/alt_irq_handler.c \
293
        $(hal_SRCS_ROOT)/src/alt_isatty.c \
294
        $(hal_SRCS_ROOT)/src/alt_kill.c \
295
        $(hal_SRCS_ROOT)/src/alt_link.c \
296
        $(hal_SRCS_ROOT)/src/alt_load.c \
297
        $(hal_SRCS_ROOT)/src/alt_log_printf.c \
298
        $(hal_SRCS_ROOT)/src/alt_lseek.c \
299
        $(hal_SRCS_ROOT)/src/alt_main.c \
300
        $(hal_SRCS_ROOT)/src/alt_malloc_lock.c \
301
        $(hal_SRCS_ROOT)/src/alt_open.c \
302
        $(hal_SRCS_ROOT)/src/alt_printf.c \
303
        $(hal_SRCS_ROOT)/src/alt_putchar.c \
304
        $(hal_SRCS_ROOT)/src/alt_putstr.c \
305
        $(hal_SRCS_ROOT)/src/alt_read.c \
306
        $(hal_SRCS_ROOT)/src/alt_release_fd.c \
307
        $(hal_SRCS_ROOT)/src/alt_rename.c \
308
        $(hal_SRCS_ROOT)/src/alt_sbrk.c \
309
        $(hal_SRCS_ROOT)/src/alt_settod.c \
310
        $(hal_SRCS_ROOT)/src/alt_stat.c \
311
        $(hal_SRCS_ROOT)/src/alt_tick.c \
312
        $(hal_SRCS_ROOT)/src/alt_times.c \
313
        $(hal_SRCS_ROOT)/src/alt_unlink.c \
314
        $(hal_SRCS_ROOT)/src/alt_wait.c \
315
        $(hal_SRCS_ROOT)/src/alt_write.c
316
 
317
 
318
# Assemble all component C source files
319
COMPONENT_C_LIB_SRCS += \
320
        $(altera_avalon_jtag_uart_driver_C_LIB_SRCS) \
321
        $(altera_nios2_qsys_hal_driver_C_LIB_SRCS) \
322
        $(hal_C_LIB_SRCS)
323
 
324
# Assemble all component assembly source files
325
COMPONENT_ASM_LIB_SRCS += \
326
        $(altera_nios2_qsys_hal_driver_ASM_LIB_SRCS)
327
 
328
# Assemble all component C++ source files
329
COMPONENT_CPP_LIB_SRCS += \
330
 
331
#END MANAGED
332
 
333
#------------------------------------------------------------------------------
334
#                                 PUBLIC.MK
335
#
336
# The generated public.mk file contains BSP information that is shared with
337
# other external makefiles, such as a Nios II application makefile. System-
338
# dependent information such as hardware-specific compiler flags and
339
# simulation file generation are stored here.
340
#
341
# In addition, public.mk contains include paths that various software,
342
# such as a device driver, may need for the C compiler. These paths are
343
# written to public.mk with respect to the BSP root. In public.mk, each
344
# path is prefixed with a special variable, $(ALT_LIBRARY_ROOT_DIR). The
345
# purpose of this variable is to allow an external Makefile to append on
346
# path information to precisely locate paths expressed in public.mk
347
# Since this is the BSP Makefile, we set ALT_LIBRARY_ROOT_DIR to point right
348
# here ("."), at the BSP root.
349
#
350
# ALT_LIBRARY_ROOT_DIR must always be set before public.mk is included.
351
#------------------------------------------------------------------------------
352
ALT_LIBRARY_ROOT_DIR := .
353
include public.mk
354
 
355
 
356
#------------------------------------------------------------------------------
357
#                                FLAGS
358
#
359
# Include paths for BSP files are written into the public.mk file and must
360
# be added to the existing list of pre-processor flags. In addition, "hooks"
361
# for standard flags left intentionally empty (CFLAGS, CPPFLAGS, ASFLAGS,
362
# and CXXFLAGS) are provided for conveniently adding to the relevant flags
363
# on the command-line or via script that calls make.
364
#------------------------------------------------------------------------------
365
# Assemble final list of compiler flags from generated content
366
BSP_CFLAGS += \
367
  $(BSP_CFLAGS_DEFINED_SYMBOLS) \
368
  $(BSP_CFLAGS_UNDEFINED_SYMBOLS) \
369
  $(BSP_CFLAGS_OPTIMIZATION) \
370
  $(BSP_CFLAGS_DEBUG) \
371
  $(BSP_CFLAGS_WARNINGS) \
372
  $(BSP_CFLAGS_USER_FLAGS) \
373
  $(ALT_CFLAGS) \
374
  $(CFLAGS)
375
 
376
# Make ready the final list of include directories and other C pre-processor
377
# flags. Each include path is made ready by prefixing it with "-I".
378
BSP_CPPFLAGS += \
379
  $(addprefix -I, $(BSP_INC_DIRS)) \
380
  $(addprefix -I, $(ALT_INCLUDE_DIRS)) \
381
  $(ALT_CPPFLAGS) \
382
  $(CPPFLAGS)
383
 
384
# Finish off assembler flags with any user-provided flags
385
BSP_ASFLAGS += $(ASFLAGS)
386
 
387
# Finish off C++ flags with any user-provided flags
388
BSP_CXXFLAGS += $(CXXFLAGS)
389
 
390
# And finally, the ordered list
391
C_SRCS += $(GENERATED_C_LIB_SRCS) \
392
          $(COMPONENT_C_LIB_SRCS)
393
 
394
CXX_SRCS += $(GENERATED_CPP_LIB_SRCS) \
395
          $(COMPONENT_CPP_LIB_SRCS)
396
 
397
ASM_SRCS += $(GENERATED_ASM_LIB_SRCS) \
398
            $(COMPONENT_ASM_LIB_SRCS)
399
 
400
 
401
#------------------------------------------------------------------------------
402
#                         LIST OF GENERATED FILES
403
#
404
# A Nios II BSP relies on the generation of several source files used
405
# by both the BSP and any applications referencing the BSP.
406
#------------------------------------------------------------------------------
407
 
408
 
409
GENERATED_H_FILES := $(ABS_BSP_ROOT)/system.h
410
 
411
GENERATED_LINKER_SCRIPT := $(ABS_BSP_ROOT)/linker.x
412
 
413
GENERATED_FILES += $(GENERATED_H_FILES) \
414
                   $(GENERATED_LINKER_SCRIPT)
415
 
416
 
417
#------------------------------------------------------------------------------
418
#                        SETUP TO BUILD OBJECTS
419
#
420
# List of object files which are to be built. This is constructed from the input
421
# list of C source files (C_SRCS), C++ source files (CXX_SRCS), and assembler
422
# source file (ASM_SRCS). The permitted file extensions are:
423
#
424
# .c .C                       - for C files
425
# .cxx .cc .cpp .CXX .CC .CPP - for C++ files
426
# .S .s                       - for assembly files
427
#
428
# Extended description: The list of objects is a sorted list (duplicates
429
# removed) of all possible objects, placed beneath the ./obj directory,
430
# including any path information stored in the "*_SRCS" variable. The
431
# "patsubst" commands are used to concatenate together multiple file suffix
432
# types for common files (i.e. c++ as .cxx, .cc, .cpp).
433
#
434
# File extensions are case-insensitive in build rules with the exception of
435
# assembly sources. Nios II assembly sources with the ".S" extension are first
436
# run through the C preprocessor. Sources with the ".s" extension are not.
437
#------------------------------------------------------------------------------
438
OBJS = $(sort $(addprefix $(OBJ_DIR)/,                                        \
439
               $(patsubst %.c, %.o,   $(patsubst %.C, %.o, $(C_SRCS)))        \
440
               $(patsubst %.cxx, %.o, $(patsubst %.CXX, %.o,                  \
441
               $(patsubst %.cc, %.o,  $(patsubst %.CC, %.o,                   \
442
               $(patsubst %.cpp, %.o, $(patsubst %.CPP, %.o,                  \
443
                 $(CXX_SRCS) ))))))                                           \
444
               $(patsubst %.S, %.o, $(patsubst %.s, %.o, $(ASM_SRCS))) ))
445
 
446
# List of dependancy files for each object file.
447
DEPS = $(OBJS:.o=.d)
448
 
449
 
450
# Rules to force your project to rebuild or relink
451
# .force_relink file will cause any application that depends on this project to relink
452
# .force_rebuild file will cause this project to rebuild object files
453
# .force_rebuild_all file will cause this project and any project that depends on this project to rebuild object files
454
 
455
FORCE_RELINK_DEP  := .force_relink
456
FORCE_REBUILD_DEP := .force_rebuild
457
FORCE_REBUILD_ALL_DEP := .force_rebuild_all
458
FORCE_REBUILD_DEP_LIST := $(FORCE_RELINK_DEP) $(FORCE_REBUILD_DEP) $(FORCE_REBUILD_ALL_DEP)
459
 
460
$(FORCE_REBUILD_DEP_LIST):
461
 
462
$(OBJS): $(wildcard $(FORCE_REBUILD_DEP)) $(wildcard $(FORCE_REBUILD_ALL_DEP))
463
 
464
 
465
#------------------------------------------------------------------------------
466
#                          BUILD RULES: ALL & CLEAN
467
#------------------------------------------------------------------------------
468
.DELETE_ON_ERROR:
469
 
470
.PHONY: all
471
all: build_pre_process
472
all: Makefile $(GENERATED_FILES) $(BSP_LIB) $(NEWLIB_DIR)
473
all: build_post_process
474
 
475
 
476
# clean: remove .o/.a/.d
477
.PHONY: clean
478
clean:
479
        @$(RM) -r $(BSP_LIB) $(OBJ_DIR) $(FORCE_REBUILD_DEP_LIST)
480
ifneq ($(wildcard $(NEWLIB_DIR)),)
481
        @$(RM) -r $(NEWLIB_DIR)
482
endif
483
        @$(ECHO) [BSP clean complete]
484
 
485
 
486
#------------------------------------------------------------------------------
487
#                           BUILD PRE/POST PROCESS
488
#------------------------------------------------------------------------------
489
build_pre_process :
490
        $(BUILD_PRE_PROCESS)
491
 
492
build_post_process :
493
        $(BUILD_POST_PROCESS)
494
 
495
.PHONY: build_pre_process build_post_process
496
 
497
 
498
 
499
#------------------------------------------------------------------------------
500
#                             MAKEFILE UP TO DATE?
501
#
502
# Is this very Makefile up to date? Someone may have changed the BSP settings
503
# file or the associated target hardware.
504
#------------------------------------------------------------------------------
505
# Skip this check when clean is the only target
506
ifneq ($(MAKECMDGOALS),clean)
507
 
508
ifneq ($(wildcard $(SETTINGS_FILE)),$(SETTINGS_FILE))
509
$(warning Warning: BSP Settings File $(SETTINGS_FILE) could not be found.)
510
endif
511
 
512
Makefile: $(wildcard $(SETTINGS_FILE))
513
        @$(ECHO) Makefile not up to date.
514
        @$(ECHO) $(SETTINGS_FILE) has been modified since the BSP Makefile was generated.
515
        @$(ECHO)
516
        @$(ECHO) Generate the BSP to update the Makefile, and then build again.
517
        @$(ECHO)
518
        @$(ECHO) To generate from Eclipse:
519
        @$(ECHO) " 1. Right-click the BSP project."
520
        @$(ECHO) " 2. In the Nios II Menu, click Generate BSP."
521
        @$(ECHO)
522
        @$(ECHO) To generate from the command line:
523
        @$(ECHO) " nios2-bsp-generate-files --settings= --bsp-dir="
524
        @$(ECHO)
525
        @exit 1
526
 
527
ifneq ($(wildcard $(SOPC_FILE)),$(SOPC_FILE))
528
$(warning Warning: SOPC File $(SOPC_FILE) could not be found.)
529
endif
530
 
531
public.mk: $(wildcard $(SOPC_FILE))
532
        @$(ECHO) Makefile not up to date.
533
        @$(ECHO) $(SOPC_FILE) has been modified since the BSP was generated.
534
        @$(ECHO)
535
        @$(ECHO) Generate the BSP to update the Makefile, and then build again.
536
        @$(ECHO)
537
        @$(ECHO) To generate from Eclipse:
538
        @$(ECHO) " 1. Right-click the BSP project."
539
        @$(ECHO) " 2. In the Nios II Menu, click Generate BSP."
540
        @$(ECHO)
541
        @$(ECHO) To generate from the command line:
542
        @$(ECHO) " nios2-bsp-generate-files --settings= --bsp-dir="
543
        @$(ECHO)
544
        @exit 1
545
 
546
endif # $(MAKECMDGOALS) != clean
547
 
548
#------------------------------------------------------------------------------
549
#                     PATTERN RULES TO BUILD OBJECTS
550
#------------------------------------------------------------------------------
551
$(OBJ_DIR)/%.o: %.c
552
        @$(ECHO) Compiling $(
553
        @$(MKDIR) $(@D)
554
        $(CC_PRE_PROCESS)
555
        $(CC) -MP -MMD -c $(BSP_CPPFLAGS) $(BSP_CFLAGS) -o $@ $<
556
        $(CC_POST_PROCESS)
557
 
558
$(OBJ_DIR)/%.o: %.C
559
        @$(ECHO) Compiling $(
560
        @$(MKDIR) $(@D)
561
        $(CC_PRE_PROCESS)
562
        $(CC) -MP -MMD -c $(BSP_CPPFLAGS) $(BSP_CFLAGS) -o $@ $<
563
        $(CC_POST_PROCESS)
564
 
565
$(OBJ_DIR)/%.o: %.cpp
566
        @$(ECHO) Compiling $(
567
        @$(MKDIR) $(@D)
568
        $(CXX_PRE_PROCESS)
569
        $(CXX) -MP -MMD -c $(BSP_CPPFLAGS) $(BSP_CXXFLAGS) $(BSP_CFLAGS) -o $@ $<
570
        $(CXX_POST_PROCESS)
571
 
572
$(OBJ_DIR)/%.o: %.CPP
573
        @$(ECHO) Compiling $(
574
        @$(MKDIR) $(@D)
575
        $(CXX_PRE_PROCESS)
576
        $(CXX) -MP -MMD -c $(BSP_CPPFLAGS) $(BSP_CXXFLAGS) $(BSP_CFLAGS) -o $@ $<
577
        $(CXX_POST_PROCESS)
578
 
579
$(OBJ_DIR)/%.o: %.cc
580
        @$(ECHO) Compiling $(
581
        @$(MKDIR) $(@D)
582
        $(CXX_PRE_PROCESS)
583
        $(CXX) -MP -MMD -c $(BSP_CPPFLAGS) $(BSP_CXXFLAGS) $(BSP_CFLAGS) -o $@ $<
584
        $(CXX_POST_PROCESS)
585
 
586
$(OBJ_DIR)/%.o: %.CC
587
        @$(ECHO) Compiling $(
588
        @$(MKDIR) $(@D)
589
        $(CXX_PRE_PROCESS)
590
        $(CXX) -MP -MMD -c $(BSP_CPPFLAGS) $(BSP_CXXFLAGS) $(BSP_CFLAGS) -o $@ $<
591
        $(CXX_POST_PROCESS)
592
 
593
$(OBJ_DIR)/%.o: %.cxx
594
        @$(ECHO) Compiling $(
595
        @$(MKDIR) $(@D)
596
        $(CXX_PRE_PROCESS)
597
        $(CXX) -MP -MMD -c $(BSP_CPPFLAGS) $(BSP_CXXFLAGS) $(BSP_CFLAGS) -o $@ $<
598
        $(CXX_POST_PROCESS)
599
 
600
$(OBJ_DIR)/%.o: %.CXX
601
        @$(ECHO) Compiling $(
602
        @$(MKDIR) $(@D)
603
        $(CXX_PRE_PROCESS)
604
        $(CXX) -MP -MMD -c $(BSP_CPPFLAGS) $(BSP_CXXFLAGS) $(BSP_CFLAGS) -o $@ $<
605
        $(CXX_POST_PROCESS)
606
 
607
$(OBJ_DIR)/%.o: %.S
608
        @$(ECHO) Compiling $(
609
        @$(MKDIR) $(@D)
610
        $(AS_PRE_PROCESS)
611
        $(AS) -MP -MMD -c $(BSP_CFLAGS) $(BSP_CPPFLAGS) $(BSP_ASFLAGS) -o $@ $<
612
        $(AS_POST_PROCESS)
613
 
614
$(OBJ_DIR)/%.o: %.s
615
        @$(ECHO) Compiling $(
616
        @$(MKDIR) $(@D)
617
        $(AS_PRE_PROCESS)
618
        $(AS) -MP -MMD -c $(BSP_ASFLAGS) $(BSP_CFLAGS) -o $@ $<
619
        $(AS_POST_PROCESS)
620
 
621
# Pattern rules for making useful intermediate files
622
$(OBJ_DIR)/%.s: %.c
623
        @$(ECHO) Compiling $(
624
        @$(MKDIR) $(@D)
625
        $(CC_PRE_PROCESS)
626
        $(CC) -MP -MMD -c $(BSP_CPPFLAGS) $(BSP_CFLAGS) -o $@ $<
627
        $(CC_POST_PROCESS)
628
 
629
$(OBJ_DIR)/%.s: %.cpp
630
        @$(ECHO) Compiling $(
631
        @$(MKDIR) $(@D)
632
        $(CXX_PRE_PROCESS)
633
        $(CXX) -MP -MMD -c $(BSP_CPPFLAGS) $(BSP_CXXFLAGS) $(BSP_CFLAGS) -o $@ $<
634
        $(CXX_PRE_PROCESS)
635
 
636
$(OBJ_DIR)/%.s: %.cc
637
        @$(ECHO) Compiling $(
638
        @$(MKDIR) $(@D)
639
        $(CXX_PRE_PROCESS)
640
        $(CXX) -MP -MMD -c $(BSP_CPPFLAGS) $(BSP_CXXFLAGS) $(BSP_CFLAGS) -o $@ $<
641
        $(CXX_PRE_PROCESS)
642
 
643
$(OBJ_DIR)/%.s: %.cxx
644
        @$(ECHO) Compiling $(
645
        @$(MKDIR) $(@D)
646
        $(CXX_PRE_PROCESS)
647
        $(CXX) -MP -MMD -c $(BSP_CPPFLAGS) $(BSP_CXXFLAGS) $(BSP_CFLAGS) -o $@ $<
648
        $(CXX_PRE_PROCESS)
649
 
650
$(OBJ_DIR)/%.i: %.c
651
        @$(ECHO) Compiling $(
652
        @$(MKDIR) $(@D)
653
        $(CC_PRE_PROCESS)
654
        $(CC) -E $(CPPFLAGS) $(ALT_CFLAGS) $(CFLAGS) -o $@ $<
655
        $(CC_PRE_PROCESS)
656
 
657
$(OBJ_DIR)/%.i: %.cpp
658
        @$(ECHO) Compiling $(
659
        @$(MKDIR) $(@D)
660
        $(CXX_PRE_PROCESS)
661
        $(CXX) -MP -MMD -c $(BSP_CPPFLAGS) $(BSP_CXXFLAGS) $(BSP_CFLAGS) -o $@ $<
662
        $(CXX_PRE_PROCESS)
663
 
664
$(OBJ_DIR)/%.i: %.cc
665
        @$(ECHO) Compiling $(
666
        @$(MKDIR) $(@D)
667
        $(CXX_PRE_PROCESS)
668
        $(CXX) -MP -MMD -c $(BSP_CPPFLAGS) $(BSP_CXXFLAGS) $(BSP_CFLAGS) -o $@ $<
669
        $(CXX_PRE_PROCESS)
670
 
671
$(OBJ_DIR)/%.i: %.cxx
672
        @$(ECHO) Compiling $(
673
        @$(MKDIR) $(@D)
674
        $(CXX_PRE_PROCESS)
675
        $(CXX) -MP -MMD -c $(BSP_CPPFLAGS) $(BSP_CXXFLAGS) $(BSP_CFLAGS) -o $@ $<
676
        $(CXX_PRE_PROCESS)
677
 
678
# Pattern rules for building other object files.
679
%.o: %.c
680
        @$(ECHO) Compiling $(
681
        @$(MKDIR) $(@D)
682
        $(CC_PRE_PROCESS)
683
        $(CC) -MP -MMD -c $(CPPFLAGS) $(ALT_CFLAGS) $(CFLAGS) -o $@ $<
684
        $(CC_POST_PROCESS)
685
 
686
%.o: %.cpp
687
        @$(ECHO) Compiling $(
688
        @$(MKDIR) $(@D)
689
        $(CXX_POST_PROCESS)
690
        $(CXX) -MP -MMD -c $(BSP_CPPFLAGS) $(BSP_CXXFLAGS) $(BSP_CFLAGS) -o $@ $<
691
        $(CXX_POST_PROCESS)
692
 
693
%.o: %.cc
694
        @$(ECHO) Compiling $(
695
        @$(MKDIR) $(@D)
696
        $(CXX_POST_PROCESS)
697
        $(CXX) -MP -MMD -c $(BSP_CPPFLAGS) $(BSP_CXXFLAGS) $(BSP_CFLAGS) -o $@ $<
698
        $(CXX_POST_PROCESS)
699
 
700
%.o: %.cxx
701
        @$(ECHO) Compiling $(
702
        @$(MKDIR) $(@D)
703
        $(CXX_PRE_PROCESS)
704
        $(CXX) -MP -MMD -c $(BSP_CPPFLAGS) $(BSP_CXXFLAGS) $(BSP_CFLAGS) -o $@ $<
705
        $(CXX_POST_PROCESS)
706
 
707
%.o: %.S
708
        @$(ECHO) Compiling $(
709
        @$(MKDIR) $(@D)
710
        $(AS_PRE_PROCESS)
711
        $(AS) -MP -MMD -c $(BSP_CFLAGS) $(BSP_CPPFLAGS) $(BSP_ASFLAGS) -o $@ $<
712
        $(AS_POST_PROCESS)
713
 
714
%.o: %.s
715
        @$(ECHO) Compiling $(
716
        @$(MKDIR) $(@D)
717
        $(AS_PRE_PROCESS)
718
        $(AS) -MP -MMD -c $(BSP_ASFLAGS) $(BSP_CFLAGS) -o $@ $<
719
        $(AS_POST_PROCESS)
720
 
721
 
722
#------------------------------------------------------------------------------
723
#                               NEWLIB RULES
724
#------------------------------------------------------------------------------
725
 
726
ifneq ($(COMPILE_NEWLIB),)
727
NEWLIB_FLAGS += $(BSP_CFLAGS)
728
endif
729
 
730
ifneq ($(NEWLIB_DIR),)
731
$(NEWLIB_DIR):
732
        @$(ECHO) Creating $(NEWLIB_DIR)...
733
        nios2-newlib-gen --no-multilib $(NEWLIB_DIR)-build-tmp $(NEWLIB_DIR) --custom "$(NEWLIB_FLAGS)"
734
        @$(ECHO) Removing $(NEWLIB_DIR)-build-tmp...
735
        @$(RM) -rf $(NEWLIB_DIR)-build-tmp
736
endif
737
 
738
#------------------------------------------------------------------------------
739
#                               LIBRARY RULES
740
#------------------------------------------------------------------------------
741
$(BSP_LIB): $(OBJS)
742
        @$(ECHO) Creating $@...
743
        $(AR_PRE_PROCESS)
744
        $(RM) -f $@
745
        $(AR) $(BSP_ARFLAGS) $@ $^
746
        $(AR_POST_PROCESS)
747
 
748
 
749
#------------------------------------------------------------------------------
750
#                                DEPENDENCY FILES
751
#------------------------------------------------------------------------------
752
ifneq ($(findstring clean, $(MAKECMDGOALS)),clean)
753
-include $(DEPS)
754
endif
755
 
756
# End of Makefile
757
 
758
 

powered by: WebSVN 2.1.0

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