Commit b26b314a9357ddb4a4819c36a59313d076396cea

Werner Lemberg 2006-12-09T20:01:43

* builds/*/*def.mk, builds/*/detect.mk (CAT): Define to either `cat' or `type'. * builds/freetype.mk (version): Extracted from freetype.h, using GNU make's built-in string functions. (refdoc): Use $(version) instead of static version number.

diff --git a/ChangeLog b/ChangeLog
index bc589d9..dd84b19 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2006-12-09  Werner Lemberg  <wl@gnu.org>
+
+	* builds/*/*def.mk, builds/*/detect.mk (CAT): Define to either `cat'
+	or `type'.
+
+	* builds/freetype.mk (version): Extracted from freetype.h, using
+	GNU make's built-in string functions.
+	(refdoc): Use $(version) instead of static version number.
+
 2006-12-08  Werner Lemberg  <wl@gnu.org>
 
 	* builds/toplevel.mk (dist): Extract version number from freetype.h.
diff --git a/builds/ansi/ansi-def.mk b/builds/ansi/ansi-def.mk
index 6b8ecfa..2c58572 100644
--- a/builds/ansi/ansi-def.mk
+++ b/builds/ansi/ansi-def.mk
@@ -14,6 +14,7 @@
 
 
 DELETE    := rm -f
+CAT       := cat
 SEP       := /
 BUILD_DIR := $(TOP_DIR)/builds/ansi
 PLATFORM  := ansi
diff --git a/builds/beos/beos-def.mk b/builds/beos/beos-def.mk
index 7e79d04..4371a30 100644
--- a/builds/beos/beos-def.mk
+++ b/builds/beos/beos-def.mk
@@ -16,6 +16,7 @@
 
 
 DELETE    := rm -f
+CAT       := cat
 SEP       := /
 BUILD_DIR := $(TOP_DIR)/builds/beos
 PLATFORM  := beos
diff --git a/builds/beos/detect.mk b/builds/beos/detect.mk
index 8333aba..24a0878 100644
--- a/builds/beos/detect.mk
+++ b/builds/beos/detect.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright 1996-2000, 2003 by
+# Copyright 1996-2000, 2003, 2006 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
@@ -28,6 +28,7 @@ endif
 ifeq ($(PLATFORM),beos)
 
   DELETE      := rm -f
+  CAT         := cat
   SEP         := /
   BUILD_DIR   := $(TOP_DIR)/builds/beos
   CONFIG_FILE := beos.mk
diff --git a/builds/detect.mk b/builds/detect.mk
index 6d85f0c..c3632c0 100644
--- a/builds/detect.mk
+++ b/builds/detect.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright 1996-2000, 2001, 2002, 2003 by
+# Copyright 1996-2000, 2001, 2002, 2003, 2006 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
@@ -43,6 +43,7 @@
 PLATFORM     := ansi
 DELETE       := $(RM)
 COPY         := cp
+CAT          := cat
 SEP          := /
 
 BUILD_CONFIG := $(TOP_DIR)/builds
diff --git a/builds/dos/detect.mk b/builds/dos/detect.mk
index cabc6d6..700a122 100644
--- a/builds/dos/detect.mk
+++ b/builds/dos/detect.mk
@@ -116,10 +116,12 @@ ifeq ($(PLATFORM),dos)
     SEP    := /
     DELETE := rm
     COPY   := cp
+    CAT    := cat
     setup: std_setup
   else
     SEP    := $(BACKSLASH)
     DELETE := del
+    CAT    := type
 
     # Setting COPY is a bit trickier.  We can be running DJGPP on some
     # Windows NT derivatives, like XP.  See builds/win32/detect.mk for
diff --git a/builds/dos/dos-def.mk b/builds/dos/dos-def.mk
index c68bd74..950f581 100644
--- a/builds/dos/dos-def.mk
+++ b/builds/dos/dos-def.mk
@@ -14,6 +14,7 @@
 
 
 DELETE    := del
+CAT       := type
 SEP       := $(strip \ )
 BUILD_DIR := $(TOP_DIR)/builds/dos
 PLATFORM  := dos
diff --git a/builds/freetype.mk b/builds/freetype.mk
index 2afd8c8..9d9c233 100644
--- a/builds/freetype.mk
+++ b/builds/freetype.mk
@@ -267,6 +267,29 @@ dll: $(PROJECT_LIBRARY) exported_symbols
 	$(FT_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<)
 
 
