# Visual C++ 2.x, 4.x, 5.0 and 6.0 makefile for freetype
# adapted from suns example makefile (related to the TCL script language)

# Does not depend on the presence of any environment variables in
# order to compile freetype; all needed information is derived from 
# location of the compiler directories.

#
# Project directories
#
# ROOT    = top of source tree
#
# TMPDIR  = location where .obj files should be stored during build
#
# TOOLS32 = location of VC++ 32-bit development tools. Note that the
#           VC++ 2.0 header files are broken, so you need to use the
#           ones that come with the developer network CD's, or later
#           versions of VC++.
#
#
#
# Copyright 1996-2001 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
# and distributed under the terms of the FreeType project license,
# LICENSE.TXT.  By continuing to use, modify, or distribute this file you
# indicate that you have read the license and understand and accept it
# fully.

ROOT            = ../..
TMPDIR          = .
MACHINE = IX86

# Comment the following line to compile with symbols
NODEBUG=1


######################################################################
# Do not modify below this line
######################################################################

TTF             =       libttf
TTFLIB          =       $(TTF).lib

TTFOBJS =       \
	$(TMPDIR)/ttapi.obj     \
	$(TMPDIR)/ttcache.obj   \
	$(TMPDIR)/ttcalc.obj    \
	$(TMPDIR)/ttcmap.obj    \
	$(TMPDIR)/ttdebug.obj   \
	$(TMPDIR)/ttfile.obj    \
	$(TMPDIR)/ttgload.obj   \
	$(TMPDIR)/ttinterp.obj  \
	$(TMPDIR)/ttload.obj    \
	$(TMPDIR)/ttmemory.obj  \
	$(TMPDIR)/ttmutex.obj   \
	$(TMPDIR)/ttobjs.obj    \
	$(TMPDIR)/ttraster.obj  \
	$(TMPDIR)/ttextend.obj  \
	$(TMPDIR)/ftxcmap.obj   \
	$(TMPDIR)/ftxerr18.obj  \
	$(TMPDIR)/ftxgasp.obj   \
	$(TMPDIR)/ftxgdef.obj   \
	$(TMPDIR)/ftxgpos.obj   \
	$(TMPDIR)/ftxgsub.obj   \
	$(TMPDIR)/ftxkern.obj   \
	$(TMPDIR)/ftxopen.obj   \
	$(TMPDIR)/ftxpost.obj   \
	$(TMPDIR)/ftxsbit.obj   \
	$(TMPDIR)/ftxwidth.obj



cc32            = cl.exe
link32          = link.exe
lib32           = lib.exe
include32       = -I$(ROOT)/arch/win32
CP              = cp
RM              = rm

TTF_INCLUDES    = -I$(ROOT)
TTF_DEFINES     = -nologo -D__WIN32__

DEFS = -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_SECURE_NO_DEPRECATE \
-D_CRT_OBSOLETE_NO_DEPRECATE -D_SECURE_SCL=0

TTF_CFLAGS      =       $(cdebug) $(cflags) $(include32) \
			$(TTF_INCLUDES) $(TTF_DEFINES) $(DEFS)

######################################################################
# Link flags
######################################################################

ifdef NODEBUG
ldebug = -RELEASE
else
debug = -debug:full -debugtype:cv
endif

# declarations common to all linker options
lcommon = -NODEFAULTLIB -RELEASE -NOLOGO

# declarations for use on Intel i386, i486, and Pentium systems

baselibs   = kernel32.lib $(optlibs) advapi32.lib
winlibs    = $(baselibs) user32.lib gdi32.lib comdlg32.lib winspool.lib

guilibs    = $(libc) $(winlibs)
conlibs    = $(libc) $(baselibs)
guilibsdll = $(libcdll) $(winlibs)
conlibsdll = $(libcdll) $(baselibs)

######################################################################
# Compile flags
######################################################################

ifdef NODEBUG
cdebug = -O2 -MD
else
cdebug = -Z7 -Od -WX
endif

# declarations common to all compiler options
ccommon = -c -W3 -nologo -Dtry=__try -Dexcept=__except

cflags = $(ccommon) -D_X86_=1

######################################################################
# Project specific targets
######################################################################

release:    $(TTFLIB)
all:        $(TTFLIB)


$(TTFLIB): $(TTFOBJS)
	lib -out:$@ $(TTFOBJS)

