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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [orpsocv2/] [sw/] [Makefile.inc] - Blame information for rev 349

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

Line No. Rev Author Line
1 349 julius
######################################################################
2
####                                                              ####
3
#### Common makefile for inclusion by others                      ####
4
####                                                              ####
5
######################################################################
6
####                                                              ####
7
#### Copyright (C) 2010 Authors and OPENCORES.ORG                 ####
8
####                                                              ####
9
#### This source file may be used and distributed without         ####
10
#### restriction provided that this copyright statement is not    ####
11
#### removed from the file and that any derivative work contains  ####
12
#### the original copyright notice and the associated disclaimer. ####
13
####                                                              ####
14
#### This source file is free software; you can redistribute it   ####
15
#### and/or modify it under the terms of the GNU Lesser General   ####
16
#### Public License as published by the Free Software Foundation; ####
17
#### either version 2.1 of the License, or (at your option) any   ####
18
#### later version.                                               ####
19
####                                                              ####
20
#### This source is distributed in the hope that it will be       ####
21
#### useful, but WITHOUT ANY WARRANTY; without even the implied   ####
22
#### warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ####
23
#### PURPOSE.  See the GNU Lesser General Public License for more ####
24
#### details.                                                     ####
25
####                                                              ####
26
#### You should have received a copy of the GNU Lesser General    ####
27
#### Public License along with this source; if not, download it   ####
28
#### from http://www.opencores.org/lgpl.shtml                     ####
29
####                                                              ####
30
######################################################################
31
 
32
DESIGN_NAME=design
33
 
34
OR32_TOOL_PREFIX=or32-elf-
35
 
36
OR32_LD=$(OR32_TOOL_PREFIX)ld
37
OR32_AS=$(OR32_TOOL_PREFIX)as
38
OR32_CC=$(OR32_TOOL_PREFIX)gcc
39
OR32_AR=$(OR32_TOOL_PREFIX)ar
40
OR32_RANLIB=$(OR32_TOOL_PREFIX)ranlib
41
OR32_OBJDUMP=$(OR32_TOOL_PREFIX)objdump
42
OR32_OBJCOPY=$(OR32_TOOL_PREFIX)objcopy
43
 
44
VECTORS_OBJ ?=../support/crt0.o
45
SUPPORT_LIB ?=../support/$(DESIGN_NAME)_support.a
46
DESIGN_DEFINES_HEADER=../include/design-defines.h
47
SUPPORT_FILES ?=$(SUPPORT_LIB)
48
 
49
# Machine flags - uncomment one or create custom combination of flags
50
# All software div, mul and FPU
51
#MACH_FLAGS ?=-msoft-mul -msoft-div -msoft-float
52
# FPGA default - only hardware multiply
53
#MACH_FLAGS ?=-mhard-mul -msoft-div -msoft-float
54
# All hardware flags
55
#MARCH_FLAGS ?=-mhard-mul -mhard-div -mhard-float
56
# Hardware integer arith, soft float
57
MARCH_FLAGS ?=-mhard-mul -mhard-div -msoft-float
58
 
59
 
60
OR32_CFLAGS ?=-g -nostdlib -O2 -I../include $(MARCH_FLAGS)
61
OR32_LDFLAGS ?=-lgcc -T../support/or32.ld -e 256
62
 
63
# This path must be correct!
64
# Currently no overall design defines file - to come!
65
#DESIGN_VERILOG_DEFINES=../../rtl/verilog/include/$(DESIGN_NAME)-defines.v
66
#DESIGN_PROCESSED_VERILOG_DEFINES=../include/$(DESIGN_NAME)-defines.h
67
 
68
OR1200_VERILOG_DEFINES=../../rtl/verilog/or1200_defines.v
69
OR1200_PROCESSED_VERILOG_DEFINES=../include/or1200-defines.h
70
 
71
#PROCESSED_DEFINES=$(DESIGN_PROCESSED_VERILOG_DEFINES) $(OR1200_PROCESSED_VERILOG_DEFINES)
72
PROCESSED_DEFINES= $(OR1200_PROCESSED_VERILOG_DEFINES)
73
 
74
ELF_DEPENDS+=$(VECTORS_OBJ) $(PROCESSED_DEFINES) $(SUPPORT_FILES)
75
 
76
# Set V=1 when calling make to enable verbose output
77
# mainly for debugging purposes.
78
ifeq ($(V), 1)
79
Q=
80
else
81
Q ?=@
82
endif
83
 
