shithub: freetype+ttf2subf

Download patch

ref: 046f7a0c31cc6ab69483bc99df48f5977901e369
parent: b8817177a0ac22993a425e3158ac9fbb55cd87c1
author: David Turner <[email protected]>
date: Fri Sep 15 18:42:06 EDT 2000

major revamp of the build system

git/fs: mount .git/fs: mount/attach disallowed
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,9 @@
 LATEST CHANGES
 
+  - revamped the build system to make it a lot more generic. This will
+    allow us to re-use nearly un-modified in lots of other projects
+    (including FreeType Layout)
+
   - changed "cid" to use "psaux" too..
 
   - added the cache sub-system. See <freetype/ftcache.h> as well as the
--- a/Makefile
+++ b/Makefile
@@ -3,40 +3,14 @@
 #
 
 
-# Copyright 1996-2000 by
-# David Turner, Robert Wilhelm, and Werner Lemberg.
+# Project names
 #
-# 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.
+PROJECT := freetype
+PROJECT_TITLE := FreeType
 
+USE_MODULES := 1
 
-# This file is designed for GNU Make, do not use it with another Make tool!
-#
-# It works as follows:
-#
-# - When invoked for the first time, this Makefile will include the rules
-#   found in `freetype/builds/detect.mk'.  They are in charge of detecting
-#   the current platform.
-#
-#   A summary of the detection will be displayed, and the file `config.mk'
-#   will be created in the current directory.
-#
-# - When invoked later, this Makefile will include the rules found in
-#   `config.mk'.  This sub-Makefile will define some system-specific
-#   variables (like compiler, compilation flags, object suffix, etc.), then
-#   include the rules found in `freetype/builds/freetype.mk', used to build
-#   the library.
-#
-# See the comments in `config/detect.mk' and `config/freetype.mk' for more
-# details on host platform detection and library builds.
-
-
-.PHONY: setup
-
-# The variable TOP holds the path to the topmost directory in the FreeType
+# The variable TOP holds the path to the topmost directory in the project
 # engine source hierarchy.  If it is not defined, default it to `.'.
 #
 ifndef TOP
@@ -43,71 +17,6 @@
   TOP := .
 endif
 
-CONFIG_MK := config.mk
-
-# If no configuration sub-makefile is present, or if `setup' is the target
-# to be built, run the auto-detection rules to figure out which
-# configuration rules file to use.
-#
-# Note that the configuration file is put in the current directory, which is
-# not necessarily $(TOP).
-
-# If `config.mk' is not present, set `check_platform'.
-#
-ifeq ($(wildcard $(CONFIG_MK)),)
-  check_platform := 1
-endif
-
-# If `setup' is one of the targets requested, set `check_platform'.
-#
-ifneq ($(findstring setup,$(MAKECMDGOALS)),)
-  check_platform := 1
-endif
-
-# Include the automatic host platform detection rules when we need to
-# check the platform.
-#
-ifdef check_platform
-
-  all: setup
-
-  # If the module list $(FT_MODULE_LIST) file is not present, generate it.
-  #
-  modules: make_module_list setup
-
-  include $(TOP)/builds/detect.mk
-  include $(TOP)/builds/modules.mk
-
-  ifeq ($(wildcard $(FT_MODULE_LIST)),)
-    setup: make_module_list
-  endif
-
-  # This rule makes sense for Unix only to remove files created by a run
-  # of the configure script which hasn't been successful (so that no
-  # `config.mk' has been created).  It uses the built-in $(RM) command of
-  # GNU make.
-  #
-  distclean:
-	$(RM) builds/unix/config.cache
-	$(RM) builds/unix/config.log
-	$(RM) builds/unix/config.status
-
-  # IMPORTANT:
-  #
-  # `setup' must be defined by the host platform detection rules to create
-  # the `config.mk' file in the current directory.
-
-else
-
-  # A configuration sub-Makefile is present -- simply run it.
-  #
-  all: single
-
-  modules: make_module_list
-
-  BUILD_FREETYPE := yes
-  include $(CONFIG_MK)
-
-endif # test check_platform
+include $(TOP)/builds/toplevel.mk
 
 # EOF
--- /dev/null
+++ b/builds/ansi/ansi-def.mk
@@ -1,0 +1,107 @@
+#
+#  configuration rules for a `normal' ANSI system
+#
+
+ifndef TOP
+  TOP := .
+endif
+
+DELETE   := rm -f
+SEP      := /
+HOSTSEP  := $(SEP)
+BUILD    := $(TOP)/builds/ansi
+PLATFORM := ansi
+
+
+# The directory where all object files are placed.
+#
+# This lets you build the library in your own directory with something like
+#
+#   set TOP=.../path/to/freetype2/top/dir...
+#   set OBJ_DIR=.../path/to/obj/dir
+#   make -f $TOP/Makefile setup [options]
+#   make -f $TOP/Makefile
+#
+ifndef OBJ_DIR
+  OBJ_DIR := $(TOP)$(SEP)obj
+endif
+
+
+# The directory where all library files are placed.
+#
+# By default, this is the same as $(OBJ_DIR), however, this can be changed
+# to suit particular needs.
+#
+LIB_DIR := $(OBJ_DIR)
+
+
+# The name of the final library file.  Note that the DOS-specific Makefile
+# uses a shorter (8.3) name.
+#
+LIBRARY := lib$(PROJECT)
+
+
+# Path inclusion flag.  Some compilers use a different flag than `-I' to
+# specify an additional include path.  Examples are `/i=' or `-J'.
+#
+I := -I
+
+
+# C flag used to define a macro before the compilation of a given source
+# object.  Usually is `-D' like in `-DDEBUG'.
+#
+D := -D
+
+
+# The link flag used to specify a given library file on link.  Note that
+# this is only used to compile the demo programs, not the library itself.
+#
+L := -l
+
+
+# Target flag.
+#
+T := -o # Don't remove this comment line!  We need the space after `-o'.
+
+
+# C flags
+#
+#   These should concern: debug output, optimization & warnings.
+#
+#   Use the ANSIFLAGS variable to define the compiler flags used to enfore
+#   ANSI compliance.
+#
+ifndef CFLAGS
+  CFLAGS := -c
+endif
+
+# ANSIFLAGS: Put there the flags used to make your compiler ANSI-compliant.
+#
+ANSIFLAGS :=
+
+
+ifdef BUILD_PROJECT
+
+  # Now include the main sub-makefile.  It contains all the rules used to
+  # build the library with the previous variables defined.
+  #
+  include $(TOP)/builds/$(PROJECT).mk
+
+  # The cleanup targets.
+  #
+  clean_project: clean_project_std
+  distclean_project: distclean_project_std
+
+  # This final rule is used to link all object files into a single library.
+  # It is part of the system-specific sub-Makefile because not all
+  # librarians accept a simple syntax like
+  #
+  #   librarian library_file {list of object files}
+  #
+  $(PROJECT_LIBRARY): $(OBJECTS_LIST)
+	  -$(CLEAN_LIBRARY) $(NO_OUTPUT)
+	  $(LINK_LIBRARY)
+
+endif
+
+# EOF
--- a/builds/ansi/ansi.mk
+++ b/builds/ansi/ansi.mk
@@ -1,136 +1,8 @@
 #
-# FreeType 2 configuration rules for a `normal' ANSI compiler
+# FreeType 2 configuration rules for a `normal' pseudo ANSI compiler/system
 #
 
-
-# Copyright 1996-2000 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.
-
-
-ifndef TOP
-  TOP := .
-endif
-
-DELETE   := rm -f
-SEP      := /
-HOSTSEP  := $(SEP)
-BUILD    := $(TOP)/builds/ansi
-PLATFORM := ansi
-
-
-# The directory where all object files are placed.
-#
-# This lets you build the library in your own directory with something like
-#
-#   set TOP=.../path/to/freetype2/top/dir...
-#   set OBJ_DIR=.../path/to/obj/dir
-#   make -f $TOP/Makefile setup [options]
-#   make -f $TOP/Makefile
-#
-ifndef OBJ_DIR
-  OBJ_DIR := $(TOP)$(SEP)obj
-endif
-
-
-# The directory where all library files are placed.
-#
-# By default, this is the same as $(OBJ_DIR), however, this can be changed
-# to suit particular needs.
-#
-LIB_DIR := $(OBJ_DIR)
-
-
-# The object file extension (for standard and static libraries).  This can be
-# .o, .tco, .obj, etc., depending on the platform.
-#
-O  := o
-SO := o
-
-# The library file extension (for standard and static libraries).  This can
-# be .a, .lib, etc., depending on the platform.
-#
-A  := a
-SA := a
-
-
-# The name of the final library file.  Note that the DOS-specific Makefile
-# uses a shorter (8.3) name.
-#
-LIBRARY := libfreetype
-
-
-# Path inclusion flag.  Some compilers use a different flag than `-I' to
-# specify an additional include path.  Examples are `/i=' or `-J'.
-#
-I := -I
-
-
-# C flag used to define a macro before the compilation of a given source
-# object.  Usually is `-D' like in `-DDEBUG'.
-#
-D := -D
-
-
-# The link flag used to specify a given library file on link.  Note that
-# this is only used to compile the demo programs, not the library itself.
-#
-L := -l
-
-
-# Target flag.
-#
-T := -o # Don't remove this comment line!  We need the space after `-o'.
-
-
-# C flags
-#
-#   These should concern: debug output, optimization & warnings.
-#
-#   Use the ANSIFLAGS variable to define the compiler flags used to enfore
-#   ANSI compliance.
-#
-ifndef CFLAGS
-  CFLAGS := -c
-endif
-
-# ANSIFLAGS: Put there the flags used to make your compiler ANSI-compliant.
-#
-ANSIFLAGS :=
-
-
-ifdef BUILD_FREETYPE
-
-  # Now include the main sub-makefile.  It contains all the rules used to
-  # build the library with the previous variables defined.
-  #
-  include $(TOP)/builds/freetype.mk
-
-  # The cleanup targets.
-  #
-  clean_freetype: clean_freetype_std
-  distclean_freetype: distclean_freetype_std
-
-  # Librarian to use to build the static library
-  #
-  FT_LIBRARIAN := $(AR) -r
-
-
-  # This final rule is used to link all object files into a single library.
-  # It is part of the system-specific sub-Makefile because not all
-  # librarians accept a simple syntax like
-  #
-  #   librarian library_file {list of object files}
-  #
-  $(FT_LIBRARY): $(OBJECTS_LIST)
-	  -$(DELETE) $@
-	  $(FT_LIBRARIAN) $@ $(OBJECTS_LIST)
-
-endif
+include $(TOP)/builds/ansi/ansi-def.mk
+include $(TOP)/builds/compiler/ansi-cc.mk
 
 # EOF
