# $Id: nmake-wince.opt 10609 2007-01-15 17:41:47Z  $
#
# Building options for Windows CE target
#
# Created by Mateusz Loskot <mateusz@loskot.net>
#

#################################################
# NOTE: Macros below are going to be changed
# and waits for configure script.
# Configure script will make it possible to 
# specify target CPU and system platform, etc.
#################################################
# Target platform definitions
CEVersion	= 420
CESubsystem	= "windowsce,$(CEVersion)"
CEConfigName	= "POCKET PC 2003"

# Target CPU
TARGET_CPU	= ARM
TARGET_CPU_ARCH	= ARMV4

CECrt		= C
CECrtDebug	= C
CECrtMT		= C
CECrtMTDebug	= C
CENoDefaultLib	= libc.lib \
		  /nodefaultlib:libcd.lib \
		  /nodefaultlib:libcmt.lib \
		  /nodefaultlib:libcmtd.lib \
		  /nodefaultlib:msvcrt.lib \
		  /nodefaultlib:msvcrtd.lib
CEx86Corelibc	= corelibc.lib

# Commands
MAKE = nmake /nologo
CC = clarm

#################################################
# END OF TEMPORARY MACROS BLOCK 
#################################################

# Location to install .exe, .dll and python stuff
# Edit as required. GDAL_HOME is used for convenience here,
# but this particular relative organization is not mandatory.

GDAL_HOME	= "build"
BINDIR		= $(GDAL_HOME)\bin
LIBDIR		= $(GDAL_HOME)\lib
INCDIR		= $(GDAL_HOME)\include
DATADIR		= $(GDAL_HOME)\data
HTMLDIR		= $(GDAL_HOME)\html

# Uncomment the first for an optimized build or the second for a debug build.
#OPTFLAGS= /MD /GX /Ox /nologo
OPTFLAGS = /W3 /GR /GX /Zi /Od /nologo /D "DEBUG"

# If you don't want some entry points to have STDCALL conventions, 
# comment out the following and add -DCPL_DISABLE_STDCALL in OPTFLAGS
STDCALL = YES

# Version number embedded in DLL name. 
VERSION = 13

# Uncomment the following to link OGR utilities against main GDAL DLL
# instead of statically linking against OGR libraries.
DLLBUILD = 1

# OGR Drivers supported on Windows CE
# Uncomment OGR drivers you want to include.
# NOTE: Only few drivers are supported by Windows CE (shape, tab)
# and some are going to be supported in future (csv, gml, sqlite).
# Rest of drivers are not going to be supported.
# 
#AVCBIN_SUPPORTED = 1
#CSV_SUPPORTED	= 1
#DGN_SUPPORTED	= 1
#GML_SUPPORTED	= 1
#MEM_SUPPORTED	= 1
#NTF_SUPPORTED	= 1
#REC_SUPPORTED	= 1
#S57_SUPPORTED	= 1
#SDTS_SUPPORTED	= 1
SHAPE_SUPPORTED = 1
TAB_SUPPORTED	= 1
#TIGER_SUPPORTED= 1
#VRT_SUPPORTED	= 1

# Paths
STLPORT_USE	= 1
STLPORT_DIR	= C:\STLport-5.0.0
WCELIBCEX_DIR	= wince\wcelibcex

########### END OF STUFF THAT NORMALLY NEEDS TO BE UPDATED ##################

GDAL_OUTPUT = gdalce

GDAL_DLL	= $(GDAL_ROOT)\$(GDAL_OUTPUT)$(VERSION).dll
GDAL_I_LIB	= $(GDAL_ROOT)\$(GDAL_OUTPUT)_i.lib
GDAL_LIB	= $(GDAL_ROOT)\$(GDAL_OUTPUT).lib

CPL_LIB		= $(GDAL_ROOT)\port/cpl.lib
WCELIBCEX_LIB	= $(GDAL_ROOT)\$(WCELIBCEX_DIR)\wcelibcex.lib

INC =	/I "$(GDAL_ROOT)\port" \
	/I "$(GDAL_ROOT)\ogr" \
	/I "$(GDAL_ROOT)\$(WCELIBCEX_DIR)"
		 
OPTFLAGS = $(OPTFLAGS)  /Fd$(GDAL_ROOT)\$(GDAL_OUTPUT).pdb

LINKER_FLAGS =	/nologo \
		/entry:"_DllMainCRTStartup" \
		/base:"0x00100000" \
		/stack:0x10000,0x1000 \
		/align:"4096" \
		/incremental:no \
		/nodefaultlib:"$(CENoDefaultLib)" \
		/subsystem:$(CESubsystem) \
		/MACHINE:ARM

#LINKER_FLAGS = /debug

CFLAGS = $(OPTFLAGS) \
	 $(INC) \
	 $(EXTRAFLAGS) \
	 /D "_LIB" \
	 /D "$(CESubsystem)" \
	 /D "_WIN32_WCE=$(CEVersion)" \
	 /D "UNDER_CE=$(CEVersion)" \
	 /D "$(TARGET_CPU)" \
	 /D "_$(TARGET_CPU)_" \
	 /D "$(TARGET_CPU_ARCH)" \
	 /D "UNICODE" /D "_UNICODE" 

EXTERNAL_LIBS = commctrl.lib \
		coredll.lib \
		corelibc.lib \
		ccrtrtti.lib

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

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

