1 # 2 # FreeType 2 host platform detection rules 3 # 4 5 6 # Copyright 1996-2018 by 7 # David Turner, Robert Wilhelm, and Werner Lemberg. 8 # 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 13 # fully. 14 15 16 # This sub-Makefile is in charge of detecting the current platform. It sets 17 # the following variables: 18 # 19 # BUILD_DIR The configuration and system-specific directory. Usually 20 # `builds/$(PLATFORM)' but can be different for custom builds 21 # of the library. 22 # 23 # The following variables must be defined in system specific `detect.mk' 24 # files: 25 # 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. 35 # 36 # You need to set the following variable(s) before calling it: 37 # 38 # TOP_DIR The top-most directory in the FreeType library source 39 # hierarchy. If not defined, it will default to `.'. 40 41 # Set auto-detection default to `ansi' resp. UNIX-like operating systems. 42 # 43 PLATFORM := ansi 44 DELETE := $(RM) 45 COPY := cp 46 CAT := cat 47 SEP := / 48 49 BUILD_CONFIG := $(TOP_DIR)/builds 50 51 # These two assignments must be delayed. 52 BUILD_DIR = $(BUILD_CONFIG)/$(PLATFORM) 53 CONFIG_RULES = $(BUILD_DIR)/$(CONFIG_FILE) 54 55 # We define the BACKSLASH variable to hold a single back-slash character. 56 # This is needed because a line like 57 # 58 # SEP := \ 59 # 60 # does not work with GNU Make (the backslash is interpreted as a line 61 # continuation). While a line like 62 # 63 # SEP := \\ 64 # 65 # really defines $(SEP) as `\' on Unix, and `\\' on Dos and Windows! 66 # 67 BACKSLASH := $(strip \ ) 68 69 # Find all auto-detectable platforms. 70 # 71 PLATFORMS := $(notdir $(subst /detect.mk,,$(wildcard $(BUILD_CONFIG)/*/detect.mk))) 72 .PHONY: $(PLATFORMS) ansi 73 74 # Filter out platform specified as setup target. 75 # 76 PLATFORM := $(firstword $(filter $(MAKECMDGOALS),$(PLATFORMS))) 77 78 # If no setup target platform was specified, enable auto-detection/ 79 # default platform. 80 # 81 ifeq ($(PLATFORM),) 82 PLATFORM := ansi 83 endif 84 85 # If the user has explicitly asked for `ansi' on the command line, 86 # disable auto-detection. 87 # 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. 92 # 93 include $(wildcard $(BUILD_CONFIG)/*/detect.mk) 94 endif 95 96 # In case no detection rule file was successful, use the default. 97 # 98 ifndef CONFIG_FILE 99 CONFIG_FILE := ansi.mk 100 setup: std_setup 101 .PHONY: setup 102 endif 103 104 # Flash out and copy rules. 105 # 106 .PHONY: std_setup 107 108 std_setup: 109 $(info ) 110 $(info $(PROJECT_TITLE) build system -- automatic system detection) 111 $(info ) 112 $(info The following settings are used:) 113 $(info ) 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))) 118 $(info ) 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.) 121 $(info ) 122 $(info Otherwise, simply type `$(MAKE)' again to build the library,) 123 $(info or `$(MAKE) refdoc' to build the API reference (this needs python >= 2.6).) 124 $(info ) 125 @$(COPY) $(subst /,$(SEP),$(CONFIG_RULES) $(CONFIG_MK)) 126 127 128 # EOF 129