#
#   (C) 1995-96 AROS - The Amiga Replacement OS
#   $Id: makefile,v 1.6 1997/02/06 15:22:46 ldp Exp $
#
#   Desc: Amiga bootloader -- makefile
#   Lang: english
#

# The files in this directory build a stand-alone executable, used to
# install AROS' modules in the system. These modules will become active
# after a reset. More information in the source files.

TOP=../../..

include $(TOP)/config/make.cfg

# Flags to use for the module loader
LDFLAGS = -noixemul

FILES = main ils config

all:	setup $(BINDIR)/boot $(BINDIR)/boot.config

clean:
	-rm -f $(BINDIR)/boot

setup :
	@if [ ! -d $(BINDIR) ]; then $(MKDIR) $(BINDIR) ; else true ; fi
	@if [ ! -d $(BOOTGENDIR) ]; then $(MKDIR) $(BOOTGENDIR) ; else true ; fi

$(BOOTGENDIR)/%.o: %.c
	$(CC) $(CFLAGS) $< -c -o $@ 2>&1|tee $*.err
	@if test ! -s $*.err; then rm $*.err ; else true ; fi

$(BINDIR)/boot: $(foreach f,$(FILES),$(BOOTGENDIR)/$(f).o)
	$(CC) $(LDFLAGS) $(foreach f,$(FILES),$(BOOTGENDIR)/$(f).o) -o $@
	strip $@

$(BINDIR)/boot.config: boot.config
	$(CP) $< $@

$(BOOTGENDIR)/%.d: %.c
	@if [ ! -d $(@D) ]; then $(MKDIR) $(@D) ; else true ; fi
	$(MKDEPEND) -f- -p$(@D)/ -- $(CFLAGS) -- $^ > $@

include $(foreach f,$(FILES),$(BOOTGENDIR)/$(f).d)
