SCOPTS = RESOPT PARM=R NOSTKCHK STRINGMERGE UCHAR NOCHKABORT OPT OPTSIZE \
	OPTINLOCAL NOICONS MEMSIZE=HUGE DATA=FO DEBUG=LINE UTILITYLIBRARY
SLOPTS = NOICONS SMALLCODE SMALLDATA \
	LIB /Include/SDI_ASM_STD_functions.lib \
	STRIPDEBUG

# NOTE: remove STRIPDEBUG, when libraries should have line debug
#	information, for release version STRIPDEBUG should be on always

# When any later time the standard library is needed, the field
# LIB LIB:scnb.lib must be added to SLOPTS

FILES= All.c checksum.c fault.c fib.c hook.c hook_fh.c hook_mem.c \
	objects.c open.c password.c progress.c query.c sublibs.c tags.c \
	xbuf.c xpkmaster.c xpkmaster.h texts.c texts.h version.h

ODIR = //xpk_Binary/

Main: XPK4 XPKDEBUG

All: Main XPK XPKDEBUG4

XPK:	   $(ODIR)xpkmaster.libraryN4
XPKDEBUG:  $(ODIR)xpkmaster.libraryDEBUG
XPK4:	   $(ODIR)xpkmaster.library
XPKDEBUG4: $(ODIR)xpkmaster.libraryDEBUG4

# ******* object files *******

$(ODIR)debug.o: debug.c xpkmaster.h
	sc $(SCOPTS) debug.c OBJNAME=$@

$(ODIR)libinit.o: libinit.c version.h xpkmaster.h
	sc $(SCOPTS) libinit.c OBJNAME=$@ IGNORE=315

$(ODIR)All.o: $(FILES)
	sc $(SCOPTS) All.c OBJNAME=$@

$(ODIR)All_d.o: $(FILES)
	sc $(SCOPTS) NOOPT All.c DEFINE=DEBUG OBJNAME=$@

$(ODIR)All_4.o: $(FILES)
	sc $(SCOPTS) DEFINE=SUPPORT_A4 All.c OBJNAME=$@

$(ODIR)All_4d.o: $(FILES)
	sc $(SCOPTS) NOOPT All.c DEFINE=SUPPORT_A4 DEFINE=DEBUG OBJNAME=$@

# ******* libraries creation *******

$(ODIR)xpkmaster.libraryN4: $(ODIR)libinit.o $(ODIR)All.o
	slink FROM $(ODIR)libinit.o $(ODIR)All.o $(SLOPTS) TO $@

$(ODIR)xpkmaster.library: $(ODIR)libinit.o $(ODIR)All_4.o
	slink FROM $(ODIR)libinit.o $(ODIR)All_4.o $(SLOPTS) TO $@

$(ODIR)xpkmaster.libraryDEBUG: $(ODIR)libinit.o $(ODIR)All_d.o \
			       $(ODIR)debug.o
	slink FROM $(ODIR)libinit.o $(ODIR)All_d.o $(ODIR)debug.o \
	$(SLOPTS) LIB LIB:debug.lib LIB:ddebug.lib LIB:amiga.lib TO $@

$(ODIR)xpkmaster.libraryDEBUG4: $(ODIR)libinit.o $(ODIR)All_4d.o \
				$(ODIR)debug.o
	slink FROM $(ODIR)libinit.o $(ODIR)All_4d.o $(ODIR)debug.o \
	$(SLOPTS) LIB LIB:debug.lib LIB:ddebug.lib LIB:amiga.lib TO $@

