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

Subversion Repositories zap

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

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

Line No. Rev Author Line
1 26 Revanth
##################################################
2
#                                                #
3
#              THE ZAP PROJECT                   #
4
#          Released under the GNU GPL v2         #
5
#                                                #
6
##################################################
7
#                                                #
8
# This is a common makefile to be used for all   #
9
# testcases. Note that all paths are relative    #
10
# to the testcase directory. Do a make c2asm     #
11
# if you need the assembly version of C files.   #
12
#                                                #
13
##################################################
14
 
15
.DEFAULT_GOAL = all
16
 
17
.PHONY: clean
18
.PHONY: c2asm
19
.PHONY: compiler
20
.PHONY: dirs
21 32 Revanth
.PHONY: cleanall
22 26 Revanth
 
23 38 Revanth
ARCH         := armv4t
24 26 Revanth
TC           := $(shell basename `pwd`)
25
GCC_PATH     := ../../../obj/gcc-arm-none-eabi-*/bin/
26
SCRIPT_PATH  := ../../scripts/
27
C_FILES      := $(wildcard *.c)
28
S_FILES      := $(wildcard *.s)
29 32 Revanth
H_FILES      := $(wildcard *.h)
30 26 Revanth
LD_FILE      := $(wildcard *.ld)
31 32 Revanth
COBJFILES    := $(patsubst %.c,../../../obj/ts/$(TC)/%_c.o,$(C_FILES))
32
AOBJFILES    := $(patsubst %.s,../../../obj/ts/$(TC)/%_s.o,$(S_FILES))
33 26 Revanth
GCC_SRC      := ../../../sw/gcc-arm-none-eabi-*-linux.tar.*
34 38 Revanth
CFLAGS       := -c -msoft-float -mfloat-abi=soft -march=$(ARCH) -g
35
SFLAGS       := -march=$(ARCH) -g
36 26 Revanth
LFLAGS       := -T
37
OFLAGS       := -O binary
38
CC           := $(GCC_PATH)/arm-none-eabi-gcc
39
AS           := $(GCC_PATH)/arm-none-eabi-as
40
LD           := $(GCC_PATH)/arm-none-eabi-ld
41
OB           := $(GCC_PATH)/arm-none-eabi-objcopy
42
 
43 32 Revanth
# This rule will convert every ASM to file its corresponding object file.
44
../../../obj/ts/$(TC)/%_s.o: %.s
45 26 Revanth
        $(AS) $(SFLAGS) $^ -o $@
46
 
47 32 Revanth
# This rule will convert every C file to its corresponding object file.
48
../../../obj/ts/$(TC)/%_c.o: %.c $(H_FILES)
49
        $(CC) $(CFLAGS) $< -o $@
50 26 Revanth
 
51 32 Revanth
# Rule to convert the object files to an ELF file.
52
../../../obj/ts/$(TC)/$(TC).elf: $(LD_FILE) $(AOBJFILES) $(COBJFILES)
53
        $(LD) $(LFLAGS) $^ -o $@
54 26 Revanth
 
55 32 Revanth
# Rule to generate a BIN file.
56
../../../obj/ts/$(TC)/$(TC).bin: ../../../obj/ts/$(TC)/$(TC).elf
57 26 Revanth
        $(OB) $(OFLAGS) $^ $@
58
 
59 32 Revanth
# Rule to convert the bin file to a Verilog image.
60
../../../obj/ts/$(TC)/zap_mem.v: ../../../obj/ts/$(TC)/$(TC).bin
61 26 Revanth
        perl $(SCRIPT_PATH)/bin2vlog.pl $< $@
62
 
63 32 Revanth
# Rule to run the simulation.
64
all: dirs $(CC) ../../../obj/ts/$(TC)/zap_mem.v
65 26 Revanth
        perl $(SCRIPT_PATH)/run_sim.pl +test+$(TC)
66
 
67
$(AS):
68
$(LD):
69
$(OB):
70
 
71
$(CC): $(GCC_SRC)
72 32 Revanth
        mkdir -p ../../../obj/ts/$(TC)/
73 26 Revanth
        tar -xvf $(GCC_SRC) -C ../../../obj/
74
        touch $@
75
 
76
dirs:
77
        bash ../../scripts/check_arc.sh
78 32 Revanth
        mkdir -p ../../../obj/ts/$(TC)/
79
        touch ../../../obj/ts/$(TC)/
80 26 Revanth
 
81
clean:
82 32 Revanth
        mkdir -p ../../../obj/ts/$(TC)/
83
        rm -fv  ../../../obj/ts/$(TC)/*
84 26 Revanth
 
85 32 Revanth
cleanall:
86
        rm -fv  ../../../obj/ts/$(TC)/*
87
        rm -rfv ../../../obj/ts/$(TC)/../../gcc-arm-none-*
88 26 Revanth
 
89 32 Revanth
c2asm:
90 38 Revanth
        $(CC) -S $(CFLAGS) $(X) -o ../../../obj/ts/$(TC)/$(X).asm
91 32 Revanth
 
92 26 Revanth
print-%  : ; @echo $* = $($*)
93
 

powered by: WebSVN 2.1.0

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