#*******************************************************************
#* Makefile for MSII
#*
#* COPYRIGHT: Philip L Johnson 2004
#* This header must appear on all derivatives of this file.
#*
#*******************************************************************
# Extended for MS2/Extra by Ken Culver and James Murray  2006
# $Id: Makefile,v 1.38.6.2 2007/10/26 22:27:59 jsmcortina Exp $

ifdef SYSTEMDRIVE
BINDIR = c:/usr/bin
else
BINDIR = /usr/bin
endif

all:	megasquirt   # default is to build for ms2 platform

both: clean_not_common megasquirt clean_not_common_us microsquirt bootstrap

megasquirt:
	$(MAKE) --makefile Makefile.ms2
microsquirt:
	$(MAKE) --makefile Makefile.us

#aliases
us: microsquirt
ms2: megasquirt

release: clean both
	rm -rf release
	mkdir release
	cp megasquirt-ii.ini.ms2extra ms2_extra.s19 ms2_extra_us.s19 copyini.bat ms2dl.exe utils/CHOICE.COM utils/download-MS2-firmware.bat release
	cp bootstrap_src/bootstrap.s19 release
	# Make sure you updated sigs.c

bootstrap:
	$(MAKE) -C bootstrap_src

.PHONY: clean
clean:
	$(RM) -rf release *~
	$(MAKE) --makefile Makefile.ms2 clean
	$(MAKE) --makefile Makefile.us clean
	$(MAKE) -C bootstrap_src clean

.PHONY: clean_not_common     # delete the object files that contain MS2 vs. MICROSQUIRT dependencies
clean_not_common:
	$(RM) -f ms2_extra_ign.o ms2_extra_ign_in.o ms2_extra_init.o ms2_extra_misc.o isr_ign.o isr_inj.o isr_rtc.o

.PHONY: clean_not_common_us     # delete the object files that contain MS2 vs. MICROSQUIRT dependencies
clean_not_common_us:
	$(RM) -f ms2_extra_ign.o ms2_extra_ign_in.o ms2_extra_init.o ms2_extra_misc.o isr_ign.o isr_inj.o isr_rtc.o