--- /dev/null
+++ b/builds/compiler/ansi-cc.mk
@@ -1,0 +1,70 @@
+# Copyright 2000 David Turner
+#
+#  generic pseudo ANSI compiler
+#
+
+# Compiler command line name
+CC := cc
+
+# The object file extension (for standard and static libraries).  This can be
+# .o, .tco, .obj, etc., depending on the platform.
+#
+O  := o
+SO := o
+
+# The library file extension (for standard and static libraries).  This can
+# be .a, .lib, etc., depending on the platform.
+#
+A  := a
+SA := a
+
+
+# Path inclusion flag.  Some compilers use a different flag than `-I' to
+# specify an additional include path.  Examples are `/i=' or `-J'.
+#
+I := -I
+
+
+# C flag used to define a macro before the compilation of a given source
+# object.  Usually is `-D' like in `-DDEBUG'.
+#
+D := -D
+
+
+# The link flag used to specify a given library file on link.  Note that
+# this is only used to compile the demo programs, not the library itself.
+#
+L := -l
+
+
+# Target flag.
+#
+T := -o # Don't remove this comment line!  We need the space after `-o'.
+
+
+# C flags
+#
+#   These should concern: debug output, optimization & warnings.
+#
+#   Use the ANSIFLAGS variable to define the compiler flags used to enfore
+#   ANSI compliance.
+#
+ifndef CFLAGS
+  CFLAGS := -c
+endif
+
+# ANSIFLAGS: Put there the flags used to make your compiler ANSI-compliant.
+#
+#  we assume the compiler is already strictly ANSI
+#
+ANSIFLAGS :=
+
+
+# Library linking
+#
+ifndef
+CLEAN_LIBRARY = $(DELETE) $(subst $(SEP),$(HOSTSEP),$(PROJECT_LIBRARY) $(NO_OUTPUT)
+endif
+LINK_LIBRARY  = $(AR) -r $@ $(OBJECTS_LIST)
+
+# EOF
--- /dev/null
+++ b/builds/compiler/gcc-dev.mk
@@ -1,0 +1,68 @@
+# Copyright 2000 David Turner
+#
+#  gcc-specific with NO OPTIMISATIONS + DEBUGGING
+#
+
+# Compiler command line name
+CC := gcc
+
+# The object file extension (for standard and static libraries).  This can be
+# .o, .tco, .obj, etc., depending on the platform.
+#
+O  := o
+SO := o
+
+# The library file extension (for standard and static libraries).  This can
+# be .a, .lib, etc., depending on the platform.
+#
+A  := a
+SA := a
+
+
+# Path inclusion flag.  Some compilers use a different flag than `-I' to
+# specify an additional include path.  Examples are `/i=' or `-J'.
+#
+I := -I
+
+
+# C flag used to define a macro before the compilation of a given source
+# object.  Usually is `-D' like in `-DDEBUG'.
+#
+D := -D
+
+
+# The link flag used to specify a given library file on link.  Note that
+# this is only used to compile the demo programs, not the library itself.
+#
+L := -l
+
+
+# Target flag.
+#
+T := -o # Don't remove this comment line!  We need the space after `-o'.
+
+
+# C flags
+#
+#   These should concern: debug output, optimization & warnings.
+#
+#   Use the ANSIFLAGS variable to define the compiler flags used to enfore
+#   ANSI compliance.
+#
+ifndef CFLAGS
+  CFLAGS := -c -g -O0 -Wall
+endif
+
+# ANSIFLAGS: Put there the flags used to make your compiler ANSI-compliant.
+#
+ANSIFLAGS := -ansi -pedantic
+
+
+# Library linking
+#
+ifndef
+CLEAN_LIBRARY = $(DELETE) $(subst $(SEP),$(HOSTSEP),$(PROJECT_LIBRARY)) $(NO_OUTPUT)
+endif
+LINK_LIBRARY  = $(AR) -r $@ $(OBJECTS_LIST)
+
+# EOF
--- /dev/null
+++ b/builds/compiler/gcc.mk
@@ -1,0 +1,68 @@
+# Copyright 2000 David Turner
+#
+#  gcc-specific definitions
+#
+
+# Compiler command line name
+CC := gcc
+
+# The object file extension (for standard and static libraries).  This can be
+# .o, .tco, .obj, etc., depending on the platform.
+#
+O  := o
+SO := o
+
+# The library file extension (for standard and static libraries).  This can
+# be .a, .lib, etc., depending on the platform.
+#
+A  := a
+SA := a
+
+
+# Path inclusion flag.  Some compilers use a different flag than `-I' to
+# specify an additional include path.  Examples are `/i=' or `-J'.
+#
+I := -I
+
+
+# C flag used to define a macro before the compilation of a given source
+# object.  Usually is `-D' like in `-DDEBUG'.
+#
+D := -D
+
+
+# The link flag used to specify a given library file on link.  Note that
+# this is only used to compile the demo programs, not the library itself.
+#
+L := -l
+
+
+# Target flag.
+#
+T := -o # Don't remove this comment line!  We need the space after `-o'.
+
+
+# C flags
+#
+#   These should concern: debug output, optimization & warnings.
+#
+#   Use the ANSIFLAGS variable to define the compiler flags used to enfore
+#   ANSI compliance.
+#
+ifndef CFLAGS
+  CFLAGS := -c -g -O6 -Wall
+endif
+
+# ANSIFLAGS: Put there the flags used to make your compiler ANSI-compliant.
+#
+ANSIFLAGS := -ansi -pedantic
+
+
+# Library linking
+#
+ifndef CLEAN_LIBRARY
+CLEAN_LIBRARY = $(DELETE) $(subst $(SEP),$(HOSTSEP),$(PROJECT_LIBRARY)) $(NO_OUTPUT)
+endif
+LINK_LIBRARY  = $(AR) -r $@ $(OBJECTS_LIST)
+
+# EOF
--- /dev/null
+++ b/builds/compiler/visualage.mk
@@ -1,0 +1,62 @@
+#
+# Visual Age C++ specific definitions
+#
+
+# command line compiler name
+#
+CC       := icc
+
+# The object file extension (for standard and static libraries).  This can be
+# .o, .tco, .obj, etc., depending on the platform.
+#
+O  := obj
+SO := obj
+
+# The library file extension (for standard and static libraries).  This can
+# be .a, .lib, etc., depending on the platform.
+#
+A  := lib
+SA := lib
+
+# Path inclusion flag.  Some compilers use a different flag than `-I' to
+# specify an additional include path.  Examples are `/i=' or `-J'.
+#
+I := /I
+
+
+# C flag used to define a macro before the compilation of a given source
+# object.  Usually is `-D' like in `-DDEBUG'.
+#
+D := /D
+
+
+# The link flag used to specify a given library file on link.  Note that
+# this is only used to compile the demo programs, not the library itself.
+#
+L := /Fl
+
+
+# Target flag.
+#
+T := /Fo
+
+
+# C flags
+#
+#   These should concern: debug output, optimization & warnings.
+#
+ifndef CFLAGS
+  CFLAGS := /Q- /Gd+ /O2 /G5 /W3 /C
+endif
+
+# ANSIFLAGS: Put there the flags used to make your compiler ANSI-compliant.
+#
+ANSI_FLAGS := /Sa
+
+
+# Library linking
+#
+#CLEAN_LIBRARY :=
+LINK_LIBRARY   = lib /nologo /out:$@ $(OBJECTS_LIST)
+
+# EOF
--- /dev/null
+++ b/builds/compiler/visualc.mk
@@ -1,0 +1,64 @@
+#
+# Visual C++ definitions
+#
+
+# compiler command line name
+CC := cl
+
+# The object file extension (for standard and static libraries).  This can be
+# .o, .tco, .obj, etc., depending on the platform.
+#
+O  := obj
+SO := obj
+
+# The library file extension (for standard and static libraries).  This can
+# be .a, .lib, etc., depending on the platform.
+#
+A  := lib
+SA := lib
+
+
+# Path inclusion flag.  Some compilers use a different flag than `-I' to
+# specify an additional include path.  Examples are `/i=' or `-J'.
+#
+I := /I
+
+
+# C flag used to define a macro before the compilation of a given source
+# object.  Usually is `-D' like in `-DDEBUG'.
+#
+D := /D
+
+
+# The link flag used to specify a given library file on link.  Note that
+# this is only used to compile the demo programs, not the library itself.
+#
+L := /Fl
+
+
+# Target flag.
+#
+T := /Fo
+
+
+# C flags
+#
+#   These should concern: debug output, optimization & warnings.
+#
+#   Use the ANSIFLAGS variable to define the compiler flags used to enfore
+#   ANSI compliance.
+#
+ifndef CFLAGS
+  CFLAGS := /nologo /c /Ox /G5 /W3 /WX
+endif
+
+# ANSIFLAGS: Put there the flags used to make your compiler ANSI-compliant.
+#
+ANSIFLAGS := /Za
+
+# Library linking
+#
+#CLEAN_LIBRARY =
+LINK_LIBRARY  = lib /nologo /out:$@ $(OBJECTS_LIST)
+
+# EOF
--- /dev/null
+++ b/builds/compiler/win-lcc.mk
@@ -1,0 +1,68 @@
+#
+#  Win32-LCC specific definitions
+#
+
+# Command line name
+#
+CC := lcc
+
+# The object file extension (for standard and static libraries).  This can be
+# .o, .tco, .obj, etc., depending on the platform.
+#
+O  := obj
+SO := obj
+
+# The library file extension (for standard and static libraries).  This can
+# be .a, .lib, etc., depending on the platform.
+#
+A  := lib
+SA := lib
+
+
+# Path inclusion flag.  Some compilers use a different flag than `-I' to
+# specify an additional include path.  Examples are `/i=' or `-J'.
+#
+I := -I
+
+
+# C flag used to define a macro before the compilation of a given source
+# object.  Usually is `-D' like in `-DDEBUG'.
+#
+D := -D
+
+
+# The link flag used to specify a given library file on link.  Note that
+# this is only used to compile the demo programs, not the library itself.
+#
+L := -Fl
+
+
+# Target flag.
+#
+T := -Fo
+
+
+# C flags
+#
+#   These should concern: debug output, optimization & warnings.
+#
+#   Use the ANSIFLAGS variable to define the compiler flags used to enfore
+#   ANSI compliance.
+#
+ifndef CFLAGS
+  CFLAGS := -c -g2 -O
+endif
+
+# ANSIFLAGS: Put there the flags used to make your compiler ANSI-compliant.
+#
+#  LCC is pure ANSI anyway !!
+#
+ANSIFLAGS :=
+
+
+# library linking
+#
+#CLEAN_LIBRARY := 
+LINK_LIBRARY = lcclib /out:$(subst $(SEP),\\,$@) $(subst $(SEP),\\,$(OBJECTS_LIST))
+                    
+# EOF
--- /dev/null
+++ b/builds/dos/dos-def.mk
@@ -1,0 +1,73 @@
+# Copyright 2000 David Turner <[email protected]>
+#
+#  DOS specific definitions
+#
+
+DELETE   := del
+HOSTSEP  := $(strip \ )
+BUILD    := $(TOP)$(SEP)builds$(SEP)dos
+PLATFORM := dos
+
+# except for DJGPP/GCC on Dos
+ifndef SEP
+SEP      := $(HOSTSEP)
+endif
+
+
+# The directory where all object files are placed.
+#
+# This lets you build the library in your own directory with something like
+#
+#   set TOP=.../path/to/freetype2/top/dir...
+#   set OBJ_DIR=.../path/to/obj/dir
+#   make -f %TOP%/Makefile setup [options]
+#   make -f %TOP%/Makefile
+#
+ifndef OBJ_DIR
+  OBJ_DIR := $(TOP)$(SEP)obj
+endif
+
+
+# The directory where all library files are placed.
+#
+# By default, this is the same as $(OBJ_DIR), however, this can be changed
+# to suit particular needs.
+#
+LIB_DIR := $(OBJ_DIR)
+
+# The name of the final library file.  Note that the DOS-specific Makefile
+# uses a shorter (8.3) name.
+#
+LIBRARY := $(PROJECT)
+
+
+# the NO_OUTPUT macro is used to ignore the output of commands
+# 
+NO_OUTPUT = &> nul
+
+
+ifdef BUILD_PROJECT
+
+  # Now include the main sub-makefile.  It contains all the rules used to
+  # build the library with the previous variables defined.
+  #
+  include $(TOP)/builds/$(PROJECT).mk
+
+  # The cleanup targets.
+  #
+  clean_project: clean_project_dos
+  distclean_project: distclean_project_dos
+
+  # This final rule is used to link all object files into a single library. 
+  # It is part of the system-specific sub-Makefile because not all
+  # librarians accept a simple syntax like
+  #
+  #   librarian library_file {list of object files} 
+  #
+  $(PROJECT_LIBRARY): $(OBJECTS_LIST)
+	  -$(CLEAN_LIBRARY) $(NO_OUTPUT)
+	  $(LINK_LIBRARY)
+
+endif
+
+
--- a/builds/dos/dos-gcc.mk
+++ b/builds/dos/dos-gcc.mk
@@ -2,135 +2,9 @@
 # FreeType 2 configuration rules for the DJGPP compiler
 #
 
-
-# Copyright 1996-2000 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.
-
-
-ifndef TOP
-  TOP := .
-endif
-
-DELETE   := rm -f
-SEP      := /
-HOSTSEP  := $(strip \ )
-BUILD    := $(TOP)/builds/dos
-PLATFORM := dos
-
-
-# The directory where all object files are placed.
-#
-# This lets you build the library in your own directory with something like
-#
-#   set TOP=.../path/to/freetype2/top/dir...
-#   set OBJ_DIR=.../path/to/obj/dir
-#   make -f %TOP%/Makefile setup [options]
-#   make -f %TOP%/Makefile
-#
-ifndef OBJ_DIR
-  OBJ_DIR := $(TOP)$(SEP)obj
-endif
-
-
-# The directory where all library files are placed.
-#
-# By default, this is the same as $(OBJ_DIR), however, this can be changed
-# to suit particular needs.
-#
-LIB_DIR := $(OBJ_DIR)
-
-
-# The object file extension (for standard and static libraries).  This can be
-# .o, .tco, .obj, etc., depending on the platform.
-#
-O  := o
-SO := o
-
-# The library file extension (for standard and static libraries).  This can
-# be .a, .lib, etc., depending on the platform.
-#
-A  := a
-SA := a
-
-
-# The name of the final library file.  Note that the DOS-specific Makefile
-# uses a shorter (8.3) name.
-#
-LIBRARY := libfreetype
-
-
-# Path inclusion flag.  Some compilers use a different flag than `-I' to
-# specify an additional include path.  Examples are `/i=' or `-J'.
-#
-I := -I
-
-
-# C flag used to define a macro before the compilation of a given source
-# object.  Usually is `-D' like in `-DDEBUG'.
-#
-D := -D
-
-
-# The link flag used to specify a given library file on link.  Note that
-# this is only used to compile the demo programs, not the library itself.
-#
-L := -l
-
-
-# Target flag.
-#
-T := -o # Don't remove this comment line!  We need the space after `-o'.
-
-
-# C flags
-#
-#   These should concern: debug output, optimization & warnings.
-#
-#   Use the ANSIFLAGS variable to define the compiler flags used to enfore
-#   ANSI compliance.
-#
-ifndef CFLAGS
-  CFLAGS := -c -g -O6 -Wall
-endif
-
-# ANSIFLAGS: Put there the flags used to make your compiler ANSI-compliant.
-#
-ANSIFLAGS := -ansi -pedantic
-
-
-ifdef BUILD_FREETYPE
-
-  # Now include the main sub-makefile.  It contains all the rules used to
-  # build the library with the previous variables defined.
-  #
-  include $(TOP)/builds/freetype.mk
-
-  # The cleanup targets.
-  #
-  clean_freetype: clean_freetype_dos
-  distclean_freetype: distclean_freetype_dos
-
-  # Librarian to use to build the static library
-  #
-  FT_LIBRARIAN := $(AR) -r
-
-
-  # This final rule is used to link all object files into a single library. 
-  # It is part of the system-specific sub-Makefile because not all
-  # librarians accept a simple syntax like:
-  #
-  #   librarian library_file {list of object files}
-  #
-  $(FT_LIBRARY): $(OBJECTS_LIST)
-	  -$(DELETE) $@
-	  $(FT_LIBRARIAN) $@ $(OBJECTS_LIST)
-
-endif
+SEP := /
+CLEAN_LIBRARY := $(DELETE) $@
+include $(TOP)/builds/dos/dos-def.mk
+include $(TOP)/builds/compiler/gcc.mk
 
 # EOF
--- a/builds/freetype.mk
+++ b/builds/freetype.mk
@@ -109,7 +109,7 @@
 
 # The final name of the library file.
 #
-FT_LIBRARY := $(LIB_)$(LIBRARY).$A
+PROJECT_LIBRARY := $(LIB_)$(LIBRARY).$A
 
 
 # include paths
@@ -237,7 +237,7 @@
 
 objects: $(OBJECTS_LIST)
 
-library: $(FT_LIBRARY)
+library: $(PROJECT_LIBRARY)
 
 .c.$O:
 	$(FT_COMPILE) $T$@ $<
@@ -246,26 +246,26 @@
 # Standard cleaning and distclean rules.  These are not accepted
 # on all systems though.
 #
-clean_freetype_std:
+clean_project_std:
 	-$(DELETE) $(BASE_OBJECTS) $(OBJ_M) $(OBJ_S) $(CLEAN)
 
-distclean_freetype_std: clean_freetype_std
-	-$(DELETE) $(FT_LIBRARY)
+distclean_project_std: clean_project_std
+	-$(DELETE) $(PROJECT_LIBRARY)
 	-$(DELETE) *.orig *~ core *.core $(DISTCLEAN)
 
 # The Dos command shell does not support very long list of arguments, so
 # we are stuck with wildcards.
 #
-clean_freetype_dos:
-	-$(DELETE) $(subst $(SEP),$(HOSTSEP),$(OBJ_))*.$O $(CLEAN) 2> nul
+clean_project_dos:
+	-$(DELETE) $(subst $(SEP),$(HOSTSEP),$(OBJ_))*.$O $(CLEAN) $(NO_OUTPUT)
 
-distclean_freetype_dos: clean_freetype_dos
-	-$(DELETE) $(subst $(SEP),$(HOSTSEP),$(FT_LIBRARY)) $(DISTCLEAN) 2> nul
+distclean_project_dos: clean_project_dos
+	-$(DELETE) $(subst $(SEP),$(HOSTSEP),$(PROJECT_LIBRARY)) $(DISTCLEAN) $(NO_OUTPUT)
 
 # Remove configuration file (used for distclean).
 #
 remove_config_mk:
-	-$(DELETE) $(subst $(SEP),$(HOSTSEP),$(CONFIG_MK))
+	-$(DELETE) $(subst $(SEP),$(HOSTSEP),$(CONFIG_MK)) $(NO_OUTPUT)
 
 
 # The `config.mk' file must define `clean_freetype' and
@@ -273,7 +273,7 @@
 # the `std' or `dos' versions from above, or simply provide their own
 # implementation.
 #
-clean: clean_freetype
-distclean: distclean_freetype remove_config_mk
+clean: clean_project
+distclean: distclean_project remove_config_mk
 
 # EOF
--- /dev/null
+++ b/builds/link_dos.mk
@@ -1,0 +1,31 @@
+#
+#  Link instructions for Dos-like systems (Dos, Win32, OS/2)
+#
+
+ifdef BUILD_PROJECT
+
+  # Now include the main sub-makefile.  It contains all the rules used to
+  # build the library with the previous variables defined.
+  #
+  include $(TOP)/builds/$(PROJECT).mk
+
+  # The cleanup targets.
+  #
+  clean_project: clean_project_dos
+  distclean_project: distclean_project_dos
+
+  # This final rule is used to link all object files into a single library. 
+  # It is part of the system-specific sub-Makefile because not all
+  # librarians accept a simple syntax like
+  #
+  #   librarian library_file {list of object files} 
+  #
+  $(PROJECT_LIBRARY): $(OBJECTS_LIST)
+ifdef CLEAN_LIBRARY  
+	-$(CLEAN_LIBRARY) $(NO_OUTPUT)
+endif          
+	$(LINK_LIBRARY)
+
+endif
+
+# EOF
--- /dev/null
+++ b/builds/link_std.mk
@@ -1,0 +1,31 @@
+#
+#  Link instructions for standard systems
+#
+
+ifdef BUILD_PROJECT
+
+  # Now include the main sub-makefile.  It contains all the rules used to
+  # build the library with the previous variables defined.
+  #
+  include $(TOP)/builds/$(PROJECT).mk
+
+  # The cleanup targets.
+  #
+  clean_project: clean_project_std
+  distclean_project: distclean_project_std
+
+  # This final rule is used to link all object files into a single library. 
+  # It is part of the system-specific sub-Makefile because not all
+  # librarians accept a simple syntax like
+  #
+  #   librarian library_file {list of object files} 
+  #
+  $(PROJECT_LIBRARY): $(OBJECTS_LIST)
+ifdef CLEAN_LIBRARY  
+	  -$(CLEAN_LIBRARY) $(NO_OUTPUT)
+endif          
+	  $(LINK_LIBRARY)
+
+endif
+
+# EOF
--- a/builds/modules.mk
+++ b/builds/modules.mk
@@ -24,8 +24,8 @@
 # MODULE_LIST, as its name suggests, indicates where the modules list
 # resides.  For now, it is in `include/freetype/config/ftmodule.h'.
 #
-ifndef FT_MODULE_LIST
-  FT_MODULE_LIST := $(TOP)$(SEP)include$(SEP)freetype$(SEP)config$(SEP)ftmodule.h
+ifndef MODULE_LIST
+  MODULE_LIST := $(TOP)$(SEP)include$(SEP)freetype$(SEP)config$(SEP)ftmodule.h
 endif
 
 # To build the modules list, we invoke the `make_module_list' target.
@@ -33,14 +33,14 @@
 # This rule is commented out by default since FreeType comes already with
 # a ftmodule.h file.
 #
-#$(FT_MODULE_LIST): make_module_list
+#$(MODULE_LIST): make_module_list
 
 # Before the modules list file can be generated, we must remove the file in
 # order to `clean' the list.
 #
 clean_module_list:
-	@-$(DELETE) $(subst $(SEP),$(HOSTSEP),$(FT_MODULE_LIST))
-	@-echo Regenerating the modules list in $(FT_MODULE_LIST)...
+	@-$(DELETE) $(subst $(SEP),$(HOSTSEP),$(MODULE_LIST))
+	@-echo Regenerating the modules list in $(MODULE_LIST)...
 
 make_module_list: clean_module_list
 	@echo done.
@@ -51,10 +51,10 @@
 #
 ifneq ($(findstring $(PLATFORM),dos win32 win16 os2),)
   OPEN_MODULE  := @echo #
-  CLOSE_MODULE :=  >> $(subst $(SEP),$(HOSTSEP),$(FT_MODULE_LIST))
+  CLOSE_MODULE :=  >> $(subst $(SEP),$(HOSTSEP),$(MODULE_LIST))
 else
   OPEN_MODULE  := @echo "
-  CLOSE_MODULE := " >> $(FT_MODULE_LIST)
+  CLOSE_MODULE := " >> $(MODULE_LIST)
 endif
 
 # $(OPEN_DRIVER) & $(CLOSE_DRIVER) are used to specify a given font driver
--- /dev/null
+++ b/builds/os2/os2-def.mk
@@ -1,0 +1,73 @@
+# Copyright 2000 David Turner <[email protected]>
+#
+#  OS/2 specific definitions
+#
+
+DELETE   := del
+HOSTSEP  := $(strip \ )
+BUILD    := $(TOP)$(SEP)builds$(SEP)os2
+PLATFORM := os2
+
+# except for GCC+emx on OS/2
+ifndef SEP
+SEP      := $(HOSTSEP)
+endif
+
+
+# The directory where all object files are placed.
+#
+# This lets you build the library in your own directory with something like
+#
+#   set TOP=.../path/to/freetype2/top/dir...
+#   set OBJ_DIR=.../path/to/obj/dir
+#   make -f %TOP%/Makefile setup [options]
+#   make -f %TOP%/Makefile
+#
+ifndef OBJ_DIR
+  OBJ_DIR := $(TOP)$(SEP)obj
+endif
+
+
+# The directory where all library files are placed.
+#
+# By default, this is the same as $(OBJ_DIR), however, this can be changed
+# to suit particular needs.
+#
+LIB_DIR := $(OBJ_DIR)
+
+# The name of the final library file.  Note that the DOS-specific Makefile
+# uses a shorter (8.3) name.
+#
+LIBRARY := $(PROJECT)
+
+
+# the NO_OUTPUT macro is used to ignore the output of commands
+# 
+NO_OUTPUT = 2> nul
+
+
+ifdef BUILD_LIBRARY
+
+  # Now include the main sub-makefile.  It contains all the rules used to
+  # build the library with the previous variables defined.
+  #
+  include $(TOP)/builds/$(PROJECT).mk
+
+  # The cleanup targets.
+  #
+  clean_project: clean_project_dos
+  distclean_project: distclean_project_dos
+
+  # This final rule is used to link all object files into a single library. 
+  # It is part of the system-specific sub-Makefile because not all
+  # librarians accept a simple syntax like
+  #
+  #   librarian library_file {list of object files} 
+  #
+  $(PROJECT_LIBRARY): $(OBJECTS_LIST)
+	  -$(CLEAN_LIBRARY) $(NO_OUTPUT)
+	  $(LINK_LIBRARY)
+
+endif
+
+
--- /dev/null
+++ b/builds/toplevel.mk
@@ -1,0 +1,105 @@
+#
+# FreeType build system -- top-level sub-Makefile
+#
+
+# Copyright 2000 by David Turner
+
+
+# This file is designed for GNU Make, do not use it with another Make tool!
+#
+# It works as follows:
+#
+# - When invoked for the first time, this Makefile will include the rules
+#   found in `PROJECT/builds/detect.mk'.  They are in charge of detecting
+#   the current platform.
+#
+#   A summary of the detection will be displayed, and the file `config.mk'
+#   will be created in the current directory.
+#
+# - When invoked later, this Makefile will include the rules found in
+#   `config.mk'.  This sub-Makefile will define some system-specific
+#   variables (like compiler, compilation flags, object suffix, etc.), then
+#   include the rules found in `PROJECT/builds/PROJECT.mk', used to build
+#   the library.
+#
+# See the comments in `builds/detect.mk' and `builds/PROJECT.mk' for more
+# details on host platform detection and library builds.
+
+
+.PHONY: setup
+
+CONFIG_MK := config.mk
+
+# If no configuration sub-makefile is present, or if `setup' is the target
+# to be built, run the auto-detection rules to figure out which
+# configuration rules file to use.
+#
+# Note that the configuration file is put in the current directory, which is
+# not necessarily $(TOP).
+
+# If `config.mk' is not present, set `check_platform'.
+#
+ifeq ($(wildcard $(CONFIG_MK)),)
+  check_platform := 1
+endif
+
+# If `setup' is one of the targets requested, set `check_platform'.
+#
+ifneq ($(findstring setup,$(MAKECMDGOALS)),)
+  check_platform := 1
+endif
+
+# Include the automatic host platform detection rules when we need to
+# check the platform.
+#
+ifdef check_platform
+
+  all: setup
+
+ifdef USE_MODULES  
+  # If the module list $(MODULE_LIST) file is not present, generate it.
+  #
+  #modules: make_module_list setup
+endif
+
+  include $(TOP)/builds/detect.mk
+
+ifdef USE_MODULES  
+  include $(TOP)/builds/modules.mk
+
+  ifeq ($(wildcard $(MODULE_LIST)),)
+    setup: make_module_list
+  endif
+endif
+
+  # This rule makes sense for Unix only to remove files created by a run
+  # of the configure script which hasn't been successful (so that no
+  # `config.mk' has been created).  It uses the built-in $(RM) command of
+  # GNU make.
+  #
+  distclean:
+	$(RM) builds/unix/config.cache
+	$(RM) builds/unix/config.log
+	$(RM) builds/unix/config.status
+
+  # IMPORTANT:
+  #
+  # `setup' must be defined by the host platform detection rules to create
+  # the `config.mk' file in the current directory.
+
+else
+
+  # A configuration sub-Makefile is present -- simply run it.
+  #
+  all: single
+
+ifdef USE_MODULES
+  modules: make_module_list
+endif
+
+  BUILD_PROJECT := yes
+  include $(CONFIG_MK)
+
+endif # test check_platform
+
+# EOF
--- a/builds/unix/configure.in
+++ b/builds/unix/configure.in
@@ -82,7 +82,7 @@
 dnl create the Unix-specific sub-Makefile `builds/unix/unix.mk' that will be
 dnl used by the build system
 dnl
-AC_OUTPUT(unix.mk:unix.in)
-
+AC_OUTPUT(unix-def.mk:unix-def.in)
+AC_OUTPUT(unix-cc.mk:unix-cc.in)
 
 dnl end of configure.in
--- /dev/null
+++ b/builds/unix/install.mk
@@ -1,0 +1,53 @@
+#
+#  installation instructions for Unix systems
+#  this file is FreeType-specific
+#
+
+  # Unix installation and deinstallation targets.
+  install: $(PROJECT_LIBRARY)
+	  $(MKINSTALLDIRS) $(libdir)                       \
+                           $(includedir)/freetype/config   \
+                           $(includedir)/freetype/internal \
+                           $(includedir)/freetype/cache
+	  $(LIBTOOL) --mode=install $(INSTALL) $(PROJECT_LIBRARY) $(libdir)
+	  -for P in $(PUBLIC_H) ; do                     \
+            $(INSTALL_DATA) $$P $(includedir)/freetype ; \
+          done
+	  -for P in $(BASE_H) ; do                                \
+            $(INSTALL_DATA) $$P $(includedir)/freetype/internal ; \
+          done
+	  -for P in $(CONFIG_H) ; do                            \
+            $(INSTALL_DATA) $$P $(includedir)/freetype/config ; \
+          done
+	  -for P in $(BASE_H) ; do                                \
+            $(INSTALL_DATA) $$P $(includedir)/freetype/cache ; \
+          done
+
+  uninstall:
+	  -$(LIBTOOL) --mode=uninstall $(RM) $(libdir)/$(LIBRARY).$A
+	  -$(DELETE) $(includedir)/freetype/config/*
+	  -$(DELDIR) $(includedir)/freetype/config
+	  -$(DELETE) $(includedir)/freetype/internal/*
+	  -$(DELDIR) $(includedir)/freetype/internal
+	  -$(DELETE) $(includedir)/freetype/*
+	  -$(DELDIR) $(includedir)/freetype
+
+
+  # Unix cleaning and distclean rules.
+  #
+  clean_project_unix:
+	  -$(DELETE) $(BASE_OBJECTS) $(OBJ_M) $(OBJ_S)
+	  -$(DELETE) $(patsubst %.$O,%.$(SO),$(BASE_OBJECTS) $(OBJ_M) $(OBJ_S)) \
+                     $(CLEAN)
+
+  distclean_project_unix: clean_project_unix
+	  -$(DELETE) $(PROJECT_LIBRARY)
+	  -$(DELETE) $(OBJ_DIR)/.libs/*
+	  -$(DELDIR) $(OBJ_DIR)/.libs
+	  -$(DELETE) *.orig *~ core *.core $(DISTCLEAN)
+
+endif
+
+
+
+# EOF
--- /dev/null
+++ b/builds/unix/unix-cc.in
@@ -1,0 +1,78 @@
+# template for Unix-specific compiler definitions
+#
+
+CC            := @CC@
+
+LIBTOOL       := $(BUILD)/libtool
+
+# The object file extension (for standard and static libraries).  This can be
+# .o, .tco, .obj, etc., depending on the platform.
+#
+O  := lo
+SO := o
+
+# The library file extension (for standard and static libraries).  This can
+# be .a, .lib, etc., depending on the platform.
+#
+A  := la
+SA := a
+
+
+# The name of the final library file.  Note that the DOS-specific Makefile
+# uses a shorter (8.3) name.
+#
+LIBRARY := lib$(PROJECT)
+
+
+# Path inclusion flag.  Some compilers use a different flag than `-I' to
+# specify an additional include path.  Examples are `/i=' or `-J'.
+#
+I := -I
+
+
+# C flag used to define a macro before the compilation of a given source
+# object.  Usually is `-D' like in `-DDEBUG'.
+#
+D := -D
+
+
+# The link flag used to specify a given library file on link.  Note that
+# this is only used to compile the demo programs, not the library itself.
+#
+L := -l
+
+
+# Target flag.
+#
+T := -o # Don't remove this comment line!  We need the space after `-o'.
+
+
+# C flags
+#
+#   These should concern: debug output, optimization & warnings.
+#
+#   Use the ANSIFLAGS variable to define the compiler flags used to enfore
+#   ANSI compliance.
+#
+CFLAGS := -c @XX_CFLAGS@ @CFLAGS@
+
+# ANSIFLAGS: Put there the flags used to make your compiler ANSI-compliant.
+#
+ANSIFLAGS := @XX_ANSIFLAGS@
+
+# C compiler to use -- we use libtool!
+#
+#
+CCraw := $(CC)
+CC    := $(LIBTOOL) --mode=compile $(CCraw)
+
+# Linker flags.
+#
+LDFLAGS := @LDFLAGS@
+
+
+# Library linking
+#
+LINK_LIBRARY = $(LIBTOOL) --mode=link $(CCraw) -o $@ $(OBJECTS_LIST) \
+                       -rpath $(libdir) -version-info $(version_info)
+
--- /dev/null
+++ b/builds/unix/unix-def.in
@@ -1,0 +1,104 @@
+#
+# FreeType 2 configuration rules templates for Unix + configure
+#
+
+
+# Copyright 1996-2000 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.
+
+
+ifndef TOP
+  TOP := .
+endif
+TOP := $(shell cd $(TOP); pwd)
+
+DELETE        := @RMF@
+DELDIR        := @RMDIR@
+SEP           := /
+HOSTSEP       := $(SEP)
+BUILD         := $(TOP)/builds/unix
+PLATFORM      := unix
+
+# don't use `:=' here since the path stuff will be included after this file
+#
+FTSYS_SRC = @FTSYS_SRC@
+
+INSTALL       := @INSTALL@
+INSTALL_DATA  := @INSTALL_DATA@
+MKINSTALLDIRS := $(BUILD)/mkinstalldirs
+
+DISTCLEAN += $(BUILD)/config.cache  \
+             $(BUILD)/config.log    \
+             $(BUILD)/config.status \
+             $(BUILD)/unix.mk       \
+             $(BUILD)/ftconfig.h    \
+             $(LIBTOOL)
+
+
+# Standard installation variables.
+#
+prefix       := @prefix@
+exec_prefix  := @exec_prefix@
+libdir       := @libdir@
+bindir       := @bindir@
+includedir   := @includedir@
+
+version_info := @version_info@
+
+
+# The directory where all object files are placed.
+#
+# This lets you build the library in your own directory with something like
+#
+#   set TOP=.../path/to/freetype2/top/dir...
+#   set OBJ_DIR=.../path/to/obj/dir
+#   make -f $TOP/Makefile setup [options]
+#   make -f $TOP/Makefile
+#
+ifndef OBJ_DIR
+  OBJ_DIR := $(shell cd $(TOP)/obj; pwd)
+endif
+
+
+# The directory where all library files are placed.
+#
+# By default, this is the same as $(OBJ_DIR), however, this can be changed
+# to suit particular needs.
+#
+LIB_DIR := $(OBJ_DIR)
+
+
+ifdef BUILD_PROJECT
+
+  # Now include the main sub-makefile.  It contains all the rules used to
+  # build the library with the previous variables defined.
+  #
+  include $(TOP)/builds/$(PROJECT).mk
+
+
+  # The cleanup targets.
+  #
+  clean_project: clean_project_unix
+  distclean_project: distclean_project_unix
+
+
+  # This final rule is used to link all object files into a single library. 
+  # It is part of the system-specific sub-Makefile because not all
+  # librarians accept a simple syntax like
+  #
+  #   librarian library_file {list of object files} 
+  #
+  $(PROJECT_LIBRARY): $(OBJECTS_LIST)
+ifdef CLEAN_LIBRARY  
+	  -$(CLEAN_LIBRARY) $(NO_OUTPUT)
+endif          
+	  $(LINK_LIBRARY)
+
+
+# EOF
--- a/builds/unix/unix-dev.mk
+++ b/builds/unix/unix-dev.mk
@@ -2,136 +2,11 @@
 # FreeType 2 Configuration rules for Unix + GCC
 #
 #   Development version without optimizations & libtool
+#   and no installation..
 #
 
-
-# Copyright 1996-2000 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.
-#
-
-ifndef TOP
-  TOP := .
-endif
-
-DELETE   := rm -f
-SEP      := /
-HOSTSEP  := $(SEP)
-BUILD    := $(TOP)/builds/unix/devel # we use a special devel ftoption.h
-PLATFORM := unixdev  # do not set it to `unix', or libtool will trick you
-CC       := gcc
-
-# The directory where all object files are placed.
-#
-# Note that this is not $(TOP)/obj!
-# This lets you build the library in your own directory with something like
-#
-#   set TOP=.../path/to/freetype2/top/dir...
-#   mkdir obj
-#   make -f %TOP%/Makefile setup [options]
-#   make -f %TOP%/Makefile
-#
-OBJ_DIR := obj
-
-
-# The directory where all library files are placed.
-#
-# By default, this is the same as $(OBJ_DIR), however, this can be changed
-# to suit particular needs.
-#
-LIB_DIR := $(OBJ_DIR)
-
-
-# The object file extension (for standard and static libraries).  This can be
-# .o, .tco, .obj, etc., depending on the platform.
-#
-O  := o
-SO := o
-
-# The library file extension (for standard and static libraries).  This can
-# be .a, .lib, etc., depending on the platform.
-#
-A  := a
-SA := a
-
-
-# The name of the final library file.  Note that the DOS-specific Makefile
-# uses a shorter (8.3) name.
-#
-LIBRARY := libfreetype
-
-
-# Path inclusion flag.  Some compilers use a different flag than `-I' to
-# specify an additional include path.  Examples are `/i=' or `-J'.
-#
-I := -I
-
-
-# C flag used to define a macro before the compilation of a given source
-# object.  Usually is `-D' like in `-DDEBUG'.
-#
-D := -D
-
-
-# The link flag used to specify a given library file on link.  Note that
-# this is only used to compile the demo programs, not the library itself.
-#
-L := -l
-
-
-# Target flag.
-#
-T := -o # Don't remove this comment line!  We need the space after `-o'.
-
-
-# C flags
-#
-#   These should concern: debug output, optimization & warnings.
-#
-#   Use the ANSIFLAGS variable to define the compiler flags used to enfore
-#   ANSI compliance.
-#
-ifndef CFLAGS
-  CFLAGS := -c -g -O0 -Wall -W
-endif
-
-# ANSIFLAGS: Put there the flags used to make your compiler ANSI-compliant.
-#
-ANSIFLAGS := -ansi -pedantic
-
-
-ifdef BUILD_FREETYPE
-
-  # Now include the main sub-makefile.  It contains all the rules used to
-  # build the library with the previous variables defined.
-  #
-  include $(TOP)/builds/freetype.mk
-
-  # The cleanup targets.
-  #
-  clean_freetype: clean_freetype_std
-  distclean_freetype: distclean_freetype_std
-
-  # Librarian to use to build the static library
-  #
-  FT_LIBRARIAN := $(AR) -r
-
-
-  # This final rule is used to link all object files into a single library. 
-  # It is part of the system-specific sub-Makefile because not all
-  # librarians accept a simple syntax like
-  #
-  #   librarian library_file {list of object files} 
-  #
-  $(FT_LIBRARY): $(OBJECTS_LIST)
-	  -$(DELETE) $(subst $(SEP),$(HOSTSEP),$(FT_LIBRARY)) 2> nul
-	  $(FT_LIBRARIAN) $@ $(OBJECTS_LIST)
-
-endif
+include $(TOP)/builds/unix/unixddef.mk
+include $(TOP)/builds/compiler/gcc-dev.mk
+include $(TOP)/builds/link_std.mk
 
 # EOF
--- a/builds/unix/unix.in
+++ /dev/null
@@ -1,218 +1,0 @@
-#
-# FreeType 2 configuration rules templates for Unix + configure
-#
-
-
-# Copyright 1996-2000 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.
-
-
-ifndef TOP
-  TOP := .
-endif
-TOP := $(shell cd $(TOP); pwd)
-
-DELETE        := @RMF@
-DELDIR        := @RMDIR@
-SEP           := /
-HOSTSEP       := $(SEP)
-BUILD         := $(TOP)/builds/unix
-PLATFORM      := unix
-CC            := @CC@
-
-INSTALL       := @INSTALL@
-INSTALL_DATA  := @INSTALL_DATA@
-MKINSTALLDIRS := $(BUILD)/mkinstalldirs
-
-LIBTOOL       := $(BUILD)/libtool
-
-
-# don't use `:=' here since the path stuff will be included after this file
-#
-FTSYS_SRC = @FTSYS_SRC@
-
-DISTCLEAN += $(BUILD)/config.cache  \
-             $(BUILD)/config.log    \
-             $(BUILD)/config.status \
-             $(BUILD)/unix.mk       \
-             $(BUILD)/ftconfig.h    \
-             $(LIBTOOL)
-
-
-# Standard installation variables.
-#
-prefix       := @prefix@
-exec_prefix  := @exec_prefix@
-libdir       := @libdir@
-bindir       := @bindir@
-includedir   := @includedir@
-
-version_info := @version_info@
-
-
-# The directory where all object files are placed.
-#
-# This lets you build the library in your own directory with something like
-#
-#   set TOP=.../path/to/freetype2/top/dir...
-#   set OBJ_DIR=.../path/to/obj/dir
-#   make -f $TOP/Makefile setup [options]
-#   make -f $TOP/Makefile
-#
-ifndef OBJ_DIR
-  OBJ_DIR := $(shell cd $(TOP)/obj; pwd)
-endif
-
-
-# The directory where all library files are placed.
-#
-# By default, this is the same as $(OBJ_DIR), however, this can be changed
-# to suit particular needs.
-#
-LIB_DIR := $(OBJ_DIR)
-
-
-# The object file extension (for standard and static libraries).  This can be
-# .o, .tco, .obj, etc., depending on the platform.
-#
-O  := lo
-SO := o
-
-# The library file extension (for standard and static libraries).  This can
-# be .a, .lib, etc., depending on the platform.
-#
-A  := la
-SA := a
-
-
-# The name of the final library file.  Note that the DOS-specific Makefile
-# uses a shorter (8.3) name.
-#
-LIBRARY := libfreetype
-
-
-# Path inclusion flag.  Some compilers use a different flag than `-I' to
-# specify an additional include path.  Examples are `/i=' or `-J'.
-#
-I := -I
-
-
-# C flag used to define a macro before the compilation of a given source
-# object.  Usually is `-D' like in `-DDEBUG'.
-#
-D := -D
-
-
-# The link flag used to specify a given library file on link.  Note that
-# this is only used to compile the demo programs, not the library itself.
-#
-L := -l
-
-
-# Target flag.
-#
-T := -o # Don't remove this comment line!  We need the space after `-o'.
-
-
-# C flags
-#
-#   These should concern: debug output, optimization & warnings.
-#
-#   Use the ANSIFLAGS variable to define the compiler flags used to enfore
-#   ANSI compliance.
-#
-CFLAGS := -c @XX_CFLAGS@ @CFLAGS@
-
-# ANSIFLAGS: Put there the flags used to make your compiler ANSI-compliant.
-#
-ANSIFLAGS := @XX_ANSIFLAGS@
-
-# C compiler to use -- we use libtool!
-#
-#
-CCraw := $(CC)
-CC    := $(LIBTOOL) --mode=compile $(CCraw)
-
-# Linker flags.
-#
-LDFLAGS := @LDFLAGS@
-
-
-ifdef BUILD_FREETYPE
-
-  # Now include the main sub-makefile.  It contains all the rules used to
-  # build the library with the previous variables defined.
-  #
-  include $(TOP)/builds/freetype.mk
-
-
-  # The cleanup targets.
-  #
-  clean_freetype: clean_freetype_unix
-  distclean_freetype: distclean_freetype_unix
-
-
-  # Unix installation and deinstallation targets.
-  install: $(FT_LIBRARY)
-	  $(MKINSTALLDIRS) $(libdir)                       \
-                           $(includedir)/freetype/config   \
-                           $(includedir)/freetype/internal
-	  $(LIBTOOL) --mode=install $(INSTALL) $(FT_LIBRARY) $(libdir)
-	  -for P in $(PUBLIC_H) ; do                     \
-            $(INSTALL_DATA) $$P $(includedir)/freetype ; \
-          done
-	  -for P in $(BASE_H) ; do                                \
-            $(INSTALL_DATA) $$P $(includedir)/freetype/internal ; \
-          done
-	  -for P in $(CONFIG_H) ; do                            \
-            $(INSTALL_DATA) $$P $(includedir)/freetype/config ; \
-          done
-
-  uninstall:
-	  -$(LIBTOOL) --mode=uninstall $(RM) $(libdir)/$(LIBRARY).$A
-	  -$(DELETE) $(includedir)/freetype/config/*
-	  -$(DELDIR) $(includedir)/freetype/config
-	  -$(DELETE) $(includedir)/freetype/internal/*
-	  -$(DELDIR) $(includedir)/freetype/internal
-	  -$(DELETE) $(includedir)/freetype/*
-	  -$(DELDIR) $(includedir)/freetype
-
-
-  # Unix cleaning and distclean rules.
-  #
-  clean_freetype_unix:
-	  -$(DELETE) $(BASE_OBJECTS) $(OBJ_M) $(OBJ_S)
-	  -$(DELETE) $(patsubst %.$O,%.$(SO),$(BASE_OBJECTS) $(OBJ_M) $(OBJ_S)) \
-                     $(CLEAN)
-
-  distclean_freetype_unix: clean_freetype_unix
-	  -$(DELETE) $(FT_LIBRARY)
-	  -$(DELETE) $(OBJ_DIR)/.libs/*
-	  -$(DELDIR) $(OBJ_DIR)/.libs
-	  -$(DELETE) *.orig *~ core *.core $(DISTCLEAN)
-
-
-  # Librarian to use to build the library
-  #
-  FT_LIBRARIAN := $(LIBTOOL) --mode=link $(CCraw)
-
-
-  # This final rule is used to link all object files into a single library.
-  # It is part of the system-specific sub-Makefile because not all
-  # librarians accept a simple syntax like
-  #
-  #   librarian library_file {list of object files}
-  #
-  $(FT_LIBRARY): $(OBJECTS_LIST)
-	  $(FT_LIBRARIAN) -o $@ $(OBJECTS_LIST) \
-                          -rpath $(libdir) -version-info $(version_info)
-
-endif
-
-# EOF
--- /dev/null
+++ b/builds/unix/unix.mk
@@ -1,0 +1,8 @@
+#
+#  Unix specific configuration definitions
+#
+include $(TOP)/builds/unix/unix-def.mk
+include $(TOP)/builds/unix/unix-cc.mk
+include $(TOP)/builds/unix/install.mk
+
+# EOF
--- /dev/null
+++ b/builds/unix/unixddef.mk
@@ -1,0 +1,45 @@
+#
+# FreeType 2 configuration rules templates for
+# developement under Unix with no configure (gcc only)
+#
+
+# Copyright 1996-2000 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.
+
+ifndef TOP
+  TOP := .
+endif
+TOP := $(shell cd $(TOP); pwd)
+
+DELETE        := rm -f
+SEP           := /
+HOSTSEP       := $(SEP)
+BUILD         := $(TOP)/builds/unix/devel # we use a special devel ftoption.h
+PLATFORM      := unixdev # do not set it to 'unix', or libtool will trick you
+
+# don't use `:=' here since the path stuff will be included after this file
+#
+FTSYS_SRC = @FTSYS_SRC@
+
+# The directory where all object files are placed.
+#
+OBJ_DIR := obj
+
+
+# The directory where all library files are placed.
+#
+# By default, this is the same as $(OBJ_DIR), however, this can be changed
+# to suit particular needs.
+#
+LIB_DIR := $(OBJ_DIR)
+
+#
+NO_OUTPUT := 2> /dev/nul
+
+# EOF
--- a/builds/win32/w32-dev.mk
+++ b/builds/win32/w32-dev.mk
@@ -22,121 +22,11 @@
   TOP := .
 endif
 
-DELETE   := del
-SEP      := /
-HOSTSEP  := $(strip \ )
-BUILD    := $(TOP)/builds/win32/devel # we use a special devel ftoption.h
-PLATFORM := win32
-CC       := gcc
+SEP := /
+include $(TOP)/builds/win32/win32-def.mk
+include $(TOP)/builds/compiler/gcc-dev.mk
 
-
-# The directory where all object files are placed.
-#
-# This lets you build the library in your own directory with something like
-#
-#   set TOP=.../path/to/freetype2/top/dir...
-#   set OBJ_DIR=.../path/to/obj/dir
-#   make -f %TOP%/Makefile setup [options]
-#   make -f %TOP%/Makefile
-#
-ifndef OBJ_DIR
-  OBJ_DIR := $(TOP)$(SEP)obj
-endif
-
-
-# The directory where all library files are placed.
-#
-# By default, this is the same as $(OBJ_DIR), however, this can be changed
-# to suit particular needs.
-#
-LIB_DIR := $(OBJ_DIR)
-
-
-# The object file extension (for standard and static libraries).  This can be
-# .o, .tco, .obj, etc., depending on the platform.
-#
-O  := o
-SO := o
-
-# The library file extension (for standard and static libraries).  This can
-# be .a, .lib, etc., depending on the platform.
-#
-A  := a
-SA := a
-
-
-# The name of the final library file.  Note that the DOS-specific Makefile
-# uses a shorter (8.3) name.
-#
-LIBRARY := libfreetype
-
-
-# Path inclusion flag.  Some compilers use a different flag than `-I' to
-# specify an additional include path.  Examples are `/i=' or `-J'.
-#
-I := -I
-
-
-# C flag used to define a macro before the compilation of a given source
-# object.  Usually is `-D' like in `-DDEBUG'.
-#
-D := -D
-
-
-# The link flag used to specify a given library file on link.  Note that
-# this is only used to compile the demo programs, not the library itself.
-#
-L := -l
-
-
-# Target flag.
-#
-T := -o # Don't remove this comment line!  We need the space after `-o'.
-
-
-# C flags
-#
-#   These should concern: debug output, optimization & warnings.
-#
-#   Use the ANSIFLAGS variable to define the compiler flags used to enfore
-#   ANSI compliance.
-#
-ifndef CFLAGS
-  CFLAGS := -c -g -O0 -Wall -W
-endif
-
-# ANSIFLAGS: Put there the flags used to make your compiler ANSI-compliant.
-#
-ANSIFLAGS := -ansi -pedantic
-
-
-ifdef BUILD_FREETYPE
-
-  # Now include the main sub-makefile.  It contains all the rules used to
-  # build the library with the previous variables defined.
-  #
-  include $(TOP)/builds/freetype.mk
-
-  # The cleanup targets.
-  #
-  clean_freetype: clean_freetype_dos
-  distclean_freetype: distclean_freetype_dos
-
-  # Librarian to use to build the static library
-  #
-  FT_LIBRARIAN := $(AR) -r
-
-
-  # This final rule is used to link all object files into a single library. 
-  # It is part of the system-specific sub-Makefile because not all
-  # librarians accept a simple syntax like
-  #
-  #   librarian library_file {list of object files} 
-  #
-  $(FT_LIBRARY): $(OBJECTS_LIST)
-	  -$(DELETE) $(subst $(SEP),$(HOSTSEP),$(FT_LIBRARY)) 2> nul
-	  $(FT_LIBRARIAN) $@ $(OBJECTS_LIST)
-
-endif
+# include linking instructions
+include $(TOP)/builds/link_dos.mk
 
 # EOF
--- a/builds/win32/w32-gcc.mk
+++ b/builds/win32/w32-gcc.mk
@@ -2,139 +2,17 @@
 # FreeType 2 Configuration rules for Win32 + GCC
 #
 
+# the separator must be set before including win32-def
+# as it defaults to "\" on Win32
+SEP := /
 
-# Copyright 1996-2000 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.
-#
-# NOTE: This version requires that GNU Make is invoked from the Windows
-#       Shell (_not_ Cygwin BASH)!
-#
+# include Win32-specific definitions
+include $(TOP)/builds/win32/win32-def.mk
 
-ifndef TOP
-  TOP := .
-endif
+# include gcc-specific definitions
+include $(TOP)/builds/compiler/gcc.mk
 
-DELETE   := del
-SEP      := /
-HOSTSEP  := $(strip \ )
-BUILD    := $(TOP)/builds/win32
-PLATFORM := win32
-CC       := gcc
-
-
-# The directory where all object files are placed.
-#
-# This lets you build the library in your own directory with something like
-#
-#   set TOP=.../path/to/freetype2/top/dir...
-#   set OBJ_DIR=.../path/to/obj/dir
-#   make -f %TOP%/Makefile setup [options]
-#   make -f %TOP%/Makefile
-#
-ifndef OBJ_DIR
-  OBJ_DIR := $(TOP)$(SEP)obj
-endif
-
-
-# The directory where all library files are placed.
-#
-# By default, this is the same as $(OBJ_DIR), however, this can be changed
-# to suit particular needs.
-#
-LIB_DIR := $(OBJ_DIR)
-
-
-# The object file extension (for standard and static libraries).  This can be
-# .o, .tco, .obj, etc., depending on the platform.
-#
-O  := o
-SO := o
-
-# The library file extension (for standard and static libraries).  This can
-# be .a, .lib, etc., depending on the platform.
-#
-A  := a
-SA := a
-
-
-# The name of the final library file.  Note that the DOS-specific Makefile
-# uses a shorter (8.3) name.
-#
-LIBRARY := libfreetype
-
-
-# Path inclusion flag.  Some compilers use a different flag than `-I' to
-# specify an additional include path.  Examples are `/i=' or `-J'.
-#
-I := -I
-
-
-# C flag used to define a macro before the compilation of a given source
-# object.  Usually is `-D' like in `-DDEBUG'.
-#
-D := -D
-
-
-# The link flag used to specify a given library file on link.  Note that
-# this is only used to compile the demo programs, not the library itself.
-#
-L := -l
-
-
-# Target flag.
-#
-T := -o # Don't remove this comment line!  We need the space after `-o'.
-
-
-# C flags
-#
-#   These should concern: debug output, optimization & warnings.
-#
-#   Use the ANSIFLAGS variable to define the compiler flags used to enfore
-#   ANSI compliance.
-#
-ifndef CFLAGS
-  CFLAGS := -c -g -O6 -Wall
-endif
-
-# ANSIFLAGS: Put there the flags used to make your compiler ANSI-compliant.
-#
-ANSIFLAGS := -ansi -pedantic
-
-
-ifdef BUILD_FREETYPE
-
-  # Now include the main sub-makefile.  It contains all the rules used to
-  # build the library with the previous variables defined.
-  #
-  include $(TOP)/builds/freetype.mk
-
-  # The cleanup targets.
-  #
-  clean_freetype: clean_freetype_dos
-  distclean_freetype: distclean_freetype_dos
-
-  # Librarian to use to build the static library
-  #
-  FT_LIBRARIAN := $(AR) -r
-
-
-  # This final rule is used to link all object files into a single library. 
-  # It is part of the system-specific sub-Makefile because not all
-  # librarians accept a simple syntax like
-  #
-  #   librarian library_file {list of object files} 
-  #
-  $(FT_LIBRARY): $(OBJECTS_LIST)
-	  -$(DELETE) $(subst $(SEP),$(HOSTSEP),$(FT_LIBRARY)) 2> nul
-	  $(FT_LIBRARIAN) $@ $(OBJECTS_LIST)
-
-endif
+# include linking instructions
+include $(TOP)/builds/link_dos.mk
 
 # EOF
--- a/builds/win32/w32-icc.mk
+++ b/builds/win32/w32-icc.mk
@@ -2,123 +2,10 @@
 # FreeType 2 Configuration rules for Win32 + IBM Visual Age C++
 #
 
+include $(TOP)/builds/win32/win32-def.mk
+include $(TOP)/builds/compiler/visualage.mk
 
-# Copyright 1996-2000 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.
-#
-
-DELETE   := del
-SEP      := $(strip \ )
-HOSTSEP  := $(strip \ )
-BUILD    := $(TOP)$(SEP)config$(SEP)win32
-PLATFORM := win32
-CC       := icc
-
-
-# The directory where all object files are placed.
-#
-# This lets you build the library in your own directory with something like
-#
-#   set TOP=.../path/to/freetype2/top/dir...
-#   set OBJ_DIR=.../path/to/obj/dir
-#   make -f %TOP%/Makefile setup [options]
-#   make -f %TOP%/Makefile
-#
-ifndef OBJ_DIR
-  OBJ_DIR := $(TOP)$(SEP)obj
-endif
-
-
-# The directory where all library files are placed.
-#
-# By default, this is the same as $(OBJ_DIR), however, this can be changed
-# to suit particular needs.
-#
-LIB_DIR := $(OBJ_DIR)
-
-
-# The object file extension (for standard and static libraries).  This can be
-# .o, .tco, .obj, etc., depending on the platform.
-#
-O  := obj
-SO := obj
-
-# The library file extension (for standard and static libraries).  This can
-# be .a, .lib, etc., depending on the platform.
-#
-A  := lib
-SA := lib
-
-
-# The name of the final library file.  Note that the DOS-specific Makefile
-# uses a shorter (8.3) name.
-#
-LIBRARY := freetype
-
-
-# Path inclusion flag.  Some compilers use a different flag than `-I' to
-# specify an additional include path.  Examples are `/i=' or `-J'.
-#
-I := /I
-
-
-# C flag used to define a macro before the compilation of a given source
-# object.  Usually is `-D' like in `-DDEBUG'.
-#
-D := /D
-
-
-# The link flag used to specify a given library file on link.  Note that
-# this is only used to compile the demo programs, not the library itself.
-#
-L := /Fl
-
-
-# Target flag.
-#
-T := /Fo
-
-
-# C flags
-#
-#   These should concern: debug output, optimization & warnings.
-#
-ifndef CFLAGS
-  CFLAGS := /Q- /Gd+ /O2 /G5 /W3 /C
-endif
-
-# ANSIFLAGS: Put there the flags used to make your compiler ANSI-compliant.
-#
-ANSI_FLAGS := /Sa
-
-
-ifdef BUILD_FREETYPE
-
-  # Now include the main sub-makefile.  It contains all the rules used to
-  # build the library with the previous variables defined.
-  #
-  include $(TOP)/builds/freetype.mk
-
-  # The cleanup targets.
-  #
-  clean_freetype: clean_freetype_dos
-  distclean_freetype: distclean_freetype_dos
-
-  # This final rule is used to link all object files into a single library. 
-  # It is part of the system-specific sub-Makefile because not all
-  # librarians accept a simple syntax like
-  #
-  #   librarian library_file {list of object files} 
-  #
-  $(FT_LIBRARY): $(OBJECTS_LIST)
-	  lib /nologo /out:$@ $(OBJECTS_LIST)
-
-endif
+# include linking instructions
+include $(TOP)/builds/link_dos.mk
 
 # EOF
--- a/builds/win32/w32-lcc.mk
+++ b/builds/win32/w32-lcc.mk
@@ -1,132 +1,14 @@
 #
-# FreeType 2 Configuration rules for Win32 + LCC
+# Configuration rules for Win32 + LCC
 #
 
 
-# Copyright 1996-2000 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.
+SEP := /
+include $(TOP)/builds/win32/win32-def.mk
+include $(TOP)/builds/compiler/win-lcc.mk
 
+# include linking instructions
+include $(TOP)/builds/link_dos.mk
 
-ifndef TOP
-  TOP := .
-endif
-
-DELETE   := del
-SEP      := /
-HOSTSEP  := $(strip \ )
-BUILD    := $(TOP)/builds/win32
-PLATFORM := win32
-CC       := lcc
-
-
-# The directory where all object files are placed.
-#
-# This lets you build the library in your own directory with something like
-#
-#   set TOP=.../path/to/freetype2/top/dir...
-#   set OBJ_DIR=.../path/to/obj/dir
-#   make -f %TOP%/Makefile setup [options]
-#   make -f %TOP%/Makefile
-#
-ifndef OBJ_DIR
-  OBJ_DIR := $(TOP)$(SEP)obj
-endif
-
-
-# The directory where all library files are placed.
-#
-# By default, this is the same as $(OBJ_DIR), however, this can be changed
-# to suit particular needs.
-#
-LIB_DIR := $(OBJ_DIR)
-
-
-# The object file extension (for standard and static libraries).  This can be
-# .o, .tco, .obj, etc., depending on the platform.
-#
-O  := obj
-SO := obj
-
-# The library file extension (for standard and static libraries).  This can
-# be .a, .lib, etc., depending on the platform.
-#
-A  := lib
-SA := lib
-
-
-# The name of the final library file.  Note that the DOS-specific Makefile
-# uses a shorter (8.3) name.
-#
-LIBRARY := freetype
-
-
-# Path inclusion flag.  Some compilers use a different flag than `-I' to
-# specify an additional include path.  Examples are `/i=' or `-J'.
-#
-I := -I
-
-
-# C flag used to define a macro before the compilation of a given source
-# object.  Usually is `-D' like in `-DDEBUG'.
-#
-D := -D
-
-
-# The link flag used to specify a given library file on link.  Note that
-# this is only used to compile the demo programs, not the library itself.
-#
-L := -Fl
-
-
-# Target flag.
-#
-T := -Fo
-
-
-# C flags
-#
-#   These should concern: debug output, optimization & warnings.
-#
-#   Use the ANSIFLAGS variable to define the compiler flags used to enfore
-#   ANSI compliance.
-#
-ifndef CFLAGS
-  CFLAGS := -c -g2 -O
-endif
-
-# ANSIFLAGS: Put there the flags used to make your compiler ANSI-compliant.
-#
-ANSIFLAGS :=
-
-
-ifdef BUILD_FREETYPE
-
-  # Now include the main sub-makefile.  It contains all the rules used to
-  # build the library with the previous variables defined.
-  #
-  include $(TOP)/builds/freetype.mk
-
-  # The cleanup targets.
-  #
-  clean_freetype: clean_freetype_dos
-  distclean_freetype: distclean_freetype_dos
-
-  # This final rule is used to link all object files into a single library. 
-  # It is part of the system-specific sub-Makefile because not all
-  # librarians accept a simple syntax like
-  #
-  #   librarian library_file {list of object files} 
-  #
-  $(FT_LIBRARY): $(OBJECTS_LIST)
-	  lcclib /out:$(subst $(SEP),\\,$@) \
-                 $(subst $(SEP),\\,$(OBJECTS_LIST))
-
-endif
-
 # EOF
+
--- a/builds/win32/w32-vcc.mk
+++ b/builds/win32/w32-vcc.mk
@@ -1,131 +1,12 @@
 #
-# FreeType 2 Configuration rules for Win32 + Visual C/C++
+#  Visual C++ on Win32
 #
 
+SEP := /
+include $(TOP)/builds/win32/win32-def.mk
+include $(TOP)/builds/compiler/visualc.mk
 
-# Copyright 1996-2000 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.
-
-
-ifndef TOP
-  TOP := .
-endif
-
-DELETE   := del
-SEP      := /
-HOSTSEP  := $(strip \ )
-BUILD    := $(TOP)/builds/win32
-PLATFORM := win32
-CC       := cl
-
-
-# The directory where all object files are placed.
-#
-# This lets you build the library in your own directory with something like
-#
-#   set TOP=.../path/to/freetype2/top/dir...
-#   set OBJ_DIR=.../path/to/obj/dir
-#   make -f %TOP%/Makefile setup [options]
-#   make -f %TOP%/Makefile
-#
-ifndef OBJ_DIR
-  OBJ_DIR := $(TOP)$(SEP)obj
-endif
-
-
-# The directory where all library files are placed.
-#
-# By default, this is the same as $(OBJ_DIR), however, this can be changed
-# to suit particular needs.
-#
-LIB_DIR := $(OBJ_DIR)
-
-
-# The object file extension (for standard and static libraries).  This can be
-# .o, .tco, .obj, etc., depending on the platform.
-#
-O  := obj
-SO := obj
-
-# The library file extension (for standard and static libraries).  This can
-# be .a, .lib, etc., depending on the platform.
-#
-A  := lib
-SA := lib
-
-
-# The name of the final library file.  Note that the DOS-specific Makefile
-# uses a shorter (8.3) name.
-#
-LIBRARY := freetype
-
-
-# Path inclusion flag.  Some compilers use a different flag than `-I' to
-# specify an additional include path.  Examples are `/i=' or `-J'.
-#
-I := /I
-
-
-# C flag used to define a macro before the compilation of a given source
-# object.  Usually is `-D' like in `-DDEBUG'.
-#
-D := /D
-
-
-# The link flag used to specify a given library file on link.  Note that
-# this is only used to compile the demo programs, not the library itself.
-#
-L := /Fl
-
-
-# Target flag.
-#
-T := /Fo
-
-
-# C flags
-#
-#   These should concern: debug output, optimization & warnings.
-#
-#   Use the ANSIFLAGS variable to define the compiler flags used to enfore
-#   ANSI compliance.
-#
-ifndef CFLAGS
-  CFLAGS := /nologo /c /Ox /G5 /W3 /WX
-endif
-
-# ANSIFLAGS: Put there the flags used to make your compiler ANSI-compliant.
-#
-ANSIFLAGS := /Za
-
-
-ifdef BUILD_FREETYPE
-
-  # Now include the main sub-makefile.  It contains all the rules used to
-  # build the library with the previous variables defined.
-  #
-  include $(TOP)/builds/freetype.mk
-
-  # The cleanup targets.
-  #
-  clean_freetype: clean_freetype_dos
-  distclean_freetype: distclean_freetype_dos
-
-  # This final rule is used to link all object files into a single library. 
-  # It is part of the system-specific sub-Makefile because not all
-  # librarians accept a simple syntax like
-  #
-  #   librarian library_file {list of object files} 
-  #
-  $(FT_LIBRARY): $(OBJECTS_LIST)
-	  lib /nologo /out:$@ $(OBJECTS_LIST)
-
-endif
+# include linking instructions
+include $(TOP)/builds/link_dos.mk
 
 # EOF
--- /dev/null
+++ b/builds/win32/win32-def.mk
@@ -1,0 +1,51 @@
+# Copyright 2000 David Turner <[email protected]>
+#
+# Win32 specific definitions
+#
+
+DELETE   := del
+HOSTSEP  := $(strip \ )
+BUILD    := $(TOP)$(SEP)config$(SEP)win32
+PLATFORM := win32
+
+# by default, we use "\" as a separator on Win32
+# but certain compilers accept "/" as well
+#
+ifndef SEP
+SEP      := $(HOSTSEP)
+endif
+
+
+# The directory where all object files are placed.
+#
+# This lets you build the library in your own directory with something like
+#
+#   set TOP=.../path/to/freetype2/top/dir...
+#   set OBJ_DIR=.../path/to/obj/dir
+#   make -f %TOP%/Makefile setup [options]
+#   make -f %TOP%/Makefile
+#
+ifndef OBJ_DIR
+  OBJ_DIR := $(TOP)$(SEP)obj
+endif
+
+
+# The directory where all library files are placed.
+#
+# By default, this is the same as $(OBJ_DIR), however, this can be changed
+# to suit particular needs.
+#
+LIB_DIR := $(OBJ_DIR)
+
+# The name of the final library file.  Note that the DOS-specific Makefile
+# uses a shorter (8.3) name.
+#
+LIBRARY := $(PROJECT)
+
+
+# the NO_OUTPUT macro is used to ignore the output of commands
+# 
+NO_OUTPUT = 2> nul
+
+
+
--- /dev/null
+++ b/include/freetype/cache/ftcimage.h
@@ -1,0 +1,133 @@
+/***************************************************************************/
+/*                                                                         */
+/*  ftcimage.h                                                             */
+/*                                                                         */
+/*    FreeType Image Cache (specification).                                */
+/*                                                                         */
+/*  Copyright 2000 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.                                        */
+/*                                                                         */
+/***************************************************************************/
+
+
+#ifndef FTCIMAGE_H
+#define FTCIMAGE_H
+
+#include <freetype/cache/ftcmanag.h>
+#include <freetype/ftglyph.h>
+#include <stddef.h>
+
+#ifdef __cplusplus
+  extern "C" {
+#endif
+
+#define FTC_MAX_IMAGE_QUEUES  16
+
+  typedef struct FTC_Image_QueueRec_*  FTC_Image_Queue;
+  typedef struct FTC_ImageNodeRec_*    FTC_ImageNode;
+  
+
+  /* macros used to pack a glyph index and a queue index in a single ptr */  
+#define FTC_PTR_TO_GINDEX( p )  ( (FT_UInt)( (FT_ULong)(p) >> 16 ) )
+#define FTC_PTR_TO_QINDEX( p )  ( (FT_UInt)( (FT_ULong)(p) & 0xFFFF ) ) 
+#define FTC_INDICES_TO_PTR( g, q )                      \
+          ( (FT_Pointer)( ( (FT_ULong)(g) << 16 )   |   \
+                          ( (FT_ULong)(q) & 0xFFFF) ) )
+    
+  typedef struct  FTC_ImageNodeRec_
+  {
+    /* root1.data contains an FT_Glyph handle          */
+    FT_ListNodeRec  root1;
+
+    /* root2.data contains a glyph index + queue index */
+    FT_ListNodeRec  root2;
+ 
+  } FTC_ImageNodeRec;
+
+
+  /* macros to read/set the glyph & queue index in a FTC_ImageNode */
+#define FTC_IMAGENODE_GET_GINDEX( n )  FTC_PTR_TO_GINDEX( (n)->root2.data )
+#define FTC_IMAGENODE_GET_QINDEX( n )  FTC_PTR_TO_QINDEX( (n)->root2.data )
+#define FTC_IMAGENODE_GET_GLYPH( n )   ( (FT_Glyph)(n)->root1.data )
+#define FTC_IMAGENODE_SET_GLYPH( n, g ) \
+          do                            \
+          {                             \
+            (n)->root1.data = g;        \
+          } while ( 0 )
+          
+#define FTC_IMAGENODE_SET_INDICES( n, g, q )              \
+          do                                              \
+          {                                               \
+            (n)->root2.data = FTC_INDICES_TO_PTR( g, q ); \
+          } while ( 0 )
+
+
+  /* this macro is used to extract a handle to the global LRU list node */
+  /* corresponding to a given image node                                */
+#define FTC_IMAGENODE_TO_LISTNODE( n ) \
+          ( (FT_ListNode)&(n)->root2 )
+
+  /* this macro is used to extract a handle to a given image node from */
+  /* the corresponding LRU glyph list node. That's a bit hackish..     */
+#define FTC_LISTNODE_TO_IMAGENODE( p )                              \
+          ( (FTC_ImageNode)( (char*)(p) -                           \
+                             offsetof( FTC_ImageNodeRec,root2 ) ) )
+
+
+  typedef struct  FTC_Image_CacheRec_
+  {
+    FTC_CacheRec     root;
+
+    FT_Lru           queues_lru;  /* static queues lru list          */
+    FT_ListRec       glyphs_lru;  /* global lru list of glyph images */
+    
+    FTC_Image_Queue  last_queue;  /* small cache */
+
+  } FTC_Image_CacheRec;
+
+
+  /* a table of functions used to generate/manager glyph images */
+  typedef struct  FTC_Image_Class_
+  {
+    FT_Error  (*init_image)( FTC_Image_Queue  queue,
+                             FTC_ImageNode    node );
+                                
+    void      (*done_image)( FTC_Image_Queue  queue,
+                             FTC_ImageNode    node );
+                                
+    FT_ULong  (*size_image)( FTC_Image_Queue  queue,
+                             FTC_ImageNode    node );
+
+  } FTC_Image_Class;
+
+
+  typedef struct  FTC_Image_QueueRec_
+  {
+    FTC_Image_Cache   cache;
+    FTC_Manager       manager;
+    FT_Memory         memory;
+    FTC_Image_Class*  clazz;
+    FTC_Image_Desc    descriptor;
+    FT_UInt           hash_size;
+    FT_List           buckets;
+    FT_UInt           index;     /* index in parent cache  */
+
+  } FTC_Image_QueueRec;
+
+
+
+#ifdef __cplusplus
+  }
+#endif
+
+
+#endif /* FTCIMAGE_H */
+
+
+/* END */
--- /dev/null
+++ b/include/freetype/cache/ftcmanag.h
@@ -1,0 +1,123 @@
+/***************************************************************************/
+/*                                                                         */
+/*  ftcmanag.h                                                             */
+/*                                                                         */
+/*    FreeType Cache Manager (specification).                              */
+/*                                                                         */
+/*  Copyright 2000 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.                                        */
+/*                                                                         */
+/***************************************************************************/
+
+
+#ifndef FTCMANAG_H
+#define FTCMANAG_H
+
+#include <freetype/ftcache.h>
+#include <freetype/cache/ftlru.h>
+
+
+#ifdef __cplusplus
+  extern "C" {
+#endif
+
+
+#define  FTC_MAX_FACES_DEFAULT   4
+#define  FTC_MAX_SIZES_DEFAULT   8
+#define  FTC_MAX_BYTES_DEFAULT   65536
+
+#define  FTC_MAX_CACHES  8
+
+  /* opaque pointer to a cache object */
+  typedef struct FTC_CacheRec_*  FTC_Cache;
+
+
+
+  /* a ftc node is used to 
+  typedef FT_ListNode   FTC_Node;
+
+  /* macros to read/set the glyph & queue index in a FTC_Node */
+#define FTC_IMAGENODE_GET_GINDEX( n )  FTC_PTR_TO_GINDEX( (n)->data )
+#define FTC_IMAGENODE_GET_QINDEX( n )  FTC_PTR_TO_QINDEX( (n)->data )
+          
+#define FTC_IMAGENODE_SET_INDICES( n, g, q )              \
+          do {                                            \
+            (n)->data = FTC_INDICES_TO_PTR( g, q ); \
+          } while ( 0 )
+
+
+
+
+  /* a function used to initialize a cache */
+  typedef FT_Error  (FTC_Cache_Init_Func) ( FTC_Cache  cache );
+  
+  /* a function used to finalize a cache */
+  typedef void      (FTC_Cache_Done_Func) ( FTC_Cache  cache );
+  
+  /* a function used to return the size in bytes of a given cache node */
+  typedef FT_ULong  (FTC_Cache_Size_Func) ( FTC_Cache  cache,
+                                            FT_Pointer object );
+                                            
+  /* a function used to purge a given cache node */
+  typedef void      (FTC_Cache_Purge_Func)( FTC_Cache  cache,
+                                            FT_Pointer object );
+
+
+  /* cache class */
+  typedef struct FTC_Cache_Class_
+  {
+    FT_UInt                cache_size;  /* size of cache object in bytes */
+    FTC_Cache_Init_Func    init;
+    FTC_Cache_Done_Func    done;
+    FTC_Cache_Size_Func    size;
+    FTC_Cache_Purge_Func   purge;
+  
+  } FTC_Cache_Class;
+
+
+  typedef struct FTC_CacheRec_
+  {
+    FTC_Manager       manager;   /* cache manager..                   */
+    FTC_Cache_Class*  clazz;     /* cache clazz                       */
+    FT_Memory         memory;    /* memory allocator                  */
+    FT_UInt           cache_id;
+    
+  } FTC_CacheRec;
+
+
+  typedef struct  FTC_ManagerRec_
+  {
+    FT_Library          library;
+    FT_Lru              faces_lru;
+    FT_Lru              sizes_lru;
+    
+    FT_Pointer          request_data;
+    FTC_Face_Requester  request_face;
+    
+    FT_ULong            num_bytes;  /* current number of bytes in the caches */
+    FT_ULong            max_bytes;  /* maximum number of bytes in the caches */
+    FT_ListRec          global_lru; /* the global LRU list of nodes          */
+    
+    FT_UInt             num_caches;
+    FT_UInt             last_id;
+    FTC_Cache           caches[ FTC_MAX_CACHES ];
+    
+  } FTC_ManagerRec;
+
+
+
+#ifdef __cplusplus
+  }
+#endif
+
+
+#endif /* FTCMANAG_H */
+
+
+/* END */
--- /dev/null
+++ b/include/freetype/cache/ftlru.h
@@ -1,0 +1,120 @@
+/***************************************************************************/
+/*                                                                         */
+/*  ftlru.h                                                                */
+/*                                                                         */
+/*    Simple LRU list-cache (specification).                               */
+/*                                                                         */
+/*  Copyright 2000 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.                                        */
+/*                                                                         */
+/***************************************************************************/
+
+
+#ifndef FTLRU_H
+#define FTLRU_H
+
+#include <freetype/freetype.h>
+
+
+#ifdef __cplusplus
+  extern "C" {
+#endif
+
+
+  typedef FT_Pointer  FT_LruKey;
+
+
+  typedef struct  FT_LruNodeRec_
+  {
+    FT_ListNodeRec  root;
+    FT_LruKey       key;
+  
+  } FT_LruNodeRec, *FT_LruNode;
+
+
+  typedef struct FT_LruRec_*  FT_Lru;
+
+
+  typedef struct  FT_Lru_Class_
+  {
+    FT_UInt   lru_size;      /* object size in bytes */
+    
+    FT_Error  (*init_element)( FT_Lru      lru,
+                               FT_LruNode  node );
+                                  
+    void      (*done_element)( FT_Lru      lru,
+                               FT_LruNode  node );
+    
+    FT_Error  (*flush_element)( FT_Lru      lru,
+                                FT_LruNode  node,
+                                FT_LruKey   new_key );  
+                                   
+    FT_Bool   (*compare_element)( FT_LruNode  node,
+                                  FT_LruKey   key );
+
+  } FT_Lru_Class;
+
+
+  typedef FT_Bool  (*FT_Lru_Selector)( FT_Lru      lru,
+                                       FT_LruNode  node,
+                                       FT_Pointer  data );
+
+
+  typedef struct  FT_LruRec_
+  {
+    FT_Lru_Class*   clazz;
+    FT_UInt         max_elements;
+    FT_UInt         num_elements;
+    FT_ListRec      elements;
+    FT_Memory       memory;
+    FT_Pointer      user_data;
+    
+    /* the following fields are only meaningful for static lru containers */
+    FT_ListRec      free_nodes;
+    FT_LruNode      nodes;
+    
+  } FT_LruRec;
+
+
+  FT_EXPORT_DEF( FT_Error )  FT_Lru_New( const FT_Lru_Class*  clazz,
+                                         FT_UInt              max_elements,
+                                         FT_Pointer           user_data,
+                                         FT_Memory            memory,
+                                         FT_Bool              pre_alloc,
+                                         FT_Lru*              alru );
+                                          
+  FT_EXPORT_DEF( void )  FT_Lru_Reset( FT_Lru  lru ); 
+                                       
+  FT_EXPORT_DEF( void )  FT_Lru_Done( FT_Lru  lru ); 
+
+  FT_EXPORT_DEF( FT_Error )  FT_Lru_Lookup_Node( FT_Lru        lru,
+                                                 FT_LruKey     key,
+                                                 FT_LruNode*  anode );
+
+  FT_EXPORT_DEF( FT_Error )  FT_Lru_Lookup( FT_Lru       lru,
+                                            FT_LruKey    key,
+                                            FT_Pointer*  aobject );
+ 
+  FT_EXPORT_DEF( void )  FT_Lru_Remove_Node( FT_Lru      lru,
+                                             FT_LruNode  node );  
+
+  FT_EXPORT_DEF( void )  FT_Lru_Remove_Selection( FT_Lru           lru,
+                                                  FT_Lru_Selector  selector,
+                                                  FT_Pointer       data );
+
+
+#ifdef __cplusplus
+  }
+#endif
+
+
+#endif /* FTLRU_H */
+
+
+/* END */
--- a/include/freetype/tttables.h
+++ b/include/freetype/tttables.h
@@ -572,6 +572,7 @@
   FT_EXPORT_DEF( void* )  FT_Get_Sfnt_Table( FT_Face      face,
                                              FT_Sfnt_Tag  tag );
 
+
 #ifdef __cplusplus
   }
 #endif