# 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 win32 ARM uemacs.exe
# makefile.was in PDPCLIB must be used before using this makefile

CC=gccprm
CFLAGS=-O0
COPTS=$(CFLAGS) -S -D__WIN32__ -D__ARM__ -D__USEBIVA__ \
    -I. -I../pdos/pdpclib -DC90 \
    -ansi -fno-common -fno-builtin -mapcs-32 \
    -msoft-float -fno-leading-underscore -D__STATIC__
AS=asprm
AR=arprm
LD=pdld --no-insert-timestamp
LDFLAGS=


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)
  $(AR) s $(TEMP_ARCHIVE)
  $(LD) -s -o $(TARGET) ../pdos/pdpclib/p32start.obj main.obj $(TEMP_ARCHIVE) ../pdos/pdpclib/armsupa.obj ../pdos/pdpclib/fpfuncsa.obj ../pdos/pdpclib/pdpwin32.lib ../pdos/src/kernel32.lib
  rm -f $(TEMP_ARCHIVE)

.c.obj:
  $(CC) $(COPTS) -o $*.s $<
  $(AS) -o $@ $*.s
  rm -f $*.s
  $(AR) r $(TEMP_ARCHIVE) $@

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