1.1 --- a/Makefile Sun Jun 07 20:17:24 2015 +0200
1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3 @@ -1,78 +0,0 @@
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 -# NOTE: -O2 is actually needed to prevent memcpy references, whereas probably
1.30 -# NOTE: one of the -f{freestanding, no-hosted, no-builtin} options should work.
1.31 -# NOTE: See: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56888
1.32 -
1.33 -ASM_INC = /usr/src/linux-headers-4.0.0-1-common/arch/mips/include
1.34 -CFLAGS = -O2 -Wall -fno-unit-at-a-time -fno-zero-initialized-in-bss \
1.35 - -ffreestanding -fno-hosted -fno-builtin \
1.36 - -march=mips32 -mno-abicalls \
1.37 - -Iinclude -I$(ASM_INC) -I$(ASM_INC)/asm/mach-generic
1.38 -LDFLAGS = -nostdlib -EL
1.39 -
1.40 -PAYLOAD = stage1.bin stage2.bin
1.41 -TARGET = $(PAYLOAD:.bin=.elf)
1.42 -DUMP = $(PAYLOAD:.bin=.dump)
1.43 -MAP = $(PAYLOAD:.bin=.map)
1.44 -
1.45 -# Ordering of objects is important and cannot be left to replacement rules.
1.46 -
1.47 -SRC1 = head1.S stage1.c board-nanonote.c
1.48 -SRC2 = head2.S stage2.c board-nanonote2.c nanonote_gpm940b0.c lcd.c
1.49 -OBJ1 = head1.o stage1.o board-nanonote.o
1.50 -OBJ2 = head2.o stage2.o board-nanonote2.o nanonote_gpm940b0.o lcd.o
1.51 -OBJ = $(OBJ1) $(OBJ2)
1.52 -
1.53 -.PHONY: all clean distclean
1.54 -
1.55 -all: $(PAYLOAD)
1.56 -
1.57 -clean:
1.58 - rm -f $(OBJ) $(TARGET) $(PAYLOAD) $(DUMP) *.map
1.59 -
1.60 -distclean: clean
1.61 - echo "Nothing else to clean."
1.62 -
1.63 -$(PAYLOAD): $(TARGET)
1.64 - $(OBJCOPY) -O binary $(@:.bin=.elf) $@+
1.65 - $(OBJDUMP) -D $(@:.bin=.elf) > $(@:.bin=.dump)
1.66 - $(OBJDUMP) -h $(@:.bin=.elf) > $(@:.bin=.map)
1.67 - $(NM) -n $(@:.bin=.elf) > System-$(@:.bin=.map)
1.68 - chmod -x $@+
1.69 - mv -f $@+ $@
1.70 -
1.71 -stage1.elf: $(OBJ1)
1.72 - $(LD) $(LDFLAGS) -T $(@:.elf=.ld) $(OBJ1) -o $@
1.73 -
1.74 -stage2.elf: $(OBJ2)
1.75 - $(LD) $(LDFLAGS) -T $(@:.elf=.ld) $(OBJ2) -o $@
1.76 -
1.77 -.c.o:
1.78 - $(CC) -c $(CFLAGS) $< -o $@
1.79 -
1.80 -.S.o:
1.81 - $(CC) -c $(CFLAGS) $< -o $@