michael@0: # michael@0: # FreeType 2 host platform detection rules michael@0: # michael@0: michael@0: michael@0: # Copyright 1996-2003, 2006, 2008, 2013 by michael@0: # David Turner, Robert Wilhelm, and Werner Lemberg. michael@0: # michael@0: # This file is part of the FreeType project, and may only be used, modified, michael@0: # and distributed under the terms of the FreeType project license, michael@0: # LICENSE.TXT. By continuing to use, modify, or distribute this file you michael@0: # indicate that you have read the license and understand and accept it michael@0: # fully. michael@0: michael@0: michael@0: # This sub-Makefile is in charge of detecting the current platform. It sets michael@0: # the following variables: michael@0: # michael@0: # BUILD_DIR The configuration and system-specific directory. Usually michael@0: # `builds/$(PLATFORM)' but can be different for custom builds michael@0: # of the library. michael@0: # michael@0: # The following variables must be defined in system specific `detect.mk' michael@0: # files: michael@0: # michael@0: # PLATFORM The detected platform. This will default to `ansi' if michael@0: # auto-detection fails. michael@0: # CONFIG_FILE The configuration sub-makefile to use. This usually depends michael@0: # on the compiler defined in the `CC' environment variable. michael@0: # DELETE The shell command used to remove a given file. michael@0: # COPY The shell command used to copy one file. michael@0: # SEP The platform-specific directory separator. michael@0: # COMPILER_SEP The separator used in arguments of the compilation tools. michael@0: # CC The compiler to use. michael@0: # michael@0: # You need to set the following variable(s) before calling it: michael@0: # michael@0: # TOP_DIR The top-most directory in the FreeType library source michael@0: # hierarchy. If not defined, it will default to `.'. michael@0: michael@0: # Set auto-detection default to `ansi' resp. UNIX-like operating systems. michael@0: # michael@0: PLATFORM := ansi michael@0: DELETE := $(RM) michael@0: COPY := cp michael@0: CAT := cat michael@0: SEP := / michael@0: michael@0: BUILD_CONFIG := $(TOP_DIR)/builds michael@0: michael@0: # These two assignments must be delayed. michael@0: BUILD_DIR = $(BUILD_CONFIG)/$(PLATFORM) michael@0: CONFIG_RULES = $(BUILD_DIR)/$(CONFIG_FILE) michael@0: michael@0: # We define the BACKSLASH variable to hold a single back-slash character. michael@0: # This is needed because a line like michael@0: # michael@0: # SEP := \ michael@0: # michael@0: # does not work with GNU Make (the backslash is interpreted as a line michael@0: # continuation). While a line like michael@0: # michael@0: # SEP := \\ michael@0: # michael@0: # really defines $(SEP) as `\' on Unix, and `\\' on Dos and Windows! michael@0: # michael@0: BACKSLASH := $(strip \ ) michael@0: michael@0: # Find all auto-detectable platforms. michael@0: # michael@0: PLATFORMS := $(notdir $(subst /detect.mk,,$(wildcard $(BUILD_CONFIG)/*/detect.mk))) michael@0: .PHONY: $(PLATFORMS) ansi michael@0: michael@0: # Filter out platform specified as setup target. michael@0: # michael@0: PLATFORM := $(firstword $(filter $(MAKECMDGOALS),$(PLATFORMS))) michael@0: michael@0: # If no setup target platform was specified, enable auto-detection/ michael@0: # default platform. michael@0: # michael@0: ifeq ($(PLATFORM),) michael@0: PLATFORM := ansi michael@0: endif michael@0: michael@0: # If the user has explicitly asked for `ansi' on the command line, michael@0: # disable auto-detection. michael@0: # michael@0: ifeq ($(findstring ansi,$(MAKECMDGOALS)),) michael@0: # Now, include all detection rule files found in the `builds/' michael@0: # directories. Note that the calling order of the various `detect.mk' michael@0: # files isn't predictable. michael@0: # michael@0: include $(wildcard $(BUILD_CONFIG)/*/detect.mk) michael@0: endif michael@0: michael@0: # In case no detection rule file was successful, use the default. michael@0: # michael@0: ifndef CONFIG_FILE michael@0: CONFIG_FILE := ansi.mk michael@0: setup: std_setup michael@0: .PHONY: setup michael@0: endif michael@0: michael@0: # The following targets are equivalent, with the exception that they use michael@0: # a slightly different syntax for the `echo' command. michael@0: # michael@0: # std_setup: defined for most (i.e. Unix-like) platforms michael@0: # dos_setup: defined for Dos-ish platforms like Dos, Windows & OS/2 michael@0: # michael@0: .PHONY: std_setup dos_setup michael@0: michael@0: std_setup: michael@0: @echo "" michael@0: @echo "$(PROJECT_TITLE) build system -- automatic system detection" michael@0: @echo "" michael@0: @echo "The following settings are used:" michael@0: @echo "" michael@0: @echo " platform $(PLATFORM)" michael@0: @echo " compiler $(CC)" michael@0: @echo " configuration directory $(BUILD_DIR)" michael@0: @echo " configuration rules $(CONFIG_RULES)" michael@0: @echo "" michael@0: @echo "If this does not correspond to your system or settings please remove the file" michael@0: @echo "\`$(CONFIG_MK)' from this directory then read the INSTALL file for help." michael@0: @echo "" michael@0: @echo "Otherwise, simply type \`$(MAKE)' again to build the library," michael@0: @echo "or \`$(MAKE) refdoc' to build the API reference (the latter needs python)." michael@0: @echo "" michael@0: @$(COPY) $(CONFIG_RULES) $(CONFIG_MK) michael@0: michael@0: michael@0: # Special case for Dos, Windows, OS/2, where echo "" doesn't work correctly! michael@0: # michael@0: dos_setup: michael@0: @type builds$(SEP)newline michael@0: @echo $(PROJECT_TITLE) build system -- automatic system detection michael@0: @type builds$(SEP)newline michael@0: @echo The following settings are used: michael@0: @type builds$(SEP)newline michael@0: @echo platform˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙$(PLATFORM) michael@0: @echo compiler˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙$(CC) michael@0: @echo configuration directory˙˙˙˙˙˙$(subst /,$(SEP),$(BUILD_DIR)) michael@0: @echo configuration rules˙˙˙˙˙˙˙˙˙˙$(subst /,$(SEP),$(CONFIG_RULES)) michael@0: @type builds$(SEP)newline michael@0: @echo If this does not correspond to your system or settings please remove the file michael@0: @echo '$(CONFIG_MK)' from this directory then read the INSTALL file for help. michael@0: @type builds$(SEP)newline michael@0: @echo Otherwise, simply type 'make' again to build the library. michael@0: @echo or 'make refdoc' to build the API reference (the latter needs python). michael@0: @type builds$(SEP)newline michael@0: @$(COPY) $(subst /,$(SEP),$(CONFIG_RULES) $(CONFIG_MK)) > nul michael@0: michael@0: michael@0: # EOF