#
# LSI C-86 Ver. 3.5 for WonderWitch
#
# makefile.def Rel.2
#

# default option(s)
CFLAGS	=-O -B -m
AFLAGS	=
LDFLAGS	=-M

# command macros
AS	=r86
CC	=lcc86
CP	=cp -p
ECHO	=fecho
MAKE	=kmmake
MKFENT	=mkfent
RM	=rm -f
WWPUTW	=wwputw

# startup routines
CRT0_ASCII1	=crt0asc1.obj
CRT0_ASCII2	=crt0asc2.obj
CRT0_JAPANESE1	=crt0jpn1.obj
CRT0_JAPANESE2	=crt0jpn2.obj

##############################################################################
.SUFFIXES:	.fx .bin .obj .c .a86

all:		$(TARGET).fx

$(TARGET).fx:	$(TARGET).bin $(TARGET).cf

$(TARGET).bin:	$(OBJS)
	$(CC) -a$(CRT0) -k"$(LDFLAGS)" -o $*.bin $(OBJS)

$(TARGET).cf:	Makefile
	@ $(ECHO) "Create" $@ "file."
	@ $(ECHO) "name:" $(CF_NAME) > $@
	@ $(ECHO) "info:" $(CF_INFO) >> $@
	@ $(ECHO) "mode:" $(CF_MODE) >> $@
	@ $(ECHO) "resource:" $(CF_RSRC) >> $@
	@ $(ECHO) "source:" $*.bin >> $@
	@ $(ECHO) "output:" $*.fx >> $@

clean:
	$(RM) *.fx *.bin *.cf *.obj *.map

install:
	@ $(ECHO) "Install" $(TARGET).fx "file."
	@ pause
	@ $(WWPUTW) $(TARGET).fx /rom0

.bin.fx:
	$(MKFENT) $*.cf

.obj.bin:
	$(CC) -a$(CRT0) -k"$(LDFLAGS)" -o $*.bin $<

.c.obj:
	$(CC) -c $(CFLAGS) $(DEBUG) -o $@ $<

.a86.obj:
	$(AS) $(AFLAGS) $(DEBUG) -o $@ $<

