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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [orpsocv2/] [sw/] [Makefile.inc] - Diff between revs 349 and 360

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 349 Rev 360
######################################################################
######################################################################
####                                                              ####
####                                                              ####
#### Common makefile for inclusion by others                      ####
#### Common makefile for inclusion by others                      ####
####                                                              ####
####                                                              ####
######################################################################
######################################################################
####                                                              ####
####                                                              ####
#### Copyright (C) 2010 Authors and OPENCORES.ORG                 ####
#### Copyright (C) 2010 Authors and OPENCORES.ORG                 ####
####                                                              ####
####                                                              ####
#### This source file may be used and distributed without         ####
#### This source file may be used and distributed without         ####
#### restriction provided that this copyright statement is not    ####
#### restriction provided that this copyright statement is not    ####
#### removed from the file and that any derivative work contains  ####
#### removed from the file and that any derivative work contains  ####
#### the original copyright notice and the associated disclaimer. ####
#### the original copyright notice and the associated disclaimer. ####
####                                                              ####
####                                                              ####
#### This source file is free software; you can redistribute it   ####
#### This source file is free software; you can redistribute it   ####
#### and/or modify it under the terms of the GNU Lesser General   ####
#### and/or modify it under the terms of the GNU Lesser General   ####
#### Public License as published by the Free Software Foundation; ####
#### Public License as published by the Free Software Foundation; ####
#### either version 2.1 of the License, or (at your option) any   ####
#### either version 2.1 of the License, or (at your option) any   ####
#### later version.                                               ####
#### later version.                                               ####
####                                                              ####
####                                                              ####
#### This source is distributed in the hope that it will be       ####
#### This source is distributed in the hope that it will be       ####
#### useful, but WITHOUT ANY WARRANTY; without even the implied   ####
#### useful, but WITHOUT ANY WARRANTY; without even the implied   ####
#### warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ####
#### warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ####
#### PURPOSE.  See the GNU Lesser General Public License for more ####
#### PURPOSE.  See the GNU Lesser General Public License for more ####
#### details.                                                     ####
#### details.                                                     ####
####                                                              ####
####                                                              ####
#### You should have received a copy of the GNU Lesser General    ####
#### You should have received a copy of the GNU Lesser General    ####
#### Public License along with this source; if not, download it   ####
#### Public License along with this source; if not, download it   ####
#### from http://www.opencores.org/lgpl.shtml                     ####
#### from http://www.opencores.org/lgpl.shtml                     ####
####                                                              ####
####                                                              ####
######################################################################
######################################################################
 
 
DESIGN_NAME=design
DESIGN_NAME=orpsoc
 
 
OR32_TOOL_PREFIX=or32-elf-
OR32_TOOL_PREFIX=or32-elf-
OR32_LD=$(OR32_TOOL_PREFIX)ld
OR32_LD=$(OR32_TOOL_PREFIX)ld
OR32_AS=$(OR32_TOOL_PREFIX)as
OR32_AS=$(OR32_TOOL_PREFIX)as
OR32_CC=$(OR32_TOOL_PREFIX)gcc
OR32_CC=$(OR32_TOOL_PREFIX)gcc
OR32_AR=$(OR32_TOOL_PREFIX)ar
OR32_AR=$(OR32_TOOL_PREFIX)ar
OR32_RANLIB=$(OR32_TOOL_PREFIX)ranlib
OR32_RANLIB=$(OR32_TOOL_PREFIX)ranlib
OR32_OBJDUMP=$(OR32_TOOL_PREFIX)objdump
OR32_OBJDUMP=$(OR32_TOOL_PREFIX)objdump
OR32_OBJCOPY=$(OR32_TOOL_PREFIX)objcopy
OR32_OBJCOPY=$(OR32_TOOL_PREFIX)objcopy
VECTORS_OBJ ?=../support/crt0.o
VECTORS_OBJ ?=../support/crt0.o
SUPPORT_LIB ?=../support/$(DESIGN_NAME)_support.a
SUPPORT_LIB ?=../support/$(DESIGN_NAME)_support.a
DESIGN_DEFINES_HEADER=../include/design-defines.h
DESIGN_DEFINES_HEADER=../include/design-defines.h
SUPPORT_FILES ?=$(SUPPORT_LIB)
SUPPORT_FILES ?=$(SUPPORT_LIB)
# Machine flags - uncomment one or create custom combination of flags
# Machine flags - uncomment one or create custom combination of flags
# All software div, mul and FPU
# All software div, mul and FPU
#MACH_FLAGS ?=-msoft-mul -msoft-div -msoft-float
#MACH_FLAGS ?=-msoft-mul -msoft-div -msoft-float
# FPGA default - only hardware multiply
# FPGA default - only hardware multiply
#MACH_FLAGS ?=-mhard-mul -msoft-div -msoft-float
#MACH_FLAGS ?=-mhard-mul -msoft-div -msoft-float
# All hardware flags
# All hardware flags
#MARCH_FLAGS ?=-mhard-mul -mhard-div -mhard-float
#MARCH_FLAGS ?=-mhard-mul -mhard-div -mhard-float
# Hardware integer arith, soft float
# Hardware integer arith, soft float
MARCH_FLAGS ?=-mhard-mul -mhard-div -msoft-float
MARCH_FLAGS ?=-mhard-mul -mhard-div -msoft-float
OR32_CFLAGS ?=-g -nostdlib -O2 -I../include $(MARCH_FLAGS)
OR32_CFLAGS ?=-g -nostdlib -O2 -I../include $(MARCH_FLAGS)
OR32_LDFLAGS ?=-lgcc -T../support/or32.ld -e 256
OR32_LDFLAGS ?=-lgcc -T../support/or32.ld -e 256
# This path must be correct!
# This path must be correct!
# Currently no overall design defines file - to come!
DESIGN_VERILOG_DEFINES=../../rtl/verilog/include/$(DESIGN_NAME)-defines.v
#DESIGN_VERILOG_DEFINES=../../rtl/verilog/include/$(DESIGN_NAME)-defines.v
DESIGN_PROCESSED_VERILOG_DEFINES=../include/$(DESIGN_NAME)-defines.h
#DESIGN_PROCESSED_VERILOG_DEFINES=../include/$(DESIGN_NAME)-defines.h
 
 
 
