blob: fbdbee5ad62fb6f932f95b6128b1877e9cdcf9ca [file] [log] [blame]
David Turner74043012000-07-08 00:22:20 +00001#
2# FreeType 2 host platform detection rules
3#
4
5
6# Copyright 1996-2000 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 The configuration and system-specific directory. Usually
David Turnera90663f2000-07-08 00:41:13 +000020# `freetype/builds/$(PLATFORM)' but can be different for
David Turner74043012000-07-08 00:22:20 +000021# custom builds 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# CC The compiler to use.
34#
35# You need to set the following variable(s) before calling it:
36#
37# TOP The top-most directory in the FreeType library source
38# hierarchy. If not defined, it will default to `.'.
39
40# If TOP is not defined, default it to `.'
41#
42ifndef TOP
43 TOP := .
44endif
45
46# Set auto-detection default to `ansi' resp. UNIX-like operating systems.
Werner Lembergbd547dc2000-09-22 21:23:29 +000047# Note that we delay evaluation of $(BUILD_CONFIG_), $(BUILD), and
David Turner74043012000-07-08 00:22:20 +000048# $(CONFIG_RULES).
49#
50PLATFORM := ansi
51DELETE := $(RM)
52COPY := cp
53SEP := /
54
David Turnera90663f2000-07-08 00:41:13 +000055BUILD_CONFIG_ = $(TOP)$(SEP)builds$(SEP)
David Turner74043012000-07-08 00:22:20 +000056BUILD = $(BUILD_CONFIG_)$(PLATFORM)
57CONFIG_RULES = $(BUILD)$(SEP)$(CONFIG_FILE)
58
59# We define the BACKSLASH variable to hold a single back-slash character.
60# This is needed because a line like
61#
62# SEP := \
63#
64# does not work with GNU Make (the backslash is interpreted as a line
65# continuation). While a line like
66#
67# SEP := \\
68#
69# really defines $(SEP) as `\' on Unix, and `\\' on Dos and Windows!
70#
71BACKSLASH := $(strip \ )
72
Werner Lemberg594f0c92000-12-20 22:09:41 +000073# Find all auto-detectable platforms.
David Turner74043012000-07-08 00:22:20 +000074#
Werner Lemberg594f0c92000-12-20 22:09:41 +000075PLATFORMS_ := $(notdir $(subst /detect.mk,,$(wildcard $(BUILD_CONFIG_)*/detect.mk)))
76.PHONY: $(PLATFORMS_) ansi
77
78# Filter out platform specified as setup target.
79#
80PLATFORM := $(firstword $(filter $(MAKECMDGOALS),$(PLATFORMS_)))
81
82# If no setup target platform was specified, enable auto-detection/
83# default platform.
84#
85ifeq ($(PLATFORM),)
86 PLATFORM := ansi
87endif
88
89# If the user has explicitly asked for `ansi' on the command line,
90# disable auto-detection.
91#
92ifeq ($(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.
96 #
97 include $(wildcard $(BUILD_CONFIG_)*/detect.mk)
98endif
David Turner74043012000-07-08 00:22:20 +000099
100# In case no detection rule file was successful, use the default.
101#
102ifndef CONFIG_FILE
103 CONFIG_FILE := ansi.mk
104 setup: std_setup
Werner Lemberg594f0c92000-12-20 22:09:41 +0000105 .PHONY: setup
David Turner74043012000-07-08 00:22:20 +0000106endif
107
108# The following targets are equivalent, with the exception that they use
109# a slightly different syntax for the `echo' command.
110#
111# std_setup: defined for most (i.e. Unix-like) platforms
112# dos_setup: defined for Dos-ish platforms like Dos, Windows & OS/2
113#
114.PHONY: std_setup dos_setup
115
116std_setup:
117 @echo ""
David Turner896b6042000-10-03 17:51:29 +0000118 @echo "$(PROJECT_TITLE) build system -- automatic system detection"
David Turner74043012000-07-08 00:22:20 +0000119 @echo ""
120 @echo "The following settings are used:"
121 @echo ""
122 @echo " platform $(PLATFORM)"
123 @echo " compiler $(CC)"
124 @echo " configuration directory $(BUILD)"
125 @echo " configuration rules $(CONFIG_RULES)"
126 @echo ""
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."
129 @echo ""
130 @echo "Otherwise, simply type \`make' again to build the library."
131 @echo ""
132 @$(COPY) $(CONFIG_RULES) $(CONFIG_MK)
133
David Turnerebe85f52001-05-11 14:25:57 +0000134
Werner Lemberga64c55b2001-05-12 06:40:50 +0000135# Special case for Dos, Windows, OS/2, where echo "" doesn't work correctly!
David Turnerebe85f52001-05-11 14:25:57 +0000136#
David Turner74043012000-07-08 00:22:20 +0000137dos_setup:
David Turnerebe85f52001-05-11 14:25:57 +0000138 @type builds\newline
David Turner896b6042000-10-03 17:51:29 +0000139 @echo $(PROJECT_TITLE) build system -- automatic system detection
David Turnerebe85f52001-05-11 14:25:57 +0000140 @type builds\newline
David Turner74043012000-07-08 00:22:20 +0000141 @echo The following settings are used:
David Turnerebe85f52001-05-11 14:25:57 +0000142 @type builds\newline
143 @echo platformÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ$(PLATFORM)
144 @echo compilerÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ$(CC)
145 @echo configuration directoryÿÿÿÿÿÿ$(BUILD)
146 @echo configuration rulesÿÿÿÿÿÿÿÿÿÿ$(CONFIG_RULES)
147 @type builds\newline
David Turner74043012000-07-08 00:22:20 +0000148 @echo If this does not correspond to your system or settings please remove the file
149 @echo '$(CONFIG_MK)' from this directory then read the INSTALL file for help.
David Turnerebe85f52001-05-11 14:25:57 +0000150 @type builds\newline
David Turner74043012000-07-08 00:22:20 +0000151 @echo Otherwise, simply type 'make' again to build the library.
David Turnerebe85f52001-05-11 14:25:57 +0000152 @type builds\newline
David Turner74043012000-07-08 00:22:20 +0000153 @$(COPY) $(subst /,\,$(CONFIG_RULES) $(CONFIG_MK)) > nul
154
155# EOF