84
# Our local utilities
85
UTILS_BIN2HEX=../utils/bin2hex
86
$(UTILS_BIN2HEX):
87
        $(Q)$(MAKE) -C ../utils bin2hex
88
 
89
UTILS_BIN2VMEM=../utils/bin2vmem
90
$(UTILS_BIN2VMEM):
91
        $(Q)$(MAKE) -C ../utils bin2vmem
92
 
93
 
94
# Rule to generate C header file from Verilog file with `defines in it
95
$(DESIGN_PROCESSED_VERILOG_DEFINES): $(DESIGN_VERILOG_DEFINES)
96
        $(Q)echo; echo "\t### Creating software defines header from verilog defines ###";
97
        $(Q)echo "//This file is autogenerated from "$<" do not change!" > ../include/$@
98
        $(Q)echo "#ifndef _"$(DESIGN_NAME)"_DEFINES_H_" >> ../include/$@
99
        $(Q)echo "#define _"$(DESIGN_NAME)"_DEFINES_H_" >> ../include/$@
100
        $(Q)cat $< | sed s://.*::g | sed 's/'\`'/'#'/g' >> ../include/$@
101
        $(Q)echo "#endif" >> ../include/$@
102
        $(Q)echo; echo >> ../include/$@
103
 
104
# This works (doesn't error), but for now we have to remove all of the numbers
105
# in verilog format, eg. 8'b0010_0000 or 32'h0000_0f00, or 32'd256 etc. as it's
106
# not so straight forward to convert these
107
$(OR1200_PROCESSED_VERILOG_DEFINES): $(OR1200_VERILOG_DEFINES)
108
        $(Q)echo; echo "\t### Creating OR1200 software defines header from verilog defines ###";
109
        $(Q)echo "//This file is autogenerated from "$<" do not change!" > ../include/$@
110
        $(Q)echo "#ifndef _OR1200_DEFINES_H_" >> ../include/$@
111
        $(Q)echo "#define _OR1200_DEFINES_H_" >> ../include/$@
112
        $(Q)cat $< | sed s://.*::g | grep -v \'[dhb] | sed 's/'\`'/'#'/g' >> ../include/$@
113
        $(Q)echo "#endif" >> ../include/$@
114
        $(Q)echo; echo >> ../include/$@
115
 
116
# Default make
117
%.flashin: %.bin $(UTILS_BIN2HEX)
118
        $(Q)$(UTILS_BIN2HEX) $< 1  -size_word > $@
119
 
120
%.vmem: %.bin $(UTILS_BIN2VMEM)
121
        $(Q)$(UTILS_BIN2VMEM) $< > $@
122
 
123
%.elf: %.c $(ELF_DEPENDS)
124
        $(Q)$(OR32_CC) $^ $(OR32_CFLAGS) $(OR32_LDFLAGS) -o $@
125
 
126
%.elf: %.S $(ELF_DEPENDS)
127
        $(Q)$(OR32_CC) $^ $(OR32_CFLAGS) $(OR32_LDFLAGS) -o $@
128
 
129
%.o: %.S
130
        $(Q)$(OR32_CC) $(OR32_CFLAGS) -c $< -o $@
131
 
132
%.o: %.c
133
        $(Q)$(OR32_CC) $(OR32_CFLAGS) -c $< -o $@
134
 
135
# Recompile the support lib if we detect any of the drivers having changed
136
SUPPORT_LIB_SRCS=$(shell ls ../support/*.[cS])
137
SUPPORT_LIB_SRCS +=$(shell ls ../include/*.h)
138
 
139
$(SUPPORT_LIB): $(SUPPORT_LIB_SRCS)
140
        $(Q)echo; echo "\t### Building software support library ###"; echo
141
        $(Q)$(MAKE) -C ../support $(DESIGN_NAME)_support.a
142
 
143
$(VECTORS_OBJ):
144
        $(Q)$(MAKE) -C ../support crt0.o
145
 
146
# This relies on the local clean rule of each makefile
147
clean-all: distclean
148
 
149
clean-support:
150
        $(Q)$(MAKE) -C ../support clean
151
 
152
# List of software directories, exclude include/
153
SWDIRS=$(shell ls ../ | grep -v include)
154
 
155
distclean:
156
        $(Q)for dir in $(SWDIRS); do if [ -d ../$$dir ]; then $(MAKE) -C ../$$dir clean; fi; done
157
        $(Q)rm -f $(PROCESSED_DEFINES)

powered by: WebSVN 2.1.0

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