OR1200_VERILOG_DEFINES=../../rtl/verilog/or1200_defines.v
OR1200_VERILOG_DEFINES=../../rtl/verilog/include/or1200_defines.v
OR1200_PROCESSED_VERILOG_DEFINES=../include/or1200-defines.h
OR1200_PROCESSED_VERILOG_DEFINES=../include/or1200-defines.h
#PROCESSED_DEFINES=$(DESIGN_PROCESSED_VERILOG_DEFINES) $(OR1200_PROCESSED_VERILOG_DEFINES)
#PROCESSED_DEFINES=$(DESIGN_PROCESSED_VERILOG_DEFINES) $(OR1200_PROCESSED_VERILOG_DEFINES)
PROCESSED_DEFINES= $(OR1200_PROCESSED_VERILOG_DEFINES)
PROCESSED_DEFINES= $(OR1200_PROCESSED_VERILOG_DEFINES)
ELF_DEPENDS+=$(VECTORS_OBJ) $(PROCESSED_DEFINES) $(SUPPORT_FILES)
ELF_DEPENDS+=$(VECTORS_OBJ) $(PROCESSED_DEFINES) $(SUPPORT_FILES)
# Set V=1 when calling make to enable verbose output
# Set V=1 when calling make to enable verbose output
# mainly for debugging purposes.
# mainly for debugging purposes.
ifeq ($(V), 1)
ifeq ($(V), 1)
Q=
Q=
else
else
Q ?=@
Q ?=@
endif
endif
# Our local utilities
# Our local utilities
UTILS_BIN2HEX=../utils/bin2hex
UTILS_BIN2HEX=../utils/bin2hex
$(UTILS_BIN2HEX):
$(UTILS_BIN2HEX):
        $(Q)$(MAKE) -C ../utils bin2hex
        $(Q)$(MAKE) -C ../utils bin2hex
