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

Subversion Repositories zap

[/] [zap/] [trunk/] [src/] [scripts/] [makefile] - Blame information for rev 41

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

Line No. Rev Author Line
1 41 Revanth
#// -----------------------------------------------------------------------------
2
#// --                                                                         --
3
#// --                   (C) 2016-2018 Revanth Kamaraj.                        --
4
#// --                                                                         --
5
#// -- --------------------------------------------------------------------------
6
#// --                                                                         --
7
#// -- This program is free software; you can redistribute it and/or           --
8
#// -- modify it under the terms of the GNU General Public License             --
9
#// -- as published by the Free Software Foundation; either version 2          --
10
#// -- of the License, or (at your option) any later version.                  --
11
#// --                                                                         --
12
#// -- This program is distributed in the hope that it will be useful,         --
13
#// -- but WITHOUT ANY WARRANTY; without even the implied warranty of          --
14
#// -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the           --
15
#// -- GNU General Public License for more details.                            --
16
#// --                                                                         --
17
#// -- You should have received a copy of the GNU General Public License       --
18
#// -- along with this program; if not, write to the Free Software             --
19
#// -- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA           --
20
#// -- 02110-1301, USA.                                                        --
21
#// --                                                                         --
22
#// -----------------------------------------------------------------------------
23
 
24 26 Revanth
##################################################
25
#                                                #
26
# This is a common makefile to be used for all   #
27
# testcases. Note that all paths are relative    #
28
# to the testcase directory. Do a make c2asm     #
29
# if you need the assembly version of C files.   #
30
#                                                #
31
##################################################
32
 
33
.DEFAULT_GOAL = all
34
 
35
.PHONY: clean
36
.PHONY: c2asm
37
.PHONY: compiler
38
.PHONY: dirs
39 32 Revanth
.PHONY: cleanall
40 26 Revanth
 
41 39 Revanth
ARCH         := armv5t
42 26 Revanth
TC           := $(shell basename `pwd`)
43
GCC_PATH     := ../../../obj/gcc-arm-none-eabi-*/bin/
44
SCRIPT_PATH  := ../../scripts/
45
C_FILES      := $(wildcard *.c)
46
S_FILES      := $(wildcard *.s)
47 32 Revanth
H_FILES      := $(wildcard *.h)
48 26 Revanth
LD_FILE      := $(wildcard *.ld)
49 32 Revanth
COBJFILES    := $(patsubst %.c,../../../obj/ts/$(TC)/%_c.o,$(C_FILES))
50
AOBJFILES    := $(patsubst %.s,../../../obj/ts/$(TC)/%_s.o,$(S_FILES))
51 26 Revanth
GCC_SRC      := ../../../sw/gcc-arm-none-eabi-*-linux.tar.*
52 38 Revanth
CFLAGS       := -c -msoft-float -mfloat-abi=soft -march=$(ARCH) -g
53
SFLAGS       := -march=$(ARCH) -g
54 26 Revanth
LFLAGS       := -T
55
OFLAGS       := -O binary
56
CC           := $(GCC_PATH)/arm-none-eabi-gcc
57
AS           := $(GCC_PATH)/arm-none-eabi-as
58
LD           := $(GCC_PATH)/arm-none-eabi-ld
59
OB           := $(GCC_PATH)/arm-none-eabi-objcopy
60
 
61 32 Revanth
# This rule will convert every ASM to file its corresponding object file.
62
../../../obj/ts/$(TC)/%_s.o: %.s
63 26 Revanth
        $(AS) $(SFLAGS) $^ -o $@
64
 
65 32 Revanth
# This rule will convert every C file to its corresponding object file.
66
../../../obj/ts/$(TC)/%_c.o: %.c $(H_FILES)
67
        $(CC) $(CFLAGS) $< -o $@
68 26 Revanth
 
69 32 Revanth
# Rule to convert the object files to an ELF file.
70
../../../obj/ts/$(TC)/$(TC).elf: $(LD_FILE) $(AOBJFILES) $(COBJFILES)
71
        $(LD) $(LFLAGS) $^ -o $@
72 26 Revanth
 
73 32 Revanth
# Rule to generate a BIN file.
74
../../../obj/ts/$(TC)/$(TC).bin: ../../../obj/ts/$(TC)/$(TC).elf
75 26 Revanth
        $(OB) $(OFLAGS) $^ $@
76
 
77 32 Revanth
# Rule to convert the bin file to a Verilog image.
78
../../../obj/ts/$(TC)/zap_mem.v: ../../../obj/ts/$(TC)/$(TC).bin
79 26 Revanth
        perl $(SCRIPT_PATH)/bin2vlog.pl $< $@
80
 
81 32 Revanth
# Rule to run the simulation.
82
all: dirs $(CC) ../../../obj/ts/$(TC)/zap_mem.v
83 26 Revanth
        perl $(SCRIPT_PATH)/run_sim.pl +test+$(TC)
84
 
85
$(AS):
86
$(LD):
87
$(OB):
88
 
89
$(CC): $(GCC_SRC)
90 32 Revanth
        mkdir -p ../../../obj/ts/$(TC)/
91 26 Revanth
        tar -xvf $(GCC_SRC) -C ../../../obj/
92
        touch $@
93
 
94
dirs:
95
        bash ../../scripts/check_arc.sh
96 32 Revanth
        mkdir -p ../../../obj/ts/$(TC)/
97
        touch ../../../obj/ts/$(TC)/
98 26 Revanth
 
99
clean:
100 32 Revanth
        mkdir -p ../../../obj/ts/$(TC)/
101
        rm -fv  ../../../obj/ts/$(TC)/*
102 26 Revanth
 
103 32 Revanth
cleanall:
104
        rm -fv  ../../../obj/ts/$(TC)/*
105
        rm -rfv ../../../obj/ts/$(TC)/../../gcc-arm-none-*
106 26 Revanth
 
107 32 Revanth
c2asm:
108 38 Revanth
        $(CC) -S $(CFLAGS) $(X) -o ../../../obj/ts/$(TC)/$(X).asm
109 32 Revanth
 
110 26 Revanth
print-%  : ; @echo $* = $($*)
111
 

powered by: WebSVN 2.1.0

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