NanoPayload

stage1/Makefile

43:f0292b2578bd
2015-06-09 Paul Boddie Introduced support for building the jz4730 MiniPC target, adding missing definitions and fixing errors. Fixed the licensing statements in various header files according to available information.
     1 # Makefile - Build the NanoNote payload     2 #     3 # Copyright (C) 2015 Paul Boddie <paul@boddie.org.uk>     4 # Copyright (C) Xiangfu Liu <xiangfu@sharism.cc>     5 #     6 # This program is free software; you can redistribute it and/or modify it under     7 # the terms of the GNU General Public License as published by the Free Software     8 # Foundation; either version 3 of the License, or (at your option) any later     9 # version.    10 #    11 # This program is distributed in the hope that it will be useful, but WITHOUT    12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS    13 # FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more    14 # details.    15 #    16 # You should have received a copy of the GNU General Public License along with    17 # this program.  If not, see <http://www.gnu.org/licenses/>.    18     19 ARCH = mipsel-linux-gnu    20 CC = $(ARCH)-gcc    21 LD = $(ARCH)-ld    22 NM = $(ARCH)-nm    23 OBJCOPY=$(ARCH)-objcopy    24 OBJDUMP=$(ARCH)-objdump    25     26 # NOTE: -O2 is actually needed to prevent memcpy references, whereas probably    27 # NOTE: one of the -f{freestanding, no-hosted, no-builtin} options should work.    28 # NOTE: See: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56888    29     30 ASM_INC = /usr/src/linux-headers-4.0.0-1-common/arch/mips/include    31 CFLAGS = -O2 -Wall \    32 	-fno-unit-at-a-time -fno-zero-initialized-in-bss \    33 	-ffreestanding -fno-hosted -fno-builtin \    34 	-march=mips32 \    35 	-I../include -I$(ASM_INC) -I$(ASM_INC)/asm/mach-generic    36 LDFLAGS = -nostdlib -EL    37     38 PAYLOAD = stage1.bin    39 TARGET = $(PAYLOAD:.bin=.elf)    40 DUMP = $(PAYLOAD:.bin=.dump)    41 MAP = $(PAYLOAD:.bin=.map)    42     43 # Ordering of objects is important and cannot be left to replacement rules.    44     45 SRC = head1.S stage1.c board.c    46 OBJ = head1.o stage1.o board.o    47     48 .PHONY:	all clean distclean    49     50 all:	$(PAYLOAD)    51     52 clean:    53 	rm -f $(OBJ) $(TARGET) $(PAYLOAD) $(DUMP) *.map    54     55 distclean: clean    56 	echo "Nothing else to clean."    57     58 $(PAYLOAD): $(TARGET)    59 	$(OBJCOPY) -O binary $(@:.bin=.elf) $@+    60 	$(OBJDUMP) -D $(@:.bin=.elf) > $(@:.bin=.dump)    61 	$(OBJDUMP) -h $(@:.bin=.elf) > $(@:.bin=.map)    62 	$(NM) -n $(@:.bin=.elf) > System.map    63 	chmod -x $@+    64 	mv -f $@+ $@    65     66 stage1.elf: $(OBJ)    67 	$(LD) $(LDFLAGS) -T $(@:.elf=.ld) $(OBJ) -o $@    68     69 .c.o:    70 	$(CC) -c $(CFLAGS) $< -o $@    71     72 .S.o:    73 	$(CC) -c $(CFLAGS) $< -o $@