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

Subversion Repositories ao486

[/] [ao486/] [trunk/] [syn/] [components/] [ps2/] [software/] [exe_bsp/] [Makefile] - Blame information for rev 2

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

powered by: WebSVN 2.1.0

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