| 1 | # |
| 2 | # Authors: Wolfgang Spraul <wolfgang@sharism.cc> |
| 3 | # |
| 4 | # This program is free software; you can redistribute it and/or |
| 5 | # modify it under the terms of the GNU General Public License |
| 6 | # as published by the Free Software Foundation; either version |
| 7 | # 3 of the License, or (at your option) any later version. |
| 8 | # |
| 9 | |
| 10 | ifeq ($(CROSS_COMPILE),) |
| 11 | $(warning CROSS_COMPILE variable not set, should point to .../mipsel-openwrt-linux-) |
| 12 | endif |
| 13 | |
| 14 | INCPATH = -I. -I../target-common/ |
| 15 | CFLAGS = -O2 -fno-unit-at-a-time -fno-zero-initialized-in-bss -mips32 -fno-pic \ |
| 16 | -mno-abicalls $(INCPATH) |
| 17 | LDFLAGS = -nostdlib -EL -T target.ld |
| 18 | VPATH = ../target-common |
| 19 | |
| 20 | OBJS = head.o stage1.o serial.o board-jz4740.o board-jz4760.o |
| 21 | |
| 22 | all: stage1.bin |
| 23 | |
| 24 | stage1.bin: stage1.elf |
| 25 | $(CROSS_COMPILE)objcopy -O binary $< $@+ |
| 26 | $(CROSS_COMPILE)objdump -D $< > stage1.dump |
| 27 | $(CROSS_COMPILE)objdump -h $< > stage1.map |
| 28 | $(CROSS_COMPILE)nm -n $< > System.map |
| 29 | chmod -x $@+ |
| 30 | mv -f $@+ $@ |
| 31 | |
| 32 | stage1.elf: $(OBJS) |
| 33 | $(CROSS_COMPILE)ld $(LDFLAGS) $(OBJS) -o $@ |
| 34 | .c.o: |
| 35 | $(CROSS_COMPILE)gcc $(CFLAGS) -c $< -o $@ |
| 36 | .S.o: |
| 37 | $(CROSS_COMPILE)gcc $(CFLAGS) -c $< -o $@ |
| 38 | clean: |
| 39 | rm -f stage1.bin stage1.elf stage1.dump stage1.map |
| 40 | rm -f $(OBJS) |
| 41 | rm -f System.map |
| 42 | |