# ##### START OF CONFIGURATION SECTION.
#
# __CHANGE__
#
# You may need to customize this section.
#
#
#

# 64-bit support
# ==============
# Uncomment the BITS64 line to build for 64-bit Windows platforms.

# BITS64=1


# Parent directory where programs reside
# --------------------------------------

# --- Programs folder on german Windows versions before Vista
# PROGRAMS=C:\Programme

# --- English versions and version on Vista and above
PROGRAMS=C:\Program Files


# Parent directory for 32-bit software
# ------------------------------------

!IFDEF BITS64
PROGRAMSX86=C:\Program Files (x86)
!ELSE
PROGRAMSX86=C:\Program Files
!ENDIF


# Name of vendor subdirectory in the directory above.
# ---------------------------------------------------
# One string without spaces or tabulators!

VENDOR=SoftwareVendor


# Compiler and linker
# ===================


# Program names
# -------------
# Which programs to use for compiling and linking?

CC=CL
LD=LINK


# Unicode settings
# ----------------
# DK tools wants the wxWidgets libraries with Unicode support,
# release, static multi-threaded
#
UNICODE=	/D_UNICODE=1 /DUNICODE=1
# UNICODE=

# Code generation
# ---------------
# MT   Multi-Thread, Release, static  -> LIBCMT.LIB
# MTd  ..., Debug, ...                -> LIBCMTD.LIB
# ML   Single-Thread, Release, static -> LIBC.LIB
# MLd  ..., Debug, ...                -> LIBCD.LIB
# MD   Multi-Thread, Release, DLL     -> MSVCRT.LIB
# MDd  ..., Debug, ...                -> MSVCRTD.LIB

# --- Visual Studio 2005/2008 on Windows 7
COPTIONS= /nologo /MT /W3 \
	/D "WIN32" /D "_WIN32" /D "NDEBUG" /D "_CONSOLE" \
	-D_CRT_SECURE_NO_WARNINGS=1 -D_CRT_SECURE_NO_DEPRECATE=1 \
	$(UNICODE)

DLLCOPTIONS= /nologo /MD /W3 \
	/D "WIN32" /D "_WIN32" /D "NDEBUG" /D "_CONSOLE" \
	-D_CRT_SECURE_NO_WARNINGS=1 -D_CRT_SECURE_NO_DEPRECATE=1 \
	$(UNICODE)

LINKMANIFEST= /MANIFEST



# Visual Studio and Platform SDK location
# ---------------------------------------

# Where is Visual C?
# Directories lib, include and bin must be beyound this.

# --- Visual C++ 5
# VC=$(PROGRAMS)\DevStudio\Vc

# --- Visual Studio (Version 6?)
# VC=$(PROGRAMS)\Microsoft Visual Studio\Vc98

# --- Visual Studio 2003
# VC=$(PROGRAMS)\Microsoft Visual Studio .NET 2003\Vc7

# --- Visual Studio 2005
# VC=$(PROGRAMS)\Microsoft Visual Studio 8\VC

# --- Visual Studio 2005 when Platform SDK for Windows 7 is installed
VC=$(PROGRAMSX86)\Microsoft Visual Studio 9.0\VC


# Where is the Platform SDK for Windows 7

# --- Older Platform SDKs
# PLATFORMSDK=$(VC)\PlatformSDK

# --- Use SDK shipped with Visual Studio
# PLATFORMSDK=$(VC)

# --- Platform SDK installed separately
PLATFORMSDK=$(PROGRAMS)\Microsoft SDKs\Windows\v7.0


# Directories
# ===========
# System configuration directory

SCD=	-DSYSCONFDIR=\"C:\\ETC\"



# XCOPY overwrites
# ================
# does xcopy need a special option to overwrite
# files without prompting.

XCOPYFL= /Y



# Required libraries
# ==================

# Location of required libraries
# ------------------------------
# Where do the libraries reside?

LIBSRC=C:\P\LIB-STT


# Bzip2 support
# -------------
BZL_DEF=-DDK3_HAVE_BZLIB_H=1
BZL_DIR=-I$(LIBSRC)\Include
BZL_LIB=libbz2.lib



# Zlib support
# ------------
ZL_DEF=-DDK3_HAVE_ZLIB_H=1
ZL_DIR=-I$(LIBSRC)\Include
ZL_LIB=zlib.lib