UTILS_BIN2VMEM=../utils/bin2vmem
UTILS_BIN2VMEM=../utils/bin2vmem
$(UTILS_BIN2VMEM):
$(UTILS_BIN2VMEM):
        $(Q)$(MAKE) -C ../utils bin2vmem
        $(Q)$(MAKE) -C ../utils bin2vmem
# Rule to generate C header file from Verilog file with `defines in it
# Rule to generate C header file from Verilog file with `defines in it
$(DESIGN_PROCESSED_VERILOG_DEFINES): $(DESIGN_VERILOG_DEFINES)
$(DESIGN_PROCESSED_VERILOG_DEFINES): $(DESIGN_VERILOG_DEFINES)
        $(Q)echo; echo "\t### Creating software defines header from verilog defines ###";
        $(Q)echo; echo "\t### Creating software defines header from verilog defines ###";
        $(Q)echo "//This file is autogenerated from "$<" do not change!" > ../include/$@
        $(Q)echo "//This file is autogenerated from "$<" do not change!" > ../include/$@
        $(Q)echo "#ifndef _"$(DESIGN_NAME)"_DEFINES_H_" >> ../include/$@
        $(Q)echo "#ifndef _"$(DESIGN_NAME)"_DEFINES_H_" >> ../include/$@
        $(Q)echo "#define _"$(DESIGN_NAME)"_DEFINES_H_" >> ../include/$@
        $(Q)echo "#define _"$(DESIGN_NAME)"_DEFINES_H_" >> ../include/$@
        $(Q)cat $< | sed s://.*::g | sed 's/'\`'/'#'/g' >> ../include/$@
        $(Q)cat $< | sed s://.*::g | sed 's/'\`'/'#'/g' >> ../include/$@
        $(Q)echo "#endif" >> ../include/$@
        $(Q)echo "#endif" >> ../include/$@
        $(Q)echo; echo >> ../include/$@
        $(Q)echo; echo >> ../include/$@
# This works (doesn't error), but for now we have to remove all of the numbers
# This works (doesn't error), but for now we have to remove all of the numbers
# in verilog format, eg. 8'b0010_0000 or 32'h0000_0f00, or 32'd256 etc. as it's
# in verilog format, eg. 8'b0010_0000 or 32'h0000_0f00, or 32'd256 etc. as it's
# not so straight forward to convert these
# not so straight forward to convert these
$(OR1200_PROCESSED_VERILOG_DEFINES): $(OR1200_VERILOG_DEFINES)
$(OR1200_PROCESSED_VERILOG_DEFINES): $(OR1200_VERILOG_DEFINES)
        $(Q)echo; echo "\t### Creating OR1200 software defines header from verilog defines ###";
        $(Q)echo; echo "\t### Creating OR1200 software defines header from verilog defines ###";
        $(Q)echo "//This file is autogenerated from "$<" do not change!" > ../include/$@
        $(Q)echo "//This file is autogenerated from "$<" do not change!" > ../include/$@
        $(Q)echo "#ifndef _OR1200_DEFINES_H_" >> ../include/$@
        $(Q)echo "#ifndef _OR1200_DEFINES_H_" >> ../include/$@
        $(Q)echo "#define _OR1200_DEFINES_H_" >> ../include/$@
        $(Q)echo "#define _OR1200_DEFINES_H_" >> ../include/$@
        $(Q)cat $< | sed s://.*::g | grep -v \'[dhb] | sed 's/'\`'/'#'/g' >> ../include/$@
        $(Q)cat $< | sed s://.*::g | grep -v \'[dhb] | sed 's/'\`'/'#'/g' >> ../include/$@
        $(Q)echo "#endif" >> ../include/$@
        $(Q)echo "#endif" >> ../include/$@
        $(Q)echo; echo >> ../include/$@
        $(Q)echo; echo >> ../include/$@
