1 |
2 |
idiolatrie |
#------------------------------------------------------------------------------#
|
2 |
4 |
idiolatrie |
# Common Makefile #
|
3 |
2 |
idiolatrie |
#------------------------------------------------------------------------------#
|
4 |
4 |
idiolatrie |
# Copyright (C) 2011 Mathias Hoertnagl, mathias.hoertnagl@gmail.com #
|
5 |
2 |
idiolatrie |
# #
|
6 |
|
|
# This program is free software; you can redistribute it and/or modify it #
|
7 |
|
|
# under the terms of the GNU General Public License as published by the Free #
|
8 |
|
|
# Software Foundation; either version 3 of the License, or (at your option) #
|
9 |
|
|
# any later version. #
|
10 |
|
|
# This program is distributed in the hope that it will be useful, but WITHOUT #
|
11 |
|
|
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
|
12 |
|
|
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
|
13 |
|
|
# more details. #
|
14 |
|
|
# You should have received a copy of the GNU General Public License along with #
|
15 |
|
|
# this program; if not, see . #
|
16 |
|
|
#------------------------------------------------------------------------------#
|
17 |
|
|
TOOL_DIR = /usr/local/mips-elf/bin/mips-elf-
|
18 |
|
|
SRC_DIR = ../
|
19 |
|
|
BIN_DIR = $(SRC_DIR)bin/
|
20 |
|
|
COM_DIR = $(SRC_DIR)common/
|
21 |
|
|
LIB_DIR = $(SRC_DIR)lib/
|
22 |
|
|
INC_DIR = $(SRC_DIR)lib/include/
|
23 |
|
|
|
24 |
|
|
LINK = $(COM_DIR)bram.lds
|
25 |
|
|
LINK2 = $(COM_DIR)flash.lds
|
26 |
|
|
|
27 |
|
|
VPATH = $(SRC_DIR):$(COM_DIR):$(LIB_DIR):$(INC_DIR)
|
28 |
|
|
|
29 |
|
|
CFLAGS = -march=r3000 -c -s -O2 -nostdlib -nodefaultlibs -std=c99 -Wall -w -I$(INC_DIR)
|
30 |
|
|
ASFLAGS =
|
31 |
|
|
ARFLAGS = rcs
|
32 |
|
|
LDFLAGS = -s -N -nodefaultlibs -nostdlib -T$(LINK) -Ttext 0 -eboot -Map mem.map
|
33 |
|
|
LDFLAGS2 = -s -N -nodefaultlibs -nostdlib -T$(LINK2) -Ttext 0x20000000 -estart -Map mem.map
|
34 |
|
|
OCPFLAGS = -I elf32-big -O binary
|
35 |
|
|
DMPFLAGS = --disassemble-all
|
36 |
|
|
|
37 |
|
|
GCC = $(TOOL_DIR)gcc.exe $(CFLAGS)
|
38 |
|
|
AS = $(TOOL_DIR)as.exe $(ASFLAGS)
|
39 |
|
|
AR = $(TOOL_DIR)ar.exe $(ARFLAGS)
|
40 |
|
|
LD = $(TOOL_DIR)ld.exe $(LDFLAGS)
|
41 |
|
|
LD2 = $(TOOL_DIR)ld.exe $(LDFLAGS2)
|
42 |
|
|
OPC = $(TOOL_DIR)objcopy.exe $(OCPFLAGS)
|
43 |
|
|
DMP = $(TOOL_DIR)objdump.exe $(DMPFLAGS)
|
44 |
|
|
RM = rm
|
45 |
|
|
MEM = python $(COM_DIR)vhd.py
|
46 |
|
|
MEM2 = python $(COM_DIR)vhd2.py
|
47 |
|
|
LOAD = python $(COM_DIR)upload.py
|
48 |
|
|
|
49 |
|
|
%.o : %.c
|
50 |
|
|
$(GCC) $< -o $@
|
51 |
|
|
|
52 |
|
|
%.o : %.s
|
53 |
|
|
$(AS) $< -o $@
|
54 |
|
|
|
55 |
|
|
.PHONY: clean
|
56 |
|
|
clean :
|
57 |
|
|
-@$(RM) *.o *.bin *.axf *.lst *.map
|