diff --git a/ChangeLog b/ChangeLog index 52d70866b..9b8e1e5d2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -9,6 +9,11 @@ * builds/unix/install.mk (install): Fix path for ftmodule.h. + * Makefile, *.mk: Use `?=' where appropriate. + + * builds/detect.mk (TOP_DIR), builds/os2/os2-dev.mk (TOP_DIR), + builds/win32/w32-dev.mk (TOP_DIR): Removed. Defined elsewhere. + 2006-01-31 Werner Lemberg Implement new, simplified module selection. With GNU make it is now diff --git a/Makefile b/Makefile index ab8dba596..c1fa16cee 100644 --- a/Makefile +++ b/Makefile @@ -15,22 +15,18 @@ # Project names # -PROJECT := freetype +PROJECT := freetype PROJECT_TITLE := FreeType # The variable TOP_DIR holds the path to the topmost directory in the project # engine source hierarchy. If it is not defined, default it to `.'. # -ifndef TOP_DIR - TOP_DIR := . -endif +TOP_DIR ?= . # The variable OBJ_DIR gives the location where object files and the # FreeType library are built. # -ifndef OBJ_DIR - OBJ_DIR := $(TOP_DIR)/objs -endif +OBJ_DIR ?= $(TOP_DIR)/objs include $(TOP_DIR)/builds/toplevel.mk diff --git a/builds/ansi/ansi-def.mk b/builds/ansi/ansi-def.mk index b45643990..6b8ecfab5 100644 --- a/builds/ansi/ansi-def.mk +++ b/builds/ansi/ansi-def.mk @@ -63,9 +63,7 @@ T := -o$(space) # Use the ANSIFLAGS variable to define the compiler flags used to enfore # ANSI compliance. # -ifndef CFLAGS - CFLAGS := -c -endif +CFLAGS ?= -c # ANSIFLAGS: Put there the flags used to make your compiler ANSI-compliant. # diff --git a/builds/beos/beos-def.mk b/builds/beos/beos-def.mk index c987410e3..7e79d0438 100644 --- a/builds/beos/beos-def.mk +++ b/builds/beos/beos-def.mk @@ -65,9 +65,7 @@ T := -o$(space) # Use the ANSIFLAGS variable to define the compiler flags used to enfore # ANSI compliance. # -ifndef CFLAGS - CFLAGS := -c -endif +CFLAGS ?= -c # ANSIFLAGS: Put there the flags used to make your compiler ANSI-compliant. # diff --git a/builds/compiler/ansi-cc.mk b/builds/compiler/ansi-cc.mk index c52c12fcc..3b668e201 100644 --- a/builds/compiler/ansi-cc.mk +++ b/builds/compiler/ansi-cc.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, @@ -62,9 +62,7 @@ T := -o$(space) # Use the ANSIFLAGS variable to define the compiler flags used to enfore # ANSI compliance. # -ifndef CFLAGS - CFLAGS := -c -endif +CFLAGS ?= -c # ANSIFLAGS: Put there the flags used to make your compiler ANSI-compliant. # @@ -75,10 +73,8 @@ ANSIFLAGS := # Library linking # -ifndef CLEAN_LIBRARY - CLEAN_LIBRARY = $(DELETE) $(subst /,$(SEP),$(PROJECT_LIBRARY)) -endif -LINK_LIBRARY = $(AR) -r $@ $(subst /,$(COMPILER_SEP),$(OBJECTS_LIST)) +CLEAN_LIBRARY ?= $(DELETE) $(subst /,$(SEP),$(PROJECT_LIBRARY)) +LINK_LIBRARY = $(AR) -r $@ $(subst /,$(COMPILER_SEP),$(OBJECTS_LIST)) # EOF diff --git a/builds/compiler/bcc-dev.mk b/builds/compiler/bcc-dev.mk index 446fd4e62..ba1a88a30 100644 --- a/builds/compiler/bcc-dev.mk +++ b/builds/compiler/bcc-dev.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, @@ -62,9 +62,7 @@ T := -o # Use the ANSIFLAGS variable to define the compiler flags used to enfore # ANSI compliance. # -ifndef CFLAGS - CFLAGS := -q -c -y -d -v -Od -w-par -w-ccc -w-rch -w-pro -w-aus -endif +CFLAGS ?= -q -c -y -d -v -Od -w-par -w-ccc -w-rch -w-pro -w-aus # ANSIFLAGS: Put there the flags used to make your compiler ANSI-compliant. # @@ -73,10 +71,8 @@ ANSIFLAGS := -A # Library linking # -ifndef CLEAN_LIBRARY - CLEAN_LIBRARY = $(DELETE) $(subst /,$(SEP),$(PROJECT_LIBRARY)) -endif -LINK_LIBRARY = tlib /u $(subst /,$(COMPILER_SEP),$@ $(OBJECTS_LIST:%=+%)) +CLEAN_LIBRARY ?= $(DELETE) $(subst /,$(SEP),$(PROJECT_LIBRARY)) +LINK_LIBRARY = tlib /u $(subst /,$(COMPILER_SEP),$@ $(OBJECTS_LIST:%=+%)) # EOF diff --git a/builds/compiler/bcc.mk b/builds/compiler/bcc.mk index eedfa10fb..509cb7248 100644 --- a/builds/compiler/bcc.mk +++ b/builds/compiler/bcc.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, @@ -62,9 +62,7 @@ T := -o # Use the ANSIFLAGS variable to define the compiler flags used to enfore # ANSI compliance. # -ifndef CFLAGS - CFLAGS := -c -q -y -d -v -Od -w-par -w-ccc -w-rch -w-pro -w-aus -endif +CFLAGS ?= -c -q -y -d -v -Od -w-par -w-ccc -w-rch -w-pro -w-aus # ANSIFLAGS: Put there the flags used to make your compiler ANSI-compliant. # @@ -73,10 +71,8 @@ ANSIFLAGS := -A # Library linking # -ifndef CLEAN_LIBRARY - CLEAN_LIBRARY = $(DELETE) $(subst /,$(SEP),$(PROJECT_LIBRARY)) -endif -LINK_LIBRARY = tlib /u $(subst /,$(COMPILER_SEP),$@ $(OBJECTS_LIST:%=+%)) +CLEAN_LIBRARY ?= $(DELETE) $(subst /,$(SEP),$(PROJECT_LIBRARY)) +LINK_LIBRARY = tlib /u $(subst /,$(COMPILER_SEP),$@ $(OBJECTS_LIST:%=+%)) # EOF diff --git a/builds/compiler/emx.mk b/builds/compiler/emx.mk index f2be13ca6..c237005cb 100644 --- a/builds/compiler/emx.mk +++ b/builds/compiler/emx.mk @@ -3,7 +3,7 @@ # -# Copyright 2003 by +# Copyright 2003, 2006 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -61,9 +61,7 @@ T := -o$(space) # Use the ANSIFLAGS variable to define the compiler flags used to enfore # ANSI compliance. # -ifndef CFLAGS - CFLAGS := -c -g -O6 -Wall -endif +CFLAGS ?= -c -g -O6 -Wall # ANSIFLAGS: Put there the flags used to make your compiler ANSI-compliant. # @@ -72,10 +70,8 @@ ANSIFLAGS := # Library linking # -ifndef CLEAN_LIBRARY - CLEAN_LIBRARY = $(DELETE) $(subst /,$(SEP),$(PROJECT_LIBRARY)) -endif -LINK_LIBRARY = $(foreach m,$(OBJECTS_LIST),$(AR) -r $@ $(m);) echo > nul +CLEAN_LIBRARY ?= $(DELETE) $(subst /,$(SEP),$(PROJECT_LIBRARY)) +LINK_LIBRARY = $(foreach m,$(OBJECTS_LIST),$(AR) -r $@ $(m);) echo > nul # EOF diff --git a/builds/compiler/gcc-dev.mk b/builds/compiler/gcc-dev.mk index c70f11734..7e96c3ef1 100644 --- a/builds/compiler/gcc-dev.mk +++ b/builds/compiler/gcc-dev.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2000, 2003, 2004, 2005 by +# Copyright 1996-2000, 2003, 2004, 2005, 2006 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -87,10 +87,8 @@ ANSIFLAGS := -ansi -pedantic # Library linking # -ifndef CLEAN_LIBRARY - CLEAN_LIBRARY = $(DELETE) $(subst /,$(SEP),$(PROJECT_LIBRARY)) -endif -LINK_LIBRARY = $(AR) -r $@ $(OBJECTS_LIST) +CLEAN_LIBRARY ?= $(DELETE) $(subst /,$(SEP),$(PROJECT_LIBRARY)) +LINK_LIBRARY = $(AR) -r $@ $(OBJECTS_LIST) # EOF diff --git a/builds/compiler/gcc.mk b/builds/compiler/gcc.mk index f4c5f96f4..e941443a0 100644 --- a/builds/compiler/gcc.mk +++ b/builds/compiler/gcc.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2000, 2003, 2005 by +# Copyright 1996-2000, 2003, 2005, 2006 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -61,9 +61,7 @@ T := -o$(space) # Use the ANSIFLAGS variable to define the compiler flags used to enfore # ANSI compliance. # -ifndef CFLAGS - CFLAGS := -c -g -O6 -Wall -endif +CFLAGS ?= -c -g -O6 -Wall # ANSIFLAGS: Put there the flags used to make your compiler ANSI-compliant. # @@ -72,10 +70,8 @@ ANSIFLAGS := -ansi -pedantic # Library linking # -ifndef CLEAN_LIBRARY - CLEAN_LIBRARY = $(DELETE) $(subst /,$(SEP),$(PROJECT_LIBRARY)) -endif -LINK_LIBRARY = $(AR) -r $@ $(OBJECTS_LIST) +CLEAN_LIBRARY ?= $(DELETE) $(subst /,$(SEP),$(PROJECT_LIBRARY)) +LINK_LIBRARY = $(AR) -r $@ $(OBJECTS_LIST) # EOF diff --git a/builds/compiler/intelc.mk b/builds/compiler/intelc.mk index 954dcf64c..24f2995bb 100644 --- a/builds/compiler/intelc.mk +++ b/builds/compiler/intelc.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, @@ -69,9 +69,7 @@ T := /Fo # _does_ compute an arithmetic value, so we disable this warning # with "/Qwd32". # -ifndef CFLAGS - CFLAGS := /nologo /c /Ox /G5 /W3 /Qwd32 -endif +CFLAGS ?= /nologo /c /Ox /G5 /W3 /Qwd32 # ANSIFLAGS: Put there the flags used to make your compiler ANSI-compliant. # diff --git a/builds/compiler/unix-lcc.mk b/builds/compiler/unix-lcc.mk index cf4ef5a00..d79f50846 100644 --- a/builds/compiler/unix-lcc.mk +++ b/builds/compiler/unix-lcc.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, @@ -63,9 +63,7 @@ T := -o$(space) # Use the ANSIFLAGS variable to define the compiler flags used to enfore # ANSI compliance. # -ifndef CFLAGS - CFLAGS := -c -g -endif +CFLAGS ?= -c -g # ANSIFLAGS: Put there the flags used to make your compiler ANSI-compliant. # @@ -78,10 +76,8 @@ ANSIFLAGS := -A # library linking # -ifndef CLEAN_LIBRARY - CLEAN_LIBRARY = $(DELETE) $(PROJECT_LIBRARY) -endif -LINK_LIBRARY = $(AR) -r $@ $(OBJECTS_LIST) +CLEAN_LIBRARY ?= $(DELETE) $(PROJECT_LIBRARY) +LINK_LIBRARY = $(AR) -r $@ $(OBJECTS_LIST) # EOF diff --git a/builds/compiler/visualage.mk b/builds/compiler/visualage.mk index 21ef12b27..c109659bf 100644 --- a/builds/compiler/visualage.mk +++ b/builds/compiler/visualage.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, @@ -60,9 +60,7 @@ T := /Fo # # These should concern: debug output, optimization & warnings. # -ifndef CFLAGS - CFLAGS := /Q- /Gd+ /O2 /G5 /W3 /C -endif +CFLAGS ?= /Q- /Gd+ /O2 /G5 /W3 /C # ANSIFLAGS: Put there the flags used to make your compiler ANSI-compliant. # diff --git a/builds/compiler/visualc.mk b/builds/compiler/visualc.mk index 594c8199f..49c446f56 100644 --- a/builds/compiler/visualc.mk +++ b/builds/compiler/visualc.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2000, 2003, 2005 by +# Copyright 1996-2000, 2003, 2005, 2006 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -66,9 +66,7 @@ TE := /Fe # Use the ANSIFLAGS variable to define the compiler flags used to enfore # ANSI compliance. # -ifndef CFLAGS - CFLAGS := /nologo /c /Ox /G5 /W3 /WX -endif +CFLAGS ?= /nologo /c /Ox /G5 /W3 /WX # ANSIFLAGS: Put there the flags used to make your compiler ANSI-compliant. # diff --git a/builds/compiler/watcom.mk b/builds/compiler/watcom.mk index 12394be4b..4db1e7fec 100644 --- a/builds/compiler/watcom.mk +++ b/builds/compiler/watcom.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, @@ -63,9 +63,7 @@ T := -FO= # Use the ANSIFLAGS variable to define the compiler flags used to enfore # ANSI compliance. # -ifndef CFLAGS - CFLAGS := -zq -endif +CFLAGS ?= -zq # ANSIFLAGS: Put there the flags used to make your compiler ANSI-compliant. # @@ -74,12 +72,10 @@ ANSIFLAGS := -za # Library linking # -ifndef CLEAN_LIBRARY - CLEAN_LIBRARY = $(DELETE) $(subst /,$(SEP),$(PROJECT_LIBRARY)) -endif -LINK_LIBRARY = $(subst /,$(COMPILER_SEP), \ - wlib -q -n $@; \ - $(foreach m, $(OBJECTS_LIST), wlib -q $@ +$(m);) \ - echo > nul) +CLEAN_LIBRARY ?= $(DELETE) $(subst /,$(SEP),$(PROJECT_LIBRARY)) +LINK_LIBRARY = $(subst /,$(COMPILER_SEP), \ + wlib -q -n $@; \ + $(foreach m, $(OBJECTS_LIST), wlib -q $@ +$(m);) \ + echo > nul) # EOF diff --git a/builds/compiler/win-lcc.mk b/builds/compiler/win-lcc.mk index c500d82cf..5d02d8246 100644 --- a/builds/compiler/win-lcc.mk +++ b/builds/compiler/win-lcc.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, @@ -63,9 +63,7 @@ T := -Fo # Use the ANSIFLAGS variable to define the compiler flags used to enfore # ANSI compliance. # -ifndef CFLAGS - CFLAGS := -c -g2 -O -endif +CFLAGS ?= -c -g2 -O # ANSIFLAGS: Put there the flags used to make your compiler ANSI-compliant. # diff --git a/builds/detect.mk b/builds/detect.mk index eeb1300bc..6d85f0cda 100644 --- a/builds/detect.mk +++ b/builds/detect.mk @@ -38,12 +38,6 @@ # TOP_DIR The top-most directory in the FreeType library source # hierarchy. If not defined, it will default to `.'. -# If TOP_DIR is not defined, default it to `.' -# -ifndef TOP_DIR - TOP_DIR := . -endif - # Set auto-detection default to `ansi' resp. UNIX-like operating systems. # PLATFORM := ansi diff --git a/builds/dos/detect.mk b/builds/dos/detect.mk index 43c48d0f3..cabc6d646 100644 --- a/builds/dos/detect.mk +++ b/builds/dos/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, @@ -73,9 +73,7 @@ ifeq ($(PLATFORM),dos) # Use DJGPP (i.e. gcc) by default. # CONFIG_FILE := dos-gcc.mk - ifndef CC - CC := gcc - endif + CC ?= gcc # additionally, we provide hooks for various other compilers # diff --git a/builds/freetype.mk b/builds/freetype.mk index 2f9b540cc..c60e9eff6 100644 --- a/builds/freetype.mk +++ b/builds/freetype.mk @@ -105,9 +105,7 @@ CACHE_DIR := $(PUBLIC_DIR)/cache # The documentation directory. # -ifndef DOC_DIR - DOC_DIR := $(TOP_DIR)/docs/reference -endif +DOC_DIR ?= $(TOP_DIR)/docs/reference # The final name of the library file. # @@ -192,9 +190,7 @@ FREETYPE_H := $(PUBLIC_H) $(BASE_H) $(CONFIG_H) $(CACHE_H) $(DEVEL_H) # ftsystem component # -ifndef FTSYS_SRC - FTSYS_SRC := $(BASE_DIR)/ftsystem.c -endif +FTSYS_SRC ?= $(BASE_DIR)/ftsystem.c FTSYS_OBJ := $(OBJ_DIR)/ftsystem.$O @@ -206,9 +202,7 @@ $(FTSYS_OBJ): $(FTSYS_SRC) $(FREETYPE_H) # ftdebug component # -ifndef FTDEBUG_SRC - FTDEBUG_SRC := $(BASE_DIR)/ftdebug.c -endif +FTDEBUG_SRC ?= $(BASE_DIR)/ftdebug.c FTDEBUG_OBJ := $(OBJ_DIR)/ftdebug.$O diff --git a/builds/os2/os2-dev.mk b/builds/os2/os2-dev.mk index bd1221522..83da8dea3 100644 --- a/builds/os2/os2-dev.mk +++ b/builds/os2/os2-dev.mk @@ -15,10 +15,6 @@ # fully. -ifndef TOP_DIR - TOP_DIR := . -endif - DEVEL_DIR := $(TOP_DIR)/devel # include OS/2-specific definitions diff --git a/builds/toplevel.mk b/builds/toplevel.mk index 4a6c9fc7d..aab0fd118 100644 --- a/builds/toplevel.mk +++ b/builds/toplevel.mk @@ -58,9 +58,7 @@ endif # FTMODULE_H, as its name suggests, indicates where the FreeType module # classes resides. # -ifndef FTMODULE_H - FTMODULE_H := $(OBJ_DIR)/ftmodule.h -endif +FTMODULE_H ?= $(OBJ_DIR)/ftmodule.h include $(MODULES_CFG) @@ -74,9 +72,7 @@ MODULES := $(FONT_MODULES) \ $(AUX_MODULES) -ifndef CONFIG_MK - CONFIG_MK := config.mk -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 diff --git a/builds/win32/w32-dev.mk b/builds/win32/w32-dev.mk index bf3fe3ac3..00cacb0f6 100644 --- a/builds/win32/w32-dev.mk +++ b/builds/win32/w32-dev.mk @@ -19,10 +19,6 @@ # Shell (_not_ Cygwin BASH)! # -ifndef TOP_DIR - TOP_DIR := . -endif - DEVEL_DIR := $(TOP_DIR)/devel include $(TOP_DIR)/builds/win32/win32-def.mk