2 # FreeType 2 host platform detection rules
6 # Copyright 1996-2000 by
7 # David Turner, Robert Wilhelm, and Werner Lemberg.
9 # This file is part of the FreeType project, and may only be used, modified,
10 # and distributed under the terms of the FreeType project license,
11 # LICENSE.TXT. By continuing to use, modify, or distribute this file you
12 # indicate that you have read the license and understand and accept it
16 # This sub-Makefile is in charge of detecting the current platform. It sets
17 # the following variables:
19 # BUILD The configuration and system-specific directory. Usually
20 # `freetype/builds/$(PLATFORM)' but can be different for
21 # custom builds of the library.
23 # The following variables must be defined in system specific `detect.mk'
26 # PLATFORM The detected platform. This will default to `ansi' if
27 # auto-detection fails.
28 # CONFIG_FILE The configuration sub-makefile to use. This usually depends
29 # on the compiler defined in the `CC' environment variable.
30 # DELETE The shell command used to remove a given file.
31 # COPY The shell command used to copy one file.
32 # SEP The platform-specific directory separator.
33 # CC The compiler to use.
35 # You need to set the following variable(s) before calling it:
37 # TOP_DIR The top-most directory in the FreeType library source
38 # hierarchy. If not defined, it will default to `.'.
40 # If TOP_DIR is not defined, default it to `.'
46 # Set auto-detection default to `ansi' resp. UNIX-like operating systems.
47 # Note that we delay evaluation of $(BUILD_CONFIG_), $(BUILD), and
55 BUILD_CONFIG_ = $(TOP_DIR)$(SEP)builds$(SEP)
56 BUILD = $(BUILD_CONFIG_)$(PLATFORM)
57 CONFIG_RULES = $(BUILD)$(SEP)$(CONFIG_FILE)
59 # We define the BACKSLASH variable to hold a single back-slash character.
60 # This is needed because a line like
64 # does not work with GNU Make (the backslash is interpreted as a line
65 # continuation). While a line like
69 # really defines $(SEP) as `\' on Unix, and `\\' on Dos and Windows!
71 BACKSLASH := $(strip \ )
73 # Find all auto-detectable platforms.
75 PLATFORMS_ := $(notdir $(subst /detect.mk,,$(wildcard $(BUILD_CONFIG_)*/detect.mk)))
76 .PHONY: $(PLATFORMS_) ansi
78 # Filter out platform specified as setup target.
80 PLATFORM := $(firstword $(filter $(MAKECMDGOALS),$(PLATFORMS_)))
82 # If no setup target platform was specified, enable auto-detection/
89 # If the user has explicitly asked for `ansi' on the command line,
90 # disable auto-detection.
92 ifeq ($(findstring ansi,$(MAKECMDGOALS)),)
93 # Now, include all detection rule files found in the `builds/<system>'
94 # directories. Note that the calling order of the various `detect.mk'
95 # files isn't predictable.
97 include $(wildcard $(BUILD_CONFIG_)*/detect.mk)
100 # In case no detection rule file was successful, use the default.
103 CONFIG_FILE := ansi.mk
108 # The following targets are equivalent, with the exception that they use
109 # a slightly different syntax for the `echo' command.
111 # std_setup: defined for most (i.e. Unix-like) platforms
112 # dos_setup: defined for Dos-ish platforms like Dos, Windows & OS/2
114 .PHONY: std_setup dos_setup
118 @echo "$(PROJECT_TITLE) build system -- automatic system detection"
120 @echo "The following settings are used:"
122 @echo " platform $(PLATFORM)"
123 @echo " compiler $(CC)"
124 @echo " configuration directory $(BUILD)"
125 @echo " configuration rules $(CONFIG_RULES)"
127 @echo "If this does not correspond to your system or settings please remove the file"
128 @echo "\`$(CONFIG_MK)' from this directory then read the INSTALL file for help."
130 @echo "Otherwise, simply type \`$(MAKE)' again to build the library."
132 @$(COPY) $(CONFIG_RULES) $(CONFIG_MK)
135 # Special case for Dos, Windows, OS/2, where echo "" doesn't work correctly!
139 @echo $(PROJECT_TITLE) build system -- automatic system detection
141 @echo The following settings are used: