Imported Upstream version 2.5.5
[platform/upstream/freetype2.git] / builds / windows / detect.mk
1 #
2 # FreeType 2 configuration file to detect a Win32 host platform.
3 #
4
5
6 # Copyright 1996-2000, 2003, 2004, 2006, 2007, 2014 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 .PHONY: setup
17
18
19 ifeq ($(PLATFORM),ansi)
20
21   # Detecting Windows NT is easy, as the OS variable must be defined and
22   # contains `Windows_NT'.  This also works with Windows 2000 and XP.
23   #
24   ifeq ($(OS),Windows_NT)
25
26     PLATFORM := windows
27
28   else
29
30     # Detecting Windows 9X
31
32     # We used to run the `ver' command to see if its output contains the
33     # word `Windows'.  If this is true, we are running Windows 95 or later:
34     #
35     #   ifdef COMSPEC
36     #     # First, check if we have the COMSPEC environment variable, which
37     #     # indicates we can use COMMAND.COM's internal commands
38     #     is_windows := $(findstring Windows,$(strip $(shell ver)))
39     #   endif
40     #
41     # Unfortunately, this also detects the case when one is running
42     # DOS 7.x (the MS-DOS version that lies below Windows) without actually
43     # launching the GUI.
44     #
45     # A better test is to check whether there are both the environment
46     # variables `winbootdir' and `windir'.  The first indicates an
47     # underlying DOS 7.x, while the second is set only if windows is
48     # available.
49     #
50     # Note that on Windows NT, such an environment variable will not be seen
51     # from DOS-based tools like DJGPP's make; this is not actually a problem
52     # since NT is detected independently above.  But do not try to be clever!
53     #
54     ifdef winbootdir
55       ifdef windir
56
57         PLATFORM := windows
58
59       endif
60     endif
61
62   endif  # test NT
63
64 endif # test PLATFORM ansi
65
66 ifeq ($(PLATFORM),windows)
67
68   DELETE := del
69   CAT    := type
70   SEP    := $(BACKSLASH)
71
72   # Setting COPY is a bit trickier.  Plain COPY on NT will not work
73   # correctly, because it will uppercase 8.3 filenames, creating a
74   # `CONFIG.MK' file which isn't found later on by `make'.
75   # Since we do not want that, we need to force execution of CMD.EXE.
76   # Unfortunately, CMD.EXE is not available on Windows 9X.
77   # So we need to hack.
78   #
79   # Kudos to Eli Zaretskii (DJGPP guru) that helped debug it.
80   # Details are available in threads of the freetype mailing list
81   # (2004-11-11), and then in the devel mailing list (2004-11-20 to -23).
82   #
83   ifeq ($(OS),Windows_NT)
84     COPY := cmd.exe /c copy
85   else
86     COPY := copy
87   endif  # test NT
88
89
90   # gcc Makefile by default
91   CONFIG_FILE := w32-gcc.mk
92   ifeq ($(firstword $(CC)),cc)
93     CC        := gcc
94   endif
95
96   ifneq ($(findstring list,$(MAKECMDGOALS)),)  # test for the "list" target
97     dump_target_list:
98             @echo ÿ
99             @echo $(PROJECT_TITLE) build system -- supported compilers
100             @echo ÿ
101             @echo Several command-line compilers are supported on Win32:
102             @echo ÿ
103             @echo ÿÿmake setupÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿgcc (with Mingw)
104             @echo ÿÿmake setup visualcÿÿÿÿÿÿÿÿÿÿÿÿÿMicrosoft Visual C++
105             @echo ÿÿmake setup bcc32ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿBorland C/C++
106             @echo ÿÿmake setup lccÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿWin32-LCC
107             @echo ÿÿmake setup intelcÿÿÿÿÿÿÿÿÿÿÿÿÿÿIntel C/C++
108             @echo ÿ
109
110     setup: dump_target_list
111     .PHONY: dump_target_list list
112   else
113     setup: dos_setup
114   endif
115
116   # additionally, we provide hooks for various other compilers
117   #
118   ifneq ($(findstring visualc,$(MAKECMDGOALS)),)     # Visual C/C++
119     CONFIG_FILE := w32-vcc.mk
120     CC          := cl
121     visualc: setup
122     .PHONY: visualc
123   endif
124
125   ifneq ($(findstring intelc,$(MAKECMDGOALS)),)      # Intel C/C++
126     CONFIG_FILE := w32-intl.mk
127     CC          := cl
128     visualc: setup
129     .PHONY: intelc
130   endif
131
132   ifneq ($(findstring watcom,$(MAKECMDGOALS)),)      # Watcom C/C++
133     CONFIG_FILE := w32-wat.mk
134     CC          := wcc386
135     watcom: setup
136     .PHONY: watcom
137   endif
138
139   ifneq ($(findstring visualage,$(MAKECMDGOALS)),)   # Visual Age C++
140     CONFIG_FILE := w32-icc.mk
141     CC          := icc
142     visualage: setup
143     .PHONY: visualage
144   endif
145
146   ifneq ($(findstring lcc,$(MAKECMDGOALS)),)         # LCC-Win32
147     CONFIG_FILE := w32-lcc.mk
148     CC          := lcc
149     lcc: setup
150     .PHONY: lcc
151   endif
152
153   ifneq ($(findstring mingw32,$(MAKECMDGOALS)),)     # mingw32
154     CONFIG_FILE := w32-mingw32.mk
155     CC          := gcc
156     mingw32: setup
157     .PHONY: mingw32
158   endif
159
160   ifneq ($(findstring bcc32,$(MAKECMDGOALS)),)       # Borland C++
161     CONFIG_FILE := w32-bcc.mk
162     CC          := bcc32
163     bcc32: setup
164     .PHONY: bcc32
165   endif
166
167   ifneq ($(findstring devel-bcc,$(MAKECMDGOALS)),)   # development target
168     CONFIG_FILE := w32-bccd.mk
169     CC          := bcc32
170     devel-bcc: setup
171     .PHONY: devel-bcc
172   endif
173
174   ifneq ($(findstring devel-gcc,$(MAKECMDGOALS)),)   # development target
175     CONFIG_FILE := w32-dev.mk
176     CC          := gcc
177     devel-gcc: setup
178     .PHONY: devel-gcc
179   endif
180
181 endif   # test PLATFORM windows
182
183
184 # EOF