1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/Makefile Fri May 22 18:37:44 2015 +0200
1.3 @@ -0,0 +1,63 @@
1.4 +# Makefile - Build the NanoNote payload
1.5 +#
1.6 +# Copyright (C) 2015 Paul Boddie <paul@boddie.org.uk>
1.7 +# Copyright (C) Xiangfu Liu <xiangfu@sharism.cc>
1.8 +#
1.9 +# This program is free software; you can redistribute it and/or modify it under
1.10 +# the terms of the GNU General Public License as published by the Free Software
1.11 +# Foundation; either version 3 of the License, or (at your option) any later
1.12 +# version.
1.13 +#
1.14 +# This program is distributed in the hope that it will be useful, but WITHOUT
1.15 +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
1.16 +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
1.17 +# details.
1.18 +#
1.19 +# You should have received a copy of the GNU General Public License along with
1.20 +# this program. If not, see <http://www.gnu.org/licenses/>.
1.21 +
1.22 +ARCH = mipsel-linux-gnu
1.23 +CC = $(ARCH)-gcc
1.24 +LD = $(ARCH)-ld
1.25 +NM = $(ARCH)-nm
1.26 +OBJCOPY=$(ARCH)-objcopy
1.27 +OBJDUMP=$(ARCH)-objdump
1.28 +
1.29 +CFLAGS = -Wall -fno-unit-at-a-time -fno-zero-initialized-in-bss \
1.30 + -march=mips32 -mno-abi-calls \
1.31 + -Iinclude
1.32 +LDFLAGS = -nostdlib -EL -T target.ld
1.33 +
1.34 +PAYLOAD = stage1.bin
1.35 +TARGET = $(PAYLOAD:.bin=.elf)
1.36 +DUMP = $(PAYLOAD:.bin=.dump)
1.37 +MAP = $(PAYLOAD:.bin=.map)
1.38 +SRC = head.S stage1.c board-jz4740.c
1.39 +OBJ = $(SRC:.c=.o)
1.40 +
1.41 +.PHONY: all clean distclean
1.42 +
1.43 +all: $(PAYLOAD)
1.44 +
1.45 +clean:
1.46 + rm -f $(OBJ) $(TARGET) $(PAYLOAD)
1.47 +
1.48 +distclean: clean
1.49 + echo "Nothing else to clean."
1.50 +
1.51 +$(TARGET): $(OBJ)
1.52 + $(LD) $(LDFLAGS) $(OBJ) -o $@
1.53 +
1.54 +.bin.elf:
1.55 + $(OBJCOPY) -O binary $< $@+
1.56 + $(OBJDUMP) -D $< > $(DUMP)
1.57 + $(OBJDUMP) -h $< > $(MAP)
1.58 + $(NM) -n $< > System.map
1.59 + chmod -x $@+
1.60 + mv -f $@+ $@
1.61 +
1.62 +.c.o:
1.63 + $(CC) -c $(CFLAGS) $< -o $@
1.64 +
1.65 +.S.o:
1.66 + $(CC) -c $(CFLAGS) $< -o $@