#
# General definitions
#
DEBUG=off

#
# ----- Usage ---------------------------------------------------------------
#
usage:
	@type <<

Usage:

zmake dos16      (16 bit DOS with Pharlap)
zmake dos16b     (16 bit DOS with Blinker)
zmake dos32      (32 bit DOS with Watcom)
zmake win16      (16 bit Windows)
zmake win32      (32 bit Windows)
zmake win32dll   (32 bit Windows dll's)
zmake vxworks    (VxWorks)
zmake psos       (pSOS)
<<


# Uncomment the following for vxworks.
#ADD_COMPILE_OPTS=-DZAF_VXW_APP_NAME=vtest

#
# ----- Clean ---------------------------------------------------------------
#
clean:
	z_clean

#
# ----- Compiler Specific Settings ------------------------------------------
#
!if "$(ZINC_COMPILER)" == "MICROSOFT"
LIB_DIR=microsft
!else
LIB_DIR=$(ZINC_COMPILER)
!endif

!if "$(ZINC_COMPILER)" == "builder"
LIB_DIR=builder
!else if "$(ZINC_COMPILER)" == "borland"
D16_DEFINITION_FILE=b16.def
!endif

#
# ----- MetaWindow ----------------------------------------------------------
#
meta_copy:
	copy meta\*.fnt ..\bin
	copy meta\*.drp ..\bin
	copy meta\*.h ..\include
	-@md ..\lib
	-@md ..\lib\$(LIB_DIR)
	copy meta\*.lib ..\lib\$(LIB_DIR)

#
# ----- Real Mode Text ------------------------------------------------------
#
text: test.exe
	-@md ..\lib
	copy zaft.lib ..\lib
	copy zaftp.lib ..\lib

#
# ----- DOS 16 bit with Pharlap ---------------------------------------------
#
dos16: meta_copy test16.exe
	-@md ..\lib
	-@md ..\lib\$(LIB_DIR)
	copy zafd16.lib ..\lib\$(LIB_DIR)
	copy zafd16p.lib ..\lib\$(LIB_DIR)

#
# ----- DOS 16 bit with Blinker ---------------------------------------------
#
dos16b: meta_copy test16b.exe
	-@md ..\lib
	-@md ..\lib\$(LIB_DIR)
	copy zafd16.lib ..\lib\$(LIB_DIR)
	copy zafd16p.lib ..\lib\$(LIB_DIR)

#
# ----- DOS 32 bit ----------------------------------------------------------
#
dos32: meta_copy test32.exe
	-@md ..\lib
	-@md ..\lib\$(LIB_DIR)
	copy zafd32.lib ..\lib\$(LIB_DIR)
	copy zafd32p.lib ..\lib\$(LIB_DIR)

#
# ----- Windows 16 bit ------------------------------------------------------
#
win16: wtest16.exe
	-@md ..\lib
	-@md ..\lib\$(LIB_DIR)
	copy zafw16.lib ..\lib\$(LIB_DIR)
	copy zafw16p.lib ..\lib\$(LIB_DIR)

#
# ----- Windows 32 bit ------------------------------------------------------
#
win32: wtest32.exe
	-@md ..\lib
	-@md ..\lib\$(LIB_DIR)
	copy zafw32.lib ..\lib\$(LIB_DIR)
	copy zafw32p.lib ..\lib\$(LIB_DIR)


#
# ----- Windows 32 bit DLL --------------------------------------------------
#
win32dll: wtest.exe
	-@md ..\lib
	-@md ..\lib\$(LIB_DIR)
	copy zafw32.dll ..\lib\$(LIB_DIR)
	copy zafw32i.lib ..\lib\$(LIB_DIR)
	copy zafw32d.lib ..\lib\$(LIB_DIR)

#
# ----- VxWorks -------------------------------------------------------------
#
vxworks_libs: zafVxW.a zafVxWp.a 
	-@md ..\lib
	-@md ..\lib\$(LIB_DIR)
	copy zafVxW.a ..\lib\$(LIB_DIR)
	copy zafVxWp.a ..\lib\$(LIB_DIR)

vxworks: vxworks_libs vtest.o

#
# ----- pSOS ----------------------------------------------------------------
#
psos: zafpsos.lib zafpsosp.lib
	-@md ..\lib
	-@md ..\lib\$(LIB_DIR)
	copy zafpsos.lib ..\lib\$(LIB_DIR)
	copy zafpsosp.lib ..\lib\$(LIB_DIR)

#
# Include the source file macros.
#
!include "zaffiles.mak"
!include "dosfiles.mak"
!include "indfiles.mak"
!include "txtfiles.mak"
!include "winfiles.mak"

#
# Build options for zaft.lib
#
TARGET=zaft.lib
TARGET_TYPE=LIB
PLATFORM=TEXT
SOURCE_FILES=$(ZAF_SOURCE_CORE) $(ZAF_SOURCE_DOS_HARDWARE) $(ZAF_SOURCE_TEXT)
!include <zaf.mak>

#
# Build options for zaftp.lib
#
TARGET=zaftp.lib
TARGET_TYPE=LIB
PLATFORM=TEXT
SOURCE_FILES=$(ZAF_SOURCE_PERSIST_ALL)
!include <zaf.mak>

#
# Build options for zafd16.lib
#
TARGET=zafd16.lib
TARGET_TYPE=LIB
PLATFORM=DOS16
SOURCE_FILES=$(ZAF_SOURCE_CORE) $(ZAF_SOURCE_INDEPENDENT) $(ZAF_SOURCE_DOS) $(ZAF_SOURCE_DOS_HARDWARE)
!include <zaf.mak>

#
# Build options for zbasd16.lib
#
TARGET=zbasd16.lib
TARGET_TYPE=LIB
PLATFORM=DOS16
SOURCE_FILES=$(ZAF_BASIC_DOS)
!include <zaf.mak>

#
# Build options for zafd16p.lib
#
TARGET=zafd16p.lib
TARGET_TYPE=LIB
PLATFORM=DOS16
SOURCE_FILES=$(ZAF_SOURCE_PERSIST_ALL)
!include <zaf.mak>

#
# Build options for zafd32.lib
#
TARGET=zafd32.lib
TARGET_TYPE=LIB
PLATFORM=DOS32
SOURCE_FILES=$(ZAF_SOURCE_CORE) $(ZAF_SOURCE_INDEPENDENT) $(ZAF_SOURCE_DOS) $(ZAF_SOURCE_DOS_HARDWARE)
!include <zaf.mak>

#
# Build options for zafd32p.lib
#
TARGET=zafd32p.lib
TARGET_TYPE=LIB
PLATFORM=DOS32
SOURCE_FILES=$(ZAF_SOURCE_PERSIST_ALL)
!include <zaf.mak>

#
# Build options for zafw16.lib
#
TARGET=zafw16.lib
TARGET_TYPE=LIB
PLATFORM=WIN16
SOURCE_FILES=$(ZAF_SOURCE_CORE) $(ZAF_SOURCE_WINDOWS) $(ZAF_SOURCE_WINDOWS_NO_DLL)
!include <zaf.mak>

#
# Build options for zafw16p.lib
#
TARGET=zafw16p.lib
TARGET_TYPE=LIB
PLATFORM=WIN16
SOURCE_FILES=$(ZAF_SOURCE_PERSIST_ALL)
!include <zaf.mak>

#
# Build options for zafw32.lib
#
TARGET=zafw32.lib
TARGET_TYPE=LIB
PLATFORM=WIN32
SOURCE_FILES=$(ZAF_SOURCE_CORE) $(ZAF_SOURCE_WINDOWS) $(ZAF_SOURCE_WINDOWS_NO_DLL)
!include <zaf.mak>

#
# Build options for zafw32p.lib
#
TARGET=zafw32p.lib
TARGET_TYPE=LIB
PLATFORM=WIN32
SOURCE_FILES=$(ZAF_SOURCE_PERSIST_ALL)
!include <zaf.mak>

#
# Build options for zafw32.dll
#
TARGET=zafw32.dll
TARGET_TYPE=DLL
PLATFORM=WIN32
SOURCE_FILES=$(ZAF_SOURCE_CORE) $(ZAF_SOURCE_WINDOWS) $(ZAF_SOURCE_PERSIST_ALL)
DEFINITION_FILE=w32_dll.def
IMPORT_LIBRARY=zafw32i.lib
!include <zaf.mak>
DEFINITION_FILE=
IMPORT_LIBRARY=

#
# Build options for zafw32d.lib
#
TARGET=zafw32d.lib
TARGET_TYPE=LIBDLL
PLATFORM=WIN32
SOURCE_FILES=$(ZAF_SOURCE_WINDOWS_NO_DLL)
!include <zaf.mak>

#
# Build options for zafVxW.a
#
TARGET=zafVxW.a
TARGET_TYPE=LIB
PLATFORM=VXWORKS
SOURCE_FILES=$(ZAF_SOURCE_CORE) $(ZAF_SOURCE_INDEPENDENT) $(ZAF_SOURCE_VXWORKS)
!include <zaf.mak>

#
# Build options for zafVxWp.a
#
TARGET=zafVxWp.a
TARGET_TYPE=LIB
PLATFORM=VXWORKS
SOURCE_FILES=$(ZAF_SOURCE_PERSIST_ALL)
!include <zaf.mak>

#
# Build options for zafpsos.lib
#
TARGET=zafpsos.lib
TARGET_TYPE=LIB
PLATFORM=PSOS
SOURCE_FILES=$(ZAF_SOURCE_CORE) $(ZAF_SOURCE_INDEPENDENT) $(ZAF_SOURCE_PSOS)
!include <zaf.mak>

#
# Build options for zafpsosp.lib
#
TARGET=zafpsosp.lib
TARGET_TYPE=LIB
PLATFORM=PSOS
SOURCE_FILES=$(ZAF_SOURCE_PERSIST_ALL)
!include <zaf.mak>

#
# Build options for test.exe
#
TARGET=test.exe
TARGET_TYPE=EXE
PLATFORM=TEXT
SOURCE_FILES=test.cpp
ADD_DEPENDENCIES=zaft.lib zaftp.lib
!include <zaf.mak>
ADD_DEPENDENCIES=

#
# Build options for test16.exe
#
TARGET=test16.exe
TARGET_TYPE=EXE
PLATFORM=DOS16
SOURCE_FILES=test.cpp
ADD_DEPENDENCIES=zafd16.lib zafd16p.lib
DEFINITION_FILE=$(D16_DEFINITION_FILE)
!include <zaf.mak>
ADD_DEPENDENCIES=
DEFINITION_FILE=
D16_DISPLAY_LIBRARY=

#
# Build options for test16b.exe
#
TARGET=test16b.exe
TARGET_TYPE=EXE
PLATFORM=DOS16B
SOURCE_FILES=test.cpp
ADD_DEPENDENCIES=zafd16.lib zafd16p.lib
DEFINITION_FILE=
!include <zaf.mak>
ADD_DEPENDENCIES=
DEFINITION_FILE=
D16_DISPLAY_LIBRARY=

#
# Build options for test32.exe
#
TARGET=test32.exe
TARGET_TYPE=EXE
PLATFORM=DOS32
SOURCE_FILES=test.cpp
ADD_DEPENDENCIES=zafd32.lib zafd32p.lib
DEFINITION_FILE=
!include <zaf.mak>
ADD_DEPENDENCIES=
DEFINITION_FILE=
D16_DISPLAY_LIBRARY=

#
# Build options for wtest16.exe
#
TARGET=wtest16.exe
TARGET_TYPE=EXE
PLATFORM=WIN16
SOURCE_FILES=test.cpp
ADD_DEPENDENCIES=zafw16.lib zafw16p.lib
DEFINITION_FILE=wtest16.def
!include <zaf.mak>
ADD_DEPENDENCIES=
DEFINITION_FILE=

#
# Build options for wtest32.exe
#
TARGET=wtest32.exe
TARGET_TYPE=EXE
PLATFORM=WIN32
SOURCE_FILES=test.cpp
ADD_DEPENDENCIES=zafw32.lib zafw32p.lib
!include <zaf.mak>
ADD_DEPENDENCIES=

#
# Build options for wtest.exe
#
TARGET=wtest.exe
TARGET_TYPE=EXEDLL
PLATFORM=WIN32
SOURCE_FILES=test.cpp
ADD_DEPENDENCIES=zafw32.dll zafw32d.lib
!include <zaf.mak>
ADD_DEPENDENCIES=

#
# Build options for vtest.exe
#
TARGET=vtest.o
TARGET_TYPE=EXE
PLATFORM=VXWORKS
SOURCE_FILES=test.cpp v_app.cpp
ADD_DEPENDENCIES=zafVxW.a zafVxWp.a
!include <zaf.mak>
ADD_DEPENDENCIES=