+ifneq ($(findstring refdoc,$(MAKECMDGOALS)),)
+  # poor man's `sed' emulation with make's built-in string functions
+  work := $(strip $(shell $(CAT) $(PUBLIC_DIR)/freetype.h))
+  work := $(subst |,x,$(work))
+  work := $(subst $(space),|,$(work))
+  work := $(subst \#define|FREETYPE_MAJOR|,$(space),$(work))
+  work := $(word 2,$(work))
+  major := $(subst |,$(space),$(work))
+  major := $(firstword $(major))
+
+  work := $(subst \#define|FREETYPE_MINOR|,$(space),$(work))
+  work := $(word 2,$(work))
+  minor := $(subst |,$(space),$(work))
+  minor := $(firstword $(minor))
+
+  work := $(subst \#define|FREETYPE_PATCH|,$(space),$(work))
+  work := $(word 2,$(work))
+  patch := $(subst |,$(space),$(work))
+  patch := $(firstword $(patch))
+
+  version := $(major).$(minor).$(patch)
+endif
+
 # We write-protect the docmaker directory to suppress generation
 # of .pyc files.
 #
@@ -274,7 +297,7 @@ refdoc:
 	-chmod -w $(SRC_DIR)/tools/docmaker
 	python $(SRC_DIR)/tools/docmaker/docmaker.py \
                --prefix=ft2                          \
-               --title=FreeType-2.2.1                \
+               --title=FreeType-$(version)           \
                --output=$(DOC_DIR)                   \
                $(PUBLIC_DIR)/*.h                     \
                $(PUBLIC_DIR)/config/*.h              \
diff --git a/builds/os2/detect.mk b/builds/os2/detect.mk
index 97e4bc9..47a40a2 100644
--- a/builds/os2/detect.mk
+++ b/builds/os2/detect.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright 1996-2000, 2003 by
+# Copyright 1996-2000, 2003, 2006 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
@@ -29,6 +29,7 @@ ifeq ($(PLATFORM),os2)
 
   COPY   := copy
   DELETE := del
+  CAT    := type
   SEP    := $(BACKSLASH)
 
   # gcc-emx by default
diff --git a/builds/os2/os2-def.mk b/builds/os2/os2-def.mk
index 6ca739e..01cda92 100644
--- a/builds/os2/os2-def.mk
+++ b/builds/os2/os2-def.mk
@@ -14,6 +14,7 @@
 
 
 DELETE    := del
+CAT       := type
 SEP       := $(strip \ )
 BUILD_DIR := $(TOP_DIR)/builds/os2
 PLATFORM  := os2
diff --git a/builds/unix/detect.mk b/builds/unix/detect.mk
index aafe352..c4130f9 100644
--- a/builds/unix/detect.mk
+++ b/builds/unix/detect.mk
@@ -31,6 +31,7 @@ endif # test PLATFORM ansi
 ifeq ($(PLATFORM),unix)
   COPY   := cp
   DELETE := rm -f
+  CAT    := cat
 
   # If `devel' is the requested target, we use a special configuration
   # file named `unix-dev.mk'.  It disables optimization and libtool.
diff --git a/builds/unix/unix-def.in b/builds/unix/unix-def.in
index 1241db6..b90ed0c 100644
--- a/builds/unix/unix-def.in
+++ b/builds/unix/unix-def.in
@@ -17,6 +17,7 @@ TOP_DIR := $(shell cd $(TOP_DIR); pwd)
 
 DELETE    := @RMF@
 DELDIR    := @RMDIR@
+CAT       := cat
 SEP       := /
 
 # this is used for `make distclean' and `make install'
diff --git a/builds/unix/unixddef.mk b/builds/unix/unixddef.mk
index 991642e..130d6b0 100644
--- a/builds/unix/unixddef.mk
+++ b/builds/unix/unixddef.mk
@@ -20,6 +20,7 @@ OBJ_DIR := $(shell cd $(OBJ_DIR); pwd)
 PLATFORM := unix
 
 DELETE := rm -f
+CAT    := cat
 SEP    := /
 
 # we use a special devel ftoption.h
diff --git a/builds/win32/detect.mk b/builds/win32/detect.mk
index 97e7b52..71ab826 100644
--- a/builds/win32/detect.mk
+++ b/builds/win32/detect.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright 1996-2000, 2003, 2004 by
+# Copyright 1996-2000, 2003, 2004, 2006 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
@@ -65,6 +65,7 @@ endif # test PLATFORM ansi
 ifeq ($(PLATFORM),win32)
 
   DELETE := del
+  CAT    := type
   SEP    := $(BACKSLASH)
 
   # Setting COPY is a bit trickier.  Plain COPY on NT will not work
diff --git a/builds/win32/win32-def.mk b/builds/win32/win32-def.mk
index 87dc12a..a82b146 100644
--- a/builds/win32/win32-def.mk
+++ b/builds/win32/win32-def.mk
@@ -14,6 +14,7 @@
 
 
 DELETE    := del
+CAT       := type
 SEP       := $(strip \ )
 BUILD_DIR := $(TOP_DIR)/builds/win32
 PLATFORM  := win32