update for HEAD-2003050101
[reactos.git] / lib / freetype / builds / detect.mk
1 #
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
20 #                `freetype/builds/$(PLATFORM)' but can be different for
21 #                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_DIR      The top-most directory in the FreeType library source
38 #                hierarchy.  If not defined, it will default to `.'.
39
40 # If TOP_DIR is not defined, default it to `.'
41 #
42 ifndef TOP_DIR
43   TOP_DIR := .
44 endif
45
46 # Set auto-detection default to `ansi' resp. UNIX-like operating systems.
47 # Note that we delay evaluation of $(BUILD_CONFIG_), $(BUILD), and
48 # $(CONFIG_RULES).
49 #
50 PLATFORM := ansi
51 DELETE   := $(RM)
52 COPY     := cp
53 SEP      := /
54
55 BUILD_CONFIG_ = $(TOP_DIR)$(SEP)builds$(SEP)
56 BUILD         = $(BUILD_CONFIG_)$(PLATFORM)
57 CONFIG_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 #
71 BACKSLASH := $(strip \ )
72
73 # Find all auto-detectable platforms.
74 #
75 PLATFORMS_ := $(notdir $(subst /detect.mk,,$(wildcard $(BUILD_CONFIG_)*/detect.mk)))
76 .PHONY: $(PLATFORMS_) ansi
77
78 # Filter out platform specified as setup target.
79 #
80 PLATFORM := $(firstword $(filter $(MAKECMDGOALS),$(PLATFORMS_)))
81
82 # If no setup target platform was specified, enable auto-detection/
83 # default platform.
84 #
85 ifeq ($(PLATFORM),)
86   PLATFORM := ansi
87 endif
88
89 # If the user has explicitly asked for `ansi' on the command line,
90 # disable auto-detection.
91 #
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.
96   #
97   include $(wildcard $(BUILD_CONFIG_)*/detect.mk)
98 endif
99
100 # In case no detection rule file was successful, use the default.
101 #
102 ifndef CONFIG_FILE
103   CONFIG_FILE := ansi.mk
104   setup: std_setup
105   .PHONY: setup
106 endif
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
116 std_setup:
117         @echo ""
118         @echo "$(PROJECT_TITLE) build system -- automatic system detection"
119         @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
134
135 # Special case for Dos, Windows, OS/2, where echo "" doesn't work correctly!
136 #
137 dos_setup:
138         @type builds\newline
139         @echo $(PROJECT_TITLE) build system -- automatic system detection
140         @type builds\newline
141         @echo The following settings are used:
142         @type builds\newline
143         @echo   platform