# 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++.
#

ROOT            = ..\..
TMPDIR          = .
#TOOLS32	= c:\msdev                                                 # VC++ 2.x,4.x
#TOOLS32	= c:\Program Files\devstudio\vc                            # VC++ 5.x
TOOLS32		= c:\Program Files\Microsoft Visual Studio\Vc98            # VC++ 6.x
INSTALLDIR	= c:\WINNT\SYSTEM32

# Set this to the appropriate value of /MACHINE: for your platform
MACHINE = IX86

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


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

TTF             =       ttf
TTFLIB          =       $(TTF).lib
TTFDLL          =       $(TTF).dll

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)\ftxgasp.obj \
	$(TMPDIR)\ftxkern.obj \
	$(TMPDIR)\ftxpost.obj \
	$(TMPDIR)\ftxwidth.obj \
	$(TMPDIR)\ftxerr18.obj


PATH=$(TOOLS32)\bin;$(PATH)

cc32            = "$(TOOLS32)\bin\cl.exe"
link32          = "$(TOOLS32)\bin\link.exe"
include32       = "-I$(TOOLS32)\include" -I$(ROOT)\arch\win32
CP              = copy
RM              = del

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

TTF_CFLAGS      =       $(cdebug) $(cflags) $(cvarsdll) $(include32) \
			$(TTF_INCLUDES) $(TTF_DEFINES)
CON_CFLAGS      =       $(cdebug) $(cflags) $(cvars) $(include32) -DCONSOLE
DOS_CFLAGS      =       $(cdebug) $(cflags) $(include16) -AL 

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

!IFDEF NODEBUG
ldebug = /RELEASE
!ELSE
ldebug = -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
!IF "$(MACHINE)" == "IX86"
DLLENTRY = @12
lflags   = $(lcommon) /MACHINE:$(MACHINE)
!ELSE
lflags   = $(lcommon) /MACHINE:$(MACHINE)
!ENDIF

conlflags = $(lflags) -subsystem:console -entry:mainCRTStartup
guilflags = $(lflags) -subsystem:windows -entry:WinMainCRTStartup
dlllflags = $(lflags) -entry:_DllMainCRTStartup$(DLLENTRY) -dll

!IF "$(MACHINE)" == "PPC"
libc = libc.lib
libcdll = crtdll.lib
!ELSE
libc = libc.lib oldnames.lib
libcdll = msvcrt.lib oldnames.lib
!ENDIF

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 -Gs -GD
!ELSE
cdebug = -Z7 -Od -WX
!ENDIF

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

# NEED BYTEORDER INFORMATION HERE !!
!IF "$(MACHINE)" == "IX86"
cflags = $(ccommon) -D_X86_=1
!ELSE
!IF "$(MACHINE)" == "MIPS"
cflags = $(ccommon) -D_MIPS_=1
!ELSE
!IF "$(MACHINE)" == "PPC"
cflags = $(ccommon) -D_PPC_=1
!ELSE
!IF "$(MACHINE)" == "ALPHA"
cflags = $(ccommon) -D_ALPHA_=1
!ENDIF
!ENDIF
!ENDIF
!ENDIF

cvars      = -DWIN32 -D_WIN32
cvarsmt    = $(cvars) -D_MT
cvarsdll   = $(cvarsmt) -D_DLL

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

release:    $(TTFDLL)
all:        $(TTFDLL)

install:        $(TTFDLL)
	-@md    $(INSTALLDIR)
	-@$(CP) $(TTFDLL)               $(INSTALLDIR)



$(TTFDLL): $(TTFOBJS) ttf.def
	$(link32) $(ldebug) $(dlllflags) \
		$(guilibsdll) -out:$(TTFDLL) -def:ttf.def $(TTFOBJS)

#ttf.def: $(TTFOBJS)
#    ..\..\tcl8.0.4\win\release\dumpexts -o $@ ttf.dll $(TTFOBJS)


#
# Implicit rules
#

{$(ROOT)\extend}.c{$(TMPDIR)}.obj:
    $(cc32) $(TTF_CFLAGS) -Fo$(TMPDIR)\ $<

{$(ROOT)}.c{$(TMPDIR)}.obj:
    $(cc32) $(TTF_CFLAGS) -Fo$(TMPDIR)\ $<


clean:
	-@del *.exp 
	-@del *.lib 
	-@del *.dll 
	-@del $(TMPDIR)\*.obj
	-@del *.pch
	-@del *.pdb