# Libpng support
# --------------
PNG_DEF=-DDK3_HAVE_LIBPNG=1 -DDK3_HAVE_PNG_H=1
PNG_DIR=-I$(LIBSRC)\Include
PNG_LIB=libpng.lib
PNGEPSOBJ=pngeps.obj
BMEPSEXE=bmeps.exe



# Jpeg support
# ------------
JPG_DEF=-DDK3_HAVE_JPEGLIB_H=1
JPG_DIR=-I$(LIBSRC)\Include
JPG_LIB=libjpeg.lib
JPGEPSOBJ=jpgeps.obj



# TIFF support
# ------------
TIF_DEF=-DDK3_HAVE_TIFF_H=1
TIF_DIR=-I$(LIBSRC)\Include
TIF_LIB=libtiff.lib
TIFEPSOBJ=tifeps.obj



# wxWidgets support
# ----------------
WXDIR=C:\p\wxWidgets-2.8.12
WXLIBS=	\
	$(WXDIR)\lib\vc_lib\wxbase28u.lib \
	$(WXDIR)\lib\vc_lib\wxbase28u_net.lib \
	$(WXDIR)\lib\vc_lib\wxbase28u_odbc.lib \
	$(WXDIR)\lib\vc_lib\wxbase28u_xml.lib \
	$(WXDIR)\lib\vc_lib\wxmsw28u_adv.lib \
	$(WXDIR)\lib\vc_lib\wxmsw28u_aui.lib \
	$(WXDIR)\lib\vc_lib\wxmsw28u_core.lib \
	$(WXDIR)\lib\vc_lib\wxmsw28u_dbgrid.lib \
	$(WXDIR)\lib\vc_lib\wxmsw28u_gl.lib \
	$(WXDIR)\lib\vc_lib\wxmsw28u_html.lib \
	$(WXDIR)\lib\vc_lib\wxmsw28u_media.lib \
	$(WXDIR)\lib\vc_lib\wxmsw28u_qa.lib \
	$(WXDIR)\lib\vc_lib\wxmsw28u_richtext.lib \
	$(WXDIR)\lib\vc_lib\wxmsw28u_xrc.lib \
	$(WXDIR)\lib\vc_lib\wxexpat.lib \
	$(WXDIR)\lib\vc_lib\wxregexu.lib

# We typically have newer variants of these libraries installed, so we
# use $(IMGLIBS) $(ZL_LIB) instead of these libraries.
WXIMGLIBS= $(WXDIR)\lib\vc_lib\wxpng.lib \
 	$(WXDIR)\lib\vc_lib\wxtiff.lib \
 	$(WXDIR)\lib\vc_lib\wxjpeg.lib \
 	$(WXDIR)\lib\vc_lib\wxzlib.lib


# DK tools libraries
# ------------------
DK_BASE=$(PROGRAMS)\Krause
DK_DIR=-I"$(DK_BASE)\include"
DK_LIB=/LIBPATH:"$(DK_BASE)\lib" dk3wx.lib dk3c.lib

#
#
#
# No changes should be necessary below this line.
#
# ##### END OF CONFIGURATION SECTION



# ##### Start of internal setup section
#
#

exec_prefix = $(PREFIX)
bindir = $(exec_prefix)\bin
sbindir = $(exec_prefix)\sbin
libexecdir = $(exec_prefix)\libexec
datadir = $(PREFIX)\share
sysconfdir = $(PREFIX)\etc
libdir = $(exec_prefix)\lib
sharedlibdir = $(libdir)\shared
mandir = $(PREFIX)\man
includedir = $(PREFIX)\include
srcdir = .
top_srcdir = .

# How to build an EXE file
# ------------------------

!IFDEF BITS64
EXEFLAGS= /nologo /subsystem:console /incremental:no $(MACHINE) /release \
	/LIBPATH:"$(PLATFORMSDK)\Lib\x64" /LIBPATH:"$(PLATFORMSDK)\Lib" \
	/LIBPATH:"$(VC)\LIB\AMD64" /LIBPATH:"$(VC)\LIB" \
	/LIBPATH:"$(LIBSRC)\LIB"
!ELSE
EXEFLAGS= /nologo /subsystem:console /incremental:no $(MACHINE) /release \
	/LIBPATH:"$(PLATFORMSDK)\Lib" \
	/LIBPATH:"$(VC)\LIB" \
	/LIBPATH:"$(LIBSRC)\LIB"
!ENDIF

EXE=	LINK $(EXEFLAGS) $(LINKMANIFEST)

