# Linloader, Boots Linux/ARM on RISC OS based systems.
# Copyright (C) 1999  Timothy Baldwin
#
# 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.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

# $Id: Makefile,v 1.5 2004/03/20 12:11:25 pnaulls Exp $

STUBS= C:stubsg.o
LIBS = zlib.o.zlib OSLib:o.oslib32

#LLL_OBJS=asm.o fixup.o mcid.o id_sys.o ram.o boot.o name.o version.o msgs.o \
 die.o xmalloc.o init.o params.o bootfile.o bootgzip.o strdup.o

LLL_OBJS=o.asm o.fixup o.mcid o.id_sys o.ram o.boot o.name o.version o.msgs \
 o.die o.xmalloc o.init o.params o.bootfile o.bootgzip o.strdup

LL_OBJS=main.o getopt.o getopt1.o fpf_hack.o lll.o


# Use Norcroft
CFLAGS= -IOSLib: -Izlib -throwback -depend !Depend -strict -DNDEBUG
CC=cc
AS=objasm
ASFLAGS= -throwback
LD=link
LDFLAGS=$(STUBS) $(LIBS)
AR=libfile

# Use GCC
CFLAGS= -IOSLib: -Izlib -mlibscl -O2 -Wall -W -mthrowback  
CC=gcc
AS=gcc
ASFLAGS= -c -Wa,-t,SA1 -x assembler
LD=gcc
LDFLAGS=-mlibscl ${LIBS}
AR=libfile


TARGET=@.Linloader.LL

#dist: Linloader._M1 Linloader.LL o.lll
dist: $(TARGET) lll.o

clean:
	remove $(TARGET)
	-wipe Linloader._* ~C~V
	-wipe o.* ~C~V

.c.o:
	$(CC) ${CFLAGS} -c -o $@ $<
.s.o:
	$(AS) $(ASFLAGS) $< -o $@

$(TARGET): $(LL_OBJS)
	$(LD) -o $(TARGET) $(LL_OBJS) $(LDFLAGS)

#squeeze -v Linloader.LL

.SUFFIXES: .o .c .s


lll.o: ${LLL_OBJS}
	$(AR) -c $@ ${LLL_OBJS}

bootgzip.o: bootfile.c
	$(CC) ${CFLAGS} -DBOOT_GZIP -c -o bootgzip.o bootfile.c

Linloader._M1: LibM.M1 AbsM.M1
	print LibM.M1 { > Linloader._M1 }
	print AbsM.M1 { >> Linloader._M1 }

# Dynamic dependencies:

