2 # FreeType 2 host platform detection rules
6 # Copyright (C) 1996-2020 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_DIR The configuration and system-specific directory. Usually
20 # `builds/$(PLATFORM)' but can be different for custom builds
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 # COMPILER_SEP The separator used in arguments of the compilation tools.
34 # CC The compiler to use.
36 # You need to set the following variable(s) before calling it:
38 # TOP_DIR The top-most directory in the FreeType library source
39 # hierarchy. If not defined, it will default to `.'.
41 # Set auto-detection default to `ansi' resp. UNIX-like operating systems.
49 BUILD_CONFIG := $(TOP_DIR)/builds
51 # These two assignments must be delayed.
52 BUILD_DIR = $(BUILD_CONFIG)/$(PLATFORM)
53 CONFIG_RULES = $(BUILD_DIR)/$(CONFIG_FILE)
55 # We define the BACKSLASH variable to hold a single back-slash character.
56 # This is needed because a line like
60 # does not work with GNU Make (the backslash is interpreted as a line
61 # continuation). While a line like
65 # really defines $(SEP) as `\' on Unix, and `\\' on Dos and Windows!
67 BACKSLASH := $(strip \ )
69 # Find all auto-detectable platforms.
71 PLATFORMS := $(notdir $(subst /detect.mk,,$(wildcard $(BUILD_CONFIG)/*/detect.mk)))
72 .PHONY: $(PLATFORMS) ansi
74 # Filter out platform specified as setup target.
76 PLATFORM := $(firstword $(filter $(MAKECMDGOALS),$(PLATFORMS)))
78 # If no setup target platform was specified, enable auto-detection/
85 # If the user has explicitly asked for `ansi' on the command line,
86 # disable auto-detection.
88 ifeq ($(findstring ansi,$(MAKECMDGOALS)),)
89 # Now, include all detection rule files found in the `builds/<system>'
90 # directories. Note that the calling order of the various `detect.mk'
91 # files isn't predictable.
93 include $(wildcard $(BUILD_CONFIG)/*/detect.mk)
96 # In case no detection rule file was successful, use the default.
99 CONFIG_FILE := ansi.mk
104 # Flash out and copy rules.
110 $(info $(PROJECT_TITLE) build system -- automatic system detection)
112 $(info The following settings are used:)
114 $(info $(empty) platform $(PLATFORM))
115 $(info $(empty) compiler $(CC))
116 $(info $(empty) configuration directory $(subst /,$(SEP),$(BUILD_DIR)))
117 $(info $(empty) configuration rules $(subst /,$(SEP),$(CONFIG_RULES)))
119 $(info If this does not correspond to your system or settings please remove the file)
120 $(info `$(CONFIG_MK)' from this directory then read the INSTALL file for help.)
122 $(info Otherwise, simply type `$(MAKE)' again to build the library,)
123 $(info or `$(MAKE) refdoc' to build the API reference (this needs Python >= 3.5).)
125 @$(COPY) $(subst /,$(SEP),$(CONFIG_RULES) $(CONFIG_MK))