# Makefile for MODE

# set 
#   UPX=-rem 
# if you dont want to UPX the generated files
UPX=-rem
UPX=upx --8086

# the assembler:
NASM=nasm

############# WATCOM (untested) ##############
# the compiler:
# CC=wcl
# the flags:
# CFLAGS=-oas -s -wx -we -zq -fm -fe=

############# TURBO_C ########################
# -w warn all, -M mapfile -Z optimize registers -O optimize jumps
# -k- no standard stack frame -e... defines exe filename, must be
# last argument. -f- disables FPU usage. -mt uses tiny model
# and -lt passes "create com file" option to linker.
CC=tcc
CFLAGS=-w -M -f- -mt  -lt -e


CFILES=mode.c  modecon.c  modevga.c modecp.c  modeser.c modepar.c modeopt.c modetsr.c

######## targets: ########

# if you include DISPLAY sources with this: all: mode.com display.com

all: mode.com

display.com: display.asm
	$(NASM) display.asm -o display.com
	$(UPX) display.com

mode.com: $(CFILES) modeint.h modeint.asm bin2c.c makefile
	$(CC) $(CFLAGS)mode $(CFILES)
	$(CC) $(CFLAGS)bin2c bin2c.c
	$(NASM) -o modeint.bin modeint.asm
	-bin2c modeint.bin modeint.h mode_int17
	$(UPX) mode.com

clean:
	-del *.obj
	-del bin2c.com
	-del *.bin
	-del bin2c.map
