forked from hpvb/MIPS_ARC_memtest
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
53 lines (38 loc) · 1.31 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
.ONESHELL:
PROGNAME=memtest
CC=mips64-linux-gnu-gcc
LD=mips64-linux-gnu-ld
CFLAGS=-mabi=32 -march=mips1 -mfp32 -G0 -EL -nostdlib -fno-builtin -mmemcpy -mno-abicalls -fno-pic -mno-unaligned-access
LINKFLAGS=-EL -G0 -static --oformat=elf32-tradlittlemips -x -N -Ttext 80200000 -e start
DEPS =
ARCOBJ = arclib/arc.o arclib/stdio.o arclib/stdlib.o arclib/string.o
# start.o *must* be first
OBJ = start.o $(ARCOBJ) main.o
all: $(PROGNAME).exe
iso: $(PROGNAME).iso
%.o: %.c $(DEPS)
$(CC) -c -o $@ $< $(CFLAGS)
%.o: %.S $(DEPS)
$(CC) -c -o $@ $< $(CFLAGS)
$(PROGNAME).exe: $(PROGNAME).elf tools/binutils-2.24.51.0.1/binutils/objcopy
tools/binutils-2.24.51.0.1/binutils/objcopy -O ecoff-littlemips -j .text -j .data -j .bss -j .rodata $(PROGNAME).elf $@
$(PROGNAME).elf: $(OBJ)
$(LD) -o $@ $^ $(LINKFLAGS)
$(PROGNAME).iso: $(PROGNAME).exe
genisoimage -o $@ $(PROGNAME).exe
tools/binutils-2.24.51.0.1/binutils/objcopy:
mkdir -p tools
cd tools
curl -O https://cdn.kernel.org/pub/linux/devel/binutils/binutils-2.24.51.0.1.tar.bz2
tar xf binutils-2.24.51.0.1.tar.bz2
cd binutils-2.24.51.0.1
./configure --target=mipsel-ecoff --enable-targets=mipsel-elf --disable-werror
make -j$(nproc)
cd ../..
distclean:
rm -rf tools/
rm -f *.o *.exe *.elf *.iso
rm -f arclib/*.o
clean:
rm -f *.o *.exe *.elf *.iso
rm -f arclib/*.o