Initialize Tizen 2.3
[framework/graphics/freetype.git] / builds / detect.mk
1 #
2 # FreeType 2 host platform detection rules
3 #
4
5
6 # Copyright 1996-2000, 2001, 2002, 2003, 2006, 2008 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 #                `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 #   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 # The following targets are equivalent, with the exception that they use
105 # a slightly different syntax for the `echo' command.
106 #
107 # std_setup: defined for most (i.e. Unix-like) platforms
108 # dos_setup: defined for Dos-ish platforms like Dos, Windows & OS/2
109 #
110 .PHONY: std_setup dos_setup
111
112 std_setup:
113         @echo ""
114         @echo "$(PROJECT_TITLE) build system -- automatic system detection"
115         @echo ""
116         @echo "The following settings are used:"
117         @echo ""
118         @echo "  platform                    $(PLATFORM)"
119         @echo "  compiler                    $(CC)"
120         @echo "  configuration directory     $(BUILD_DIR)"
121         @echo "  configuration rules         $(CONFIG_RULES)"
122         @echo ""
123         @echo "If this does not correspond to your system or settings please remove the file"
124         @echo "\`$(CONFIG_MK)' from this directory then read the INSTALL file for help."
125         @echo ""
126         @echo "Otherwise, simply type \`$(MAKE)' again to build the library,"
127         @echo "or \`$(MAKE) refdoc' to build the API reference (the latter needs python)."
128         @echo ""
129         @$(COPY) $(CONFIG_RULES) $(CONFIG_MK)
130
131
132 # Special case for Dos, Windows, OS/2, where echo "" doesn't work correctly!
133 #
134 dos_setup:
135         @type builds$(SEP)newline
136         @echo $(PROJECT_TITLE) build system -- automatic system detection
137         @type builds$(SEP)newline
138         @echo The following settings are used:
139         @type builds$(SEP)newline
140         @echo   platformÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ$(PLATFORM)
141         @echo   compilerÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ$(CC)
142         @echo   configuration directoryÿÿÿÿÿÿ$(subst /,$(SEP),$(BUILD_DIR))
143         @echo   configuration rulesÿÿÿÿÿÿÿÿÿÿ$(subst /,$(SEP),$(CONFIG_RULES))
144         @type builds$(SEP)newline
145         @echo If this does not correspond to your system or settings please remove the file
146         @echo '$(CONFIG_MK)' from this directory then read the INSTALL file for help.
147         @type builds$(SEP)newline
148         @echo Otherwise, simply type 'make' again to build the library.
149         @echo or 'make refdoc' to build the API reference (the latter needs python).
150         @type builds$(SEP)newline
151         @$(COPY) $(subst /,$(SEP),$(CONFIG_RULES) $(CONFIG_MK)) > nul
152
153
154 # EOF