$(TMPDIR)/ttapi.obj:$(ROOT)/ttapi.c
	$(cc32) $(TTF_CFLAGS) -Fo$@ $<
$(TMPDIR)/ttcache.obj:$(ROOT)/ttcache.c
	$(cc32) $(TTF_CFLAGS) -Fo$@ $<
$(TMPDIR)/ttcalc.obj:$(ROOT)/ttcalc.c
	$(cc32) $(TTF_CFLAGS) -Fo$@ $<
$(TMPDIR)/ttcmap.obj:$(ROOT)/ttcmap.c
	$(cc32) $(TTF_CFLAGS) -Fo$@ $<
$(TMPDIR)/ttdebug.obj:$(ROOT)/ttdebug.c
	$(cc32) $(TTF_CFLAGS) -Fo$@ $<
$(TMPDIR)/ttfile.obj:$(ROOT)/ttfile.c
	$(cc32) $(TTF_CFLAGS) -Fo$@ $<
$(TMPDIR)/ttgload.obj:$(ROOT)/ttgload.c
	$(cc32) $(TTF_CFLAGS) -Fo$@ $<
$(TMPDIR)/ttinterp.obj:$(ROOT)/ttinterp.c
	$(cc32) $(TTF_CFLAGS) -Fo$@ $<
$(TMPDIR)/ttload.obj:$(ROOT)/ttload.c
	$(cc32) $(TTF_CFLAGS) -Fo$@ $<
$(TMPDIR)/ttmemory.obj:$(ROOT)/ttmemory.c
	$(cc32) $(TTF_CFLAGS) -Fo$@ $<
$(TMPDIR)/ttmutex.obj:$(ROOT)/ttmutex.c
	$(cc32) $(TTF_CFLAGS) -Fo$@ $<
$(TMPDIR)/ttobjs.obj:$(ROOT)/ttobjs.c
	$(cc32) $(TTF_CFLAGS) -Fo$@ $<
$(TMPDIR)/ttraster.obj:$(ROOT)/ttraster.c
	$(cc32) $(TTF_CFLAGS) -Fo$@ $<
$(TMPDIR)/ttextend.obj:$(ROOT)/ttextend.c
	$(cc32) $(TTF_CFLAGS) -Fo$@ $<
$(TMPDIR)/ftxcmap.obj:$(ROOT)/extend/ftxcmap.c
	$(cc32) $(TTF_CFLAGS) -Fo$@ $<
$(TMPDIR)/ftxerr18.obj:$(ROOT)/extend/ftxerr18.c
	$(cc32) $(TTF_CFLAGS) -Fo$@ $<
$(TMPDIR)/ftxgasp.obj:$(ROOT)/extend/ftxgasp.c
	$(cc32) $(TTF_CFLAGS) -Fo$@ $<
$(TMPDIR)/ftxgdef.obj:$(ROOT)/extend/ftxgdef.c
	$(cc32) $(TTF_CFLAGS) -Fo$@ $<
$(TMPDIR)/ftxgpos.obj:$(ROOT)/extend/ftxgpos.c
	$(cc32) $(TTF_CFLAGS) -Fo$@ $<
$(TMPDIR)/ftxgsub.obj:$(ROOT)/extend/ftxgsub.c
	$(cc32) $(TTF_CFLAGS) -Fo$@ $<
$(TMPDIR)/ftxkern.obj:$(ROOT)/extend/ftxkern.c
	$(cc32) $(TTF_CFLAGS) -Fo$@ $<
$(TMPDIR)/ftxopen.obj:$(ROOT)/extend/ftxopen.c
	$(cc32) $(TTF_CFLAGS) -Fo$@ $<
$(TMPDIR)/ftxpost.obj:$(ROOT)/extend/ftxpost.c
	$(cc32) $(TTF_CFLAGS) -Fo$@ $<
$(TMPDIR)/ftxsbit.obj:$(ROOT)/extend/ftxsbit.c
	$(cc32) $(TTF_CFLAGS) -Fo$@ $<
$(TMPDIR)/ftxwidth.obj:$(ROOT)/extend/ftxwidth.c
	$(cc32) $(TTF_CFLAGS) -Fo$@ $<

install: $(TTFLIB)
	cp -p $(TTFLIB) $(ROOT)/

clean:
	rm -f *.exp
	rm -f *.lib
	rm -f *.dll
	rm -f $(TMPDIR)/*.obj
	rm -f *.pch
	rm -f *.pdb
