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

Subversion Repositories amber

[/] [amber/] [trunk/] [sw/] [include/] [common.mk] - Blame information for rev 2

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

Line No. Rev Author Line
1 2 csantifort
# ----------------------------------------------------------------
2
#                                                               //
3
#   common.mk                                                   //
4
#                                                               //
5
#   This file is part of the Amber project                      //
6
#   http://www.opencores.org/project,amber                      //
7
#                                                               //
8
#   Description                                                 //
9
#   Contains common makefile code.                              //
10
#                                                               //
11
#   Author(s):                                                  //
12
#       - Conor Santifort, csantifort.amber@gmail.com           //
13
#                                                               //
14
#/ ///////////////////////////////////////////////////////////////
15
#                                                               //
16
#  Copyright (C) 2010 Authors and OPENCORES.ORG                 //
17
#                                                               //
18
#  This source file may be used and distributed without         //
19
#  restriction provided that this copyright statement is not    //
20
#  removed from the file and that any derivative work contains  //
21
#  the original copyright notice and the associated disclaimer. //
22
#                                                               //
23
#  This source file is free software; you can redistribute it   //
24
#  and/or modify it under the terms of the GNU Lesser General   //
25
#  Public License as published by the Free Software Foundation; //
26
#  either version 2.1 of the License, or (at your option) any   //
27
#  later version.                                               //
28
#                                                               //
29
#  This source is distributed in the hope that it will be       //
30
#  useful, but WITHOUT ANY WARRANTY; without even the implied   //
31
#  warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      //
32
#  PURPOSE.  See the GNU Lesser General Public License for more //
33
#  details.                                                     //
34
#                                                               //
35
#  You should have received a copy of the GNU Lesser General    //
36
#  Public License along with this source; if not, download it   //
37
#  from http://www.opencores.org/lgpl.shtml                     //
38
#                                                               //
39
# ----------------------------------------------------------------
40
 
41
LIBC_OBJ         = ../mini-libc/printf.o ../mini-libc/libc_asm.o ../mini-libc/memcpy.o
42
DEP             += ../include/amber_registers.h ../mini-libc/stdio.h
43
TOOLSPATH        = ../tools
44
AMBER_CROSSTOOL ?= amber-crosstool-not-defined
45
 
46
  AS = $(AMBER_CROSSTOOL)-as
47
  CC = $(AMBER_CROSSTOOL)-gcc
48
 CXX = $(AMBER_CROSSTOOL)-g++
49
  AR = $(AMBER_CROSSTOOL)-ar
50
  LD = $(AMBER_CROSSTOOL)-ld
51
  DS = $(AMBER_CROSSTOOL)-objdump
52
  OC = $(AMBER_CROSSTOOL)-objcopy
53
 ELF = $(TOOLSPATH)/amber-elfsplitter
54
 BMF = $(TOOLSPATH)/amber-memparams.sh
55
 
56
 MMP = $(addsuffix _memparams.v, $(basename $(TGT)))
57
 MEM = $(addsuffix .mem, $(basename $(TGT)))
58
 DIS = $(addsuffix .dis, $(basename $(TGT)))
59
 
60
ifdef USE_MINI_LIBC
61
 OBJ = $(addsuffix .o,   $(basename $(SRC))) $(LIBC_OBJ)
62
else
63
 OBJ = $(addsuffix .o,   $(basename $(SRC)))
64
endif
65
 
66
 
67
ifdef LDS
68
    TLDS = -T $(LDS)
69
else
70
    TLDS =
71
endif
72
 
73
ifndef TGT
74
    TGT = aout.elf
75
endif
76
 
77
ifdef MIN_SIZE
78
    # optimize for size
79
    OPTIMIZE = -Os
80
else
81
    # optimize for speed
82
    OPTIMIZE = -O2
83
endif
84
 
85
 MAP = $(addsuffix .map, $(basename $(TGT)))
86
 
87
 ASFLAGS = -I../include
88
  CFLAGS = -c $(OPTIMIZE) -march=armv2a -mno-thumb-interwork -ffreestanding -I../include
89
 DSFLAGS = -C -S -EL
90
 LDFLAGS = -Bstatic -Map $(MAP) --strip-debug --fix-v4bx
91
 
92
 
93
ifdef USE_MINI_LIBC
94
debug:  mini-libc $(ELF) $(MMP) $(DIS)
95
else
96
debug:  $(ELF) $(MMP) $(DIS)
97
endif
98
 
99
$(MMP): $(MEM)
100
        $(BMF) $(MEM) $(MMP)
101
 
102
$(MEM): $(TGT)
103
        $(ELF) $(TGT) > $(MEM)
104
 
105
$(TGT): $(OBJ)
106
        $(LD) $(LDFLAGS) -o $(TGT) $(TLDS) $(OBJ)
107
        $(OC) -R .comment -R .note $(TGT)
108
 
109
$(OBJ): $(DEP)
110
 
111
mini-libc:
112
        $(MAKE) -s -C ../mini-libc
113
 
114
$(ELF):
115
        $(MAKE) -C $(TOOLSPATH)
116
 
117
$(DIS): $(TGT)
118
        $(DS) $(DSFLAGS) $^ > $@
119
 
120
clean:
121
        @rm -rfv *.o *.elf *.dis *.map *.mem *.v $(MMP)
122
 

powered by: WebSVN 2.1.0

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