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

Subversion Repositories zap

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

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
 
40 39 Revanth
ARCH         := armv5t
41 26 Revanth
TC           := $(shell basename `pwd`)
42
SCRIPT_PATH  := ../../scripts/
43
C_FILES      := $(wildcard *.c)
44
S_FILES      := $(wildcard *.s)
45 32 Revanth
H_FILES      := $(wildcard *.h)
46 26 Revanth
LD_FILE      := $(wildcard *.ld)
47 32 Revanth
COBJFILES    := $(patsubst %.c,../../../obj/ts/$(TC)/%_c.o,$(C_FILES))
48
AOBJFILES    := $(patsubst %.s,../../../obj/ts/$(TC)/%_s.o,$(S_FILES))
49 38 Revanth
CFLAGS       := -c -msoft-float -mfloat-abi=soft -march=$(ARCH) -g
50
SFLAGS       := -march=$(ARCH) -g
51 26 Revanth
LFLAGS       := -T
52
OFLAGS       := -O binary
53 43 Revanth
CC           := arm-none-eabi-gcc
54
AS           := arm-none-eabi-as
55
LD           := arm-none-eabi-ld
56
OB           := arm-none-eabi-objcopy
57 26 Revanth
 
58 32 Revanth
# This rule will convert every ASM to file its corresponding object file.
59
../../../obj/ts/$(TC)/%_s.o: %.s
60 26 Revanth
        $(AS) $(SFLAGS) $^ -o $@
61
 
62 32 Revanth
# This rule will convert every C file to its corresponding object file.
63
../../../obj/ts/$(TC)/%_c.o: %.c $(H_FILES)
64
        $(CC) $(CFLAGS) $< -o $@
65 26 Revanth
 
66 32 Revanth
# Rule to convert the object files to an ELF file.
67
../../../obj/ts/$(TC)/$(TC).elf: $(LD_FILE) $(AOBJFILES) $(COBJFILES)
68
        $(LD) $(LFLAGS) $^ -o $@
69 26 Revanth
 
70 32 Revanth
# Rule to generate a BIN file.
71
../../../obj/ts/$(TC)/$(TC).bin: ../../../obj/ts/$(TC)/$(TC).elf
72 26 Revanth
        $(OB) $(OFLAGS) $^ $@
73
 
74 32 Revanth
# Rule to convert the bin file to a Verilog image.
75
../../../obj/ts/$(TC)/zap_mem.v: ../../../obj/ts/$(TC)/$(TC).bin
76 26 Revanth
        perl $(SCRIPT_PATH)/bin2vlog.pl $< $@
77
 
78 32 Revanth
# Rule to run the simulation.
79
all: dirs $(CC) ../../../obj/ts/$(TC)/zap_mem.v
80 26 Revanth
        perl $(SCRIPT_PATH)/run_sim.pl +test+$(TC)
81
 
82 43 Revanth
$(CC):
83 26 Revanth
$(AS):
84
$(LD):
85
$(OB):
86
 
87
dirs:
88 32 Revanth
        mkdir -p ../../../obj/ts/$(TC)/
89
        touch ../../../obj/ts/$(TC)/
90 26 Revanth
 
91
clean:
92 32 Revanth
        mkdir -p ../../../obj/ts/$(TC)/
93
        rm -fv  ../../../obj/ts/$(TC)/*
94 26 Revanth
 
95 32 Revanth
c2asm:
96 38 Revanth
        $(CC) -S $(CFLAGS) $(X) -o ../../../obj/ts/$(TC)/$(X).asm
97 32 Revanth
 
98 26 Revanth
print-%  : ; @echo $* = $($*)
99
 

powered by: WebSVN 2.1.0

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