# Released to the public domain.
#
# Anyone and anything may copy, edit, publish,
# use, compile, sell and distribute this work
# and all its parts in any form for any purpose,
# commercial and non-commercial, without any restrictions,
# without complying with any conditions
# and by any means.

# This makefile builds 16-bit uemacs.exe for MSDOS.
# makefile.wcd in PDPCLIB must be used before using this makefile

MODELC=l

CC=wcl
CFLAGS=-oneatx
COPTS=$(CFLAGS) -ecc -zp1 -q -w -c -I. -m$(MODELC) -zl -D__MSDOS__ -fpi87 -s -zdp -zu -DC90 -I. -I..\pdos\pdpclib

TARGET=uemacs.exe
TEMP_ARCHIVE=temp.lib
OBJS=		ansi.obj basic.obj bind.obj buffer.obj display.obj file.obj \
		fileio.obj line.obj lock.obj main.obj random.obj region.obj \
		search.obj spawn.obj termio.obj window.obj word.obj

all: clean $(TARGET)

$(TARGET): $(OBJS)
#  wcl -q -Fe=$(TARGET) ..\pdos\pdpclib\dosstart.obj $(TEMP_ARCHIVE) ..\pdos\pdpclib\watcom.lib
  wlink File ..\pdos\pdpclib\dosstart.obj Name $(TARGET) Form dos Library ..\pdos\pdpclib\watcom.lib,$(TEMP_ARCHIVE) Option quiet,stack=8192,start=___asmstart,map,verbose,dosseg
  rm -f $(TEMP_ARCHIVE)

.c.obj:
  $(CC) $(COPTS) -c $<
  wlib -b -q $(TEMP_ARCHIVE) +$@

clean:
  rm -f watcom.lib
  rm -f *.obj
  rm -f $(TARGET)
  rm -f $(TEMP_ARCHIVE)
