# A brief explanation.
#
# Copyright (C) 2001 MontaVista Software Inc.
# Author: Jun Sun, jsun@mvista.com or jsun@junsun.net
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 2 of the License, or (at your
# option) any later version.
######## CONFIGURATION #########
LOADADDR = 0x80c00000
RAMSIZE = 0x00001000
CROSS_COMPILE = mips-linux-gnu-
######## END OF CONFIGURATION #########
.S.s:
$(CPP) $(CFLAGS) $< -o $*.s
.S.o:
$(CC) $(CFLAGS) -c $< -o $*.o
.c.o:
$(CC) $(CFLAGS) -c $< -o $*.o
CPP = $(CROSS_COMPILE)cpp
CC = $(CROSS_COMPILE)gcc
LD = $(CROSS_COMPILE)ld
STRIP = $(CROSS_COMPILE)strip
OBJCOPY = $(CROSS_COMPILE)objcopy
OBJDUMP = $(CROSS_COMPILE)objdump
CFLAGS = -mips4 -I./include -mno-abicalls -fno-pic -static -Wall -Wpointer-arith -Wstrict-prototypes -Winline -Wundef -g -O2 -ffunction-sections -fdata-sections -fno-exceptions -G0 -DRAMSIZE=${RAMSIZE}
# Drop some uninteresting sections in the kernel.
# This is only relevant for ELF kernels but doesn't hurt a.out
drop-sections = .reginfo .mdebug
strip-flags = $(addprefix --remove-section=,$(drop-sections))
all : elf srec bin
srec : syscall.srec
elf : syscall.elf
bin : syscall.bin
syscall.elf : start.o main.o uart16550.o print.o printf.o
$(LD) -mips4 -EB --gc-sections -nostdlib -static -o syscall.elf -L./ -N -Tsyscall.lds -Ttext $(LOADADDR) $^ -lextras -ltarget
$(STRIP) syscall.elf
syscall.srec : syscall.elf
$(OBJCOPY) -S -O srec $(strip-flags) syscall.elf syscall.srec
syscall.bin : syscall.elf
$(OBJCOPY) -S -O binary $(strip-flags) syscall.elf syscall.bin
clean:
rm -f *.o syscall.elf syscall.srec syscall.bin