# How to build a GUI exe file with wxWidgets support
# --------------------------------------------------
!IFDEF BITS64
GUIEXEFLAGS= /nologo /subsystem:WINDOWS /incremental:no $(MACHINE) /release \
	/LIBPATH:"$(PLATFORMSDK)\Lib\x64" /LIBPATH:"$(VC)\LIB\AMD64" \
	/LIBPATH:"$(PLATFORMSDK)\Lib" /LIBPATH:"$(VC)\LIB" \
	/LIBPATH:"$(LIBSRC)\LIB"
!ELSE
GUIEXEFLAGS= /nologo /subsystem:WINDOWS /incremental:no $(MACHINE) /release \
	/LIBPATH:"$(PLATFORMSDK)\Lib" \
	/LIBPATH:"$(VC)\LIB" \
	/LIBPATH:"$(LIBSRC)\LIB"
!ENDIF

GUIEXE=	LINK $(GUIEXEFLAGS) $(LINKMANIFEST)

LIB=	LIB /nologo

IMGLIBS= $(PNG_LIB) $(JPG_LIB) $(TIF_LIB)

# compile .c to .obj
#
DEF1= $(BZL_DEF) $(BZL_DIR)
DEF2= $(ZL_DEF) $(ZL_DIR)
DEF3= $(PNG_DEF) $(PNG_DIR)
DEF4= $(JPG_DEF) $(JPG_DIR)
DEF5= $(TIF_DEF) $(TIF_DIR)
DEF6= $(DK_DIR)
DEF7= -DTRACE_WIDE=1

DEFS= $(DEF1) \
	$(DEF2) \
	$(DEF3) \
	$(DEF4) \
	$(DEF5) \
	$(DEF6) \
	$(DEF7)

COBJFLAGS= $(COPTIONS) $(DEFS) \
	/I. /I.. /I"$(PLATFORMSDK)\Include" /I"$(VC)\Include" $(SCD)

DLLCOBJFLAGS= $(DLLCOPTIONS) $(DEFS) \
	/I. /I.. /I"$(PLATFORMSDK)\Include" /I"$(VC)\Include" $(SCD)

LIB32=		kernel32.lib \
	gdi32.lib \
	advapi32.lib \
	user32.lib

WXLIB32=	ole32.lib \
	oleaut32.lib \
	shell32.lib \
	comctl32.lib \
	comdlg32.lib \
	winspool.lib

WSC32=	ws2_32.lib
NETAPI32= winspool.lib netapi32.lib

VC_MANIFEST_EMBED_EXE= \
if exist $@.manifest mt.exe -manifest $@.manifest -outputresource:$@;1

VC_MANIFEST_EMBED_DLL= \
if exist $@.manifest mt.exe -manifest $@.manifest -outputresource:$@;2

#
# ##### End of internal setup section


# ##### Start of internal configuration
#
#

MYDEFS=/I$(WXDIR)\lib\vc_lib\mswu \
	/I$(WXDIR)\include\msvc \
	/I$(WXDIR)\include \
	-DDK3_USE_WX=1

WXCOBJFLAGS=$(COBJFLAGS) $(MYDEFS) /EHsc /GF /Gy /fp:precise

WXDEFS=$(DEFS) $(MYDEFS)

.c.obj:
	@echo Compile $*.c
	$(CC) $(WXCOBJFLAGS) $(CFLAGS) /c $*.c

.cpp.obj:
	$(CC) $(WXCOBJFLAGS) $(CFLAGS) /c $*.cpp

.rc.res:
	RC $(WXDEFS) $*.rc

WXEXE=$(GUIEXE) /LIBPATH:$(WXDIR)\lib\vc_lib /entry:"WinMainCRTStartup"

#
#
# ##### End of internal configuration



# ##### Start of targets
#
# __CHANGE__
#
# Modify this section as needed by your project.
#
#

PROGRAMSTOBUILD= \
	$program$.exe

all:	$(PROGRAMSTOBUILD)

OBJ_$program$= \
	$application$.obj \
	$frame$.obj \
	$program$.res

$program$.exe:	$(OBJ_$program$)
	$(WXEXE) $(DK_LIB) $(LIB32) $(WXLIB32) /out:$program$.exe $(OBJ_$program$) $(WXLIBS) $(IMGLIBS) $(ZL_LIB)
	$(VC_MANIFEST_EMBED_EXE)

.PHONY:	clean

clean:
	-DEL *.obj
	-DEL *.exe
	-DEL *.lib
	-DEL *.deb

#
#
# ##### End of targets

