#
# Makefile  -  makefile for net boot loader routines
#
# Copyright (C) 1995,1996 Gero Kuhlmann <gero@gkminix.han.de>
#
#  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
#  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., 675 Mass Ave, Cambridge, MA 02139, USA.
#


#
#  Include system dependent definitions:
#
include ../config.mk


#
#  List of source and object files:
#
CSRCS	= 
ASRCS	= floppy.asm rom.asm inflate.asm
OBJS	= floppy.obj rom.obj inflate.obj

CHDRS	= 

AHDRS	= ../headers/asm/layout.inc \
	  ../headers/asm/macros.inc \
	  ../headers/asm/memory.inc \
	  ../headers/asm/version.inc \
	  ./loadpriv.inc

#
#  Rules to create object files from source files:
#
.SUFFIXES:	.c .asm .obj .exe .lib

.c.obj: 
ifdef VERBOSE
	$(CC) -c $(CFLAGS) $(INICFL) $<
else
	$(CC) -c $(CFLAGS) $(INICFL) $< >NUL
endif

.asm.obj:
	$(ASM) $(AFLAGS) $(INIAFL) $< ;


#
#  Target rules.
#
all:		floppy.bin rom.bin

exebin.bat:	dummy
	@$(RM) exebin.bat
	@echo @$(DOBIN) %1.exe %1.bin >exebin.bat

rom.bin:	$(OBJS) exebin.bat
	$(LNKP) $(LFLAGS) rom.obj+inflate.obj, \
				rom.exe, rom.map ;
	exebin rom
ifdef P86
	@copy rom.bin ..\binaries\rom86.bin >NUL
else
	@copy rom.bin ..\binaries\rom.bin >NUL
endif

floppy.bin:	$(OBJS) exebin.bat
	$(LNKP) $(LFLAGS) floppy.obj+rom.obj+inflate.obj, \
				floppy.exe, floppy.map ;
	exebin floppy
ifdef P86
	@copy floppy.bin ..\binaries\floppy86.bin >NUL
else
	@copy floppy.bin ..\binaries\floppy.bin >NUL
endif

#
# Rules for creating the object files.
#
floppy.obj:	floppy.asm $(AHDRS)

rom.obj:	rom.asm $(AHDRS)

inflate.obj:	inflate.asm $(AHDRS)

#
#  Maintenance rules for cleaning up.
#
.PHONY:	clean

clean:
	-$(RM) rom.bin
	-$(RM) floppy.bin
	@$(RM) exebin.bat
	-$(RM) *.exe
	-$(RM) *.obj
	-$(RM) *.lst
	-$(RM) *.map
	-$(RM) *.bak


dummy:

