#
# Palmtop News Reader (PNR)
#
# Copyright (C) 2000-2002  David Becher
# Copyright (C) 1997-1999  Rod Whitby
# Copyright (C) 1995-1997  Michael J. Leaver
#
# SEE 'PNRSRC.TXT' FOR MORE INFORMATION
#
# !!! EDIT THIS FILE FOR YOUR CONFIGURATION !!!
# Note: I dont really use this make file as I prefer using the IDE
# but it should work!
#
NAME = pnr
# version info is now hard coded in pnrlib.c but keep this the same value
# for the name of the zip files - no more than 4 chars!
SUFFIX = 43b2
#-----------------------------------------------------------------------------
# Set the next value to build on desktop
#TOOL = DESKTOP
TOOL = PALMTOP

#-----------------------------------------------------------------------------
#	Settings for building on my palmtop:
#-----------------------------------------------------------------------------
!if $(TOOL) == PALMTOP
#
#-----------------------------------------------------------------------------
# Target Directories
#
BINS=outs
BINL=outl
#-----------------------------------------------------------------------------
# PAL v1.6 Library location
#
PALINC = a:\tc\pal16\src\inc
PALXLIB = a:\tc\lib\tcspal.lib
PALELIB = a:\tc\lib\tclpal.lib
#-----------------------------------------------------------------------------
# Compiler
#
# Turbo C++ & Turbo Assembler
CC      = tcc
AS      = tasm
AR      = tlib
E2M     = tce2m
COPTS   = -w -1 -d -f- -O -X -Z- -I$(PALINC) -I. -Ia:\tc\inc -La:\tc\lib
DEBUG   = -v -O-

#-----------------------------------------------------------------------------
# Settings for building on the desktop:
#-----------------------------------------------------------------------------
!else
#-----------------------------------------------------------------------------
# PAL v1.6 Library location
#

PALINC = d:\bc31\pal16\src\inc
PALXLIB = d:\bc31\pal16\libs\bcspal.lib
PALELIB = d:\bc31\pal16\libl\bclpal.lib

#-----------------------------------------------------------------------------
# Target Directories
#
BINS=outs
BINL=outl

#-----------------------------------------------------------------------------
# Compiler
#

# Borland C++ 3.1 & Turbo Assembler
CC      = bcc
AS      = tasm
AR      = tlib
E2M     = tce2m
COPTS   = -w -1 -d -f- -X -Z- -I$(PALINC) -I. -Id:\bc31\inc -Ld:\bc31\lib
DEBUG   = -v -Od

!endif

#-----------------------------------------------------------------------------
#
# DO NOT MODIFY BELOW THIS POINT
#

#
# PNR Common Object files
#

PNRSRC= hm.c folder.c dlgres.c pnrlib.c disp.c funcs.c  post.c news.c   \
      int.c encode.c

PNRTISRC = pnrti.c pnrtiarg.c pnrtiact.c pnrlib.c

#
# Compilation rules
#
all:    pnr.exm pnr.exe pnrti.exe
 
turboc.cfg : makefile
	copy &&!
$(COPTS)
! turboc.cfg
 
install : all
		copy $(BINL)\pnrl.exe a:\lxtcp\pnr.exe
		copy $(BINL)\pnrti.exe a:\lxtcp\pnr.exe
		copy $(BINS)\pnr.exm a:\lxtcp\pnr.exm
 
pnr.exm: $(PNRSRC) $(BINS)\libasm.obj turboc.cfg
	$(CC) -DSYSMGR -DPNR_CP -ms -ls -epnrs.exe @&&!
-n$(BINS)
$(BINS)\libasm.obj
$(PNRSRC)
$(PALXLIB)
!
	$(E2M) $(BINS)\pnrs
	del $(BINS)\pnr.exm
	ren $(BINS)\pnrs.exm pnr.exm
	dir $(BINS)\*.ex*

pnr.exe: $(PNRSRC) turboc.cfg
    $(CC) -ml -ls -epnrl.exe @&&!
-n$(BINL)
$(PNRSRC)
$(PALELIB)
!
	del $(BINL)\pnr.exe
	ren $(BINL)\pnrl.exe pnr.exe
	dir $(BINL)\*.ex*

pnrti.exe: $(PNRTISRC) turboc.cfg
    echo $(TOOL) $(CC)
    $(CC) -ml -ls -epnrti.exe @&&!
-DMSDOS -DPAL
-n$(BINL)
$(PNRTISRC)
$(PALELIB)
!
	dir $(BINL)\*.ex*


#
# Specific object rules
#

pnrti.obj : pnrti.c
    $(CC) -c -ml -n$(BINL) -DMSDOS -DPAL $*.c

$(BINS)\libasm.obj : libasm.asm
    $(AS) /t libasm.asm,$(BINS)\libasm.obj /mx


#
# Generic object rules
#


#
# Make a fresh program. Forces recompile of everything.
#
fresh: clean all

#
# Delete everything but the source
#
clean:
    del *.obj
    del *.bak
    del *.map
    del *.exe
    del *.exm
    del *.lib
    del *.zip
	

#
# Distribution
#
zip:
	copy $(BINS)\pnr.exm pnr.exm
	copy $(BINL)\pnr.exe pnr.exe
	copy $(BINL)\pnrti.exe pnrti.exe
	pkzip $(NAME)$(SUFFIX)b.zip \
		readme pnr.doc pnrfaq.txt pnrmime.txt \
		pnr.exm pnr.exe pnrti.exe incoming.act \
		pnr.cfg pnr.icn pnrti.icn
	pkzip $(NAME)$(SUFFIX)s.zip \
		readme pnr.doc pnrfaq.txt pnrsrc.txt \
		pnr.cfg pnr.icn pnrti.icn \
		makefile *.c *.h *.asm

dbzip:
	copy $(BINS)\pnr.exm pnr.exm
	copy $(BINL)\pnr.exe pnr.exe
	copy $(BINL)\pnrti.exe pnrti.exe
	pkzip $(NAME)$(SUFFIX)b.zip \
		readme.txt pnr.doc pnrfaq.txt pnrmime.txt \
		pnr.exm pnr.exe pnrti.exe incoming.act \
		pnr.cfg *.icn
	pkzip $(NAME)$(SUFFIX)s.zip \
	*.txt pnr.doc pnr.cfg *.icn \
	makefile *.c *.h *.asm \
	\tc\pnrs.* \tc\pnrl.* \tc\pnrti.*
    del *.ex*

