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

Subversion Repositories zap

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

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

powered by: WebSVN 2.1.0

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