# makefile for pgp 2.6.2i under RISC OS
# cc command line becomes too long unless we do clever things,
# or more precisely unless we do stupid things.
# The particular stupid thing we do is to build many of the object files
# into a library.
# NB If you don't have libfile, I have a replacement with similar
# functionality. (In fact, it does much more and is less memory-hungry
# too. It used to be much slower, but isn't any more.)
#
# If you are a new PGP user you should copy config/txt to LIBDIR.
# I put this in "make install" but removed it after realising that
# it's stupid to wipe over your existing config file with the default
# one. I realised this the hard way >>duhh<<.

# Where do you want PGP?
BINDIR	= $.bin.ports

# Where do you want its library files? (Directory should exist)
LIBDIR	= $.lib.pgp

CC = cc
AS = objasm

CFLAGS = -DIDEA32 -DNOTERMIO -DRISC_OS -DASM_MD5 -memaccess -L22-S22-L41

.SUFFIXES: .o .s .c

LOBS =	o.armor o.charset o.getopt o.keyadd o.keymaint o.keymgmt\
	o.language o.more o.passwd o.rsagen o.rsaglue1\
	o.zbits o.zdeflate o.zfile_io o.zglobals o.zinflate\
	o.zip o.zipup o.ztrees o.zunzip

OBJS =	o.config o.crypto o.fileio o.genprime o.idea o.md5 o.mdfile\
	o.mpiio o.mpilib o.noise o.pgp o.random o.randpool o.sleep

XOBS =	o.arm o.ideaARM o.gjmlow o.md5ARM

.c.o:; $(CC) $(CFLAGS) -c $<
.s.o:; $(AS) $<

pgp: o._lib $(OBJS) $(XOBS)
  $(CC) -o pgp $(OBJS) $(XOBS) o._lib

o.fileio: c.fileio
  $(CC) $(CFLAGS) -DLIBDIR="\"$(LIBDIR)\"" -c c.fileio

o._lib: $(LOBS)
  libfile -c o._lib $(LOBS)

install:
  squeeze -v pgp
  copy pgp $(BINDIR).pgp F~C
  #copy ^.config/txt $(LIBDIR).config/txt F~C ... not actually a good idea
  copy ^.lang/txt $(LIBDIR).lang/txt F~C
  copy ^.pgp/hlp $(LIBDIR).pgp/hlp F~C
  copy ^.en/hlp $(LIBDIR).en/hlp F~C
  copy ^.es/hlp $(LIBDIR).es/hlp F~C
  copy ^.fr/hlp $(LIBDIR).fr/hlp F~C
  #copy ^.no/hlp $(LIBDIR).no/hlp F~C ... this seems to have vanished. Why?
  copy ^.doc $(LIBDIR).doc RF~C

clean:
  remove pgp
  wipe o.* ~C
