#
# arch/mips/zboot/Makefile
#
# This file is subject to the terms and conditions of the GNU General Public
# License.  See the file "COPYING" in the main directory of this archive
# for more details.

# Adapted for MIPS Pete Popov, Dan Malek
#
# Copyright (C) 1994 by Linus Torvalds
# Adapted for PowerPC by Gary Thomas
# modified by Cort (cort@cs.nmt.edu)
#

.c.s:
	$(CC) $(CFLAGS) -S -o $*.s $<
.s.o:
	$(AS) -o $*.o $<
.c.o:
	$(CC) $(CFLAGS) -c -o $*.o $<
.S.s:
	$(CPP) $(AFLAGS) -o $*.o $<
.S.o:
	$(CC) $(AFLAGS) -c -o $*.o $<

GZIP_FLAGS = -v9f

CFLAGS	:= $(CPPFLAGS) -O2 -D__BOOTER__ \
	-fomit-frame-pointer -fno-strict-aliasing -fno-common \
	-G 0 -mno-abicalls -fno-pic -mtune=r4600 -mips2 \
		-I$(TOPDIR)/arch/$(ARCH)/zboot/include \
		-I$(TOPDIR)/include/asm
AFLAGS	+= -D__BOOTER__

BOOT_TARGETS = zImage rImage zImage.initrd zImage.flash zImage.initrd.flash

lib/zlib.a:
	$(MAKE) -C lib

images/vmlinux.gz: $(TOPDIR)/vmlinux
	$(MAKE) -C images vmlinux.gz

ifdef CONFIG_MIPS_DB1000
BOOT_DIR = pb1xxx
endif
ifdef CONFIG_MIPS_DB1500
BOOT_DIR = pb1xxx
endif
ifdef CONFIG_MIPS_DB1100
BOOT_DIR = pb1xxx
endif
ifdef CONFIG_MIPS_PB1000
BOOT_DIR = pb1xxx
endif
ifdef CONFIG_MIPS_PB1500
BOOT_DIR = pb1xxx
endif
ifdef CONFIG_MIPS_PB1100
BOOT_DIR = pb1xxx
endif
ifdef CONFIG_RICOH_BASIL_S1
BOOT_DIR = basil_s1
endif
ifdef CONFIG_MIPS_BOSPORUS
BOOT_DIR = pb1xxx
endif
ifdef CONFIG_ATI_XILLEON
BOOT_DIR = xilleon
endif
ifdef CONFIG_IDT_79S334
BOOT_DIR = IDT/79S334
endif
ifdef CONFIG_IDT_79EB355
BOOT_DIR = IDT/79EB355
endif
ifdef CONFIG_IDT_79RP355
BOOT_DIR = IDT/79RP355
endif
ifdef CONFIG_IDT_79EB438
BOOT_DIR = IDT/79EB438
endif
ifdef CONFIG_IDT_79EB434
BOOT_DIR = IDT/79EB434
endif
ifdef CONFIG_MIPS_XXS1500
BOOT_DIR = pb1xxx
endif

$(BOOT_TARGETS): lib/zlib.a images/vmlinux.gz
	$(MAKE) -C $(BOOT_DIR) $@

# Do the dirs
clean:
	$(MAKE) -C common clean
	$(MAKE) -C images clean
	$(MAKE) -C pb1xxx clean
	$(MAKE) -C xilleon clean
	$(MAKE) -C IDT/79S334 clean
	$(MAKE) -C IDT/79EB355 clean
	$(MAKE) -C IDT/79RP355 clean
	$(MAKE) -C IDT/79EB434 clean
	$(MAKE) -C IDT/79EB438 clean
	$(MAKE) -C basil_s1 clean
	$(MAKE) -C sd clean
	$(MAKE) -C filesystem clean

include $(TOPDIR)/Rules.make