# Default make
# Default make
%.flashin: %.bin $(UTILS_BIN2HEX)
%.flashin: %.bin $(UTILS_BIN2HEX)
        $(Q)$(UTILS_BIN2HEX) $< 1  -size_word > $@
        $(Q)$(UTILS_BIN2HEX) $< 1  -size_word > $@
%.vmem: %.bin $(UTILS_BIN2VMEM)
%.vmem: %.bin $(UTILS_BIN2VMEM)
        $(Q)$(UTILS_BIN2VMEM) $< > $@
        $(Q)$(UTILS_BIN2VMEM) $< > $@
%.elf: %.c $(ELF_DEPENDS)
%.elf: %.c $(ELF_DEPENDS)
        $(Q)$(OR32_CC) $^ $(OR32_CFLAGS) $(OR32_LDFLAGS) -o $@
        $(Q)$(OR32_CC) $^ $(OR32_CFLAGS) $(OR32_LDFLAGS) -o $@
%.elf: %.S $(ELF_DEPENDS)
%.elf: %.S $(ELF_DEPENDS)
        $(Q)$(OR32_CC) $^ $(OR32_CFLAGS) $(OR32_LDFLAGS) -o $@
        $(Q)$(OR32_CC) $^ $(OR32_CFLAGS) $(OR32_LDFLAGS) -o $@
%.o: %.S
%.o: %.S
        $(Q)$(OR32_CC) $(OR32_CFLAGS) -c $< -o $@
        $(Q)$(OR32_CC) $(OR32_CFLAGS) -c $< -o $@
%.o: %.c
%.o: %.c
        $(Q)$(OR32_CC) $(OR32_CFLAGS) -c $< -o $@
        $(Q)$(OR32_CC) $(OR32_CFLAGS) -c $< -o $@
# Recompile the support lib if we detect any of the drivers having changed
# Recompile the support lib if we detect any of the drivers having changed
SUPPORT_LIB_SRCS=$(shell ls ../support/*.[cS])
SUPPORT_LIB_SRCS=$(shell ls ../support/*.[cS])
SUPPORT_LIB_SRCS +=$(shell ls ../include/*.h)
SUPPORT_LIB_SRCS +=$(shell ls ../include/*.h)
$(SUPPORT_LIB): $(SUPPORT_LIB_SRCS)
$(SUPPORT_LIB): $(SUPPORT_LIB_SRCS)
        $(Q)echo; echo "\t### Building software support library ###"; echo
        $(Q)echo; echo "\t### Building software support library ###"; echo
        $(Q)$(MAKE) -C ../support $(DESIGN_NAME)_support.a
        $(Q)$(MAKE) -C ../support $(DESIGN_NAME)_support.a
$(VECTORS_OBJ):
$(VECTORS_OBJ):
        $(Q)$(MAKE) -C ../support crt0.o
        $(Q)$(MAKE) -C ../support crt0.o
# This relies on the local clean rule of each makefile
# This relies on the local clean rule of each makefile
clean-all: distclean
clean-all: distclean
clean-support:
clean-support:
        $(Q)$(MAKE) -C ../support clean
        $(Q)$(MAKE) -C ../support clean
# List of software directories, exclude include/
# List of software directories, exclude include/
SWDIRS=$(shell ls ../ | grep -v include)
SWDIRS=$(shell ls ../ | grep -v include)
distclean:
distclean:
        $(Q)for dir in $(SWDIRS); do if [ -d ../$$dir ]; then $(MAKE) -C ../$$dir clean; fi; done
        $(Q)for dir in $(SWDIRS); do if [ -d ../$$dir ]; then $(MAKE) -C ../$$dir clean; fi; done
        $(Q)rm -f $(PROCESSED_DEFINES)
        $(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.