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

Subversion Repositories ao486

[/] [ao486/] [trunk/] [syn/] [soc/] [firmware/] [exe_bsp/] [Makefile] - Blame information for rev 2

Go to most recent revision | Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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