• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#
2# FreeType 2 configuration file to detect a DOS host platform.
3#
4
5
6# Copyright (C) 1996-2022 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
19ifeq ($(PLATFORM),ansi)
20
21  # Test for DJGPP by checking the DJGPP environment variable, which must be
22  # set in order to use the system (ie. it will always be present when the
23  # `make' utility is run).
24  #
25  # We test for the COMSPEC environment variable, then run the `ver'
26  # command-line program to see if its output contains the word `Dos' or
27  # `DOS'.
28  #
29  # If this is true, we are running a Dos-ish platform (or an emulation).
30  #
31  ifdef DJGPP
32    PLATFORM := dos
33  else
34    ifdef COMSPEC
35      is_dos := $(findstring DOS,$(subst Dos,DOS,$(shell ver)))
36
37      # We try to recognize a Dos session under OS/2.  The `ver' command
38      # returns `Operating System/2 ...' there, so `is_dos' should be empty.
39      #
40      # To recognize a Dos session under OS/2, we check COMSPEC for the
41      # substring `MDOS\COMMAND'
42      #
43      ifeq ($(is_dos),)
44        is_dos := $(findstring MDOS\COMMAND,$(COMSPEC))
45      endif
46
47      # We also try to recognize Dos 7.x without Windows 9X launched.
48      # See builds/windows/detect.mk for explanations about the logic.
49      #
50      ifeq ($(is_dos),)
51        ifdef winbootdir
52#ifneq ($(OS),Windows_NT)
53          # If windows is available, do not trigger this test.
54          ifndef windir
55            is_dos := $(findstring Windows,$(strip $(shell ver)))
56          endif
57#endif
58        endif
59      endif
60
61    endif # test COMSPEC
62
63    ifneq ($(is_dos),)
64
65      PLATFORM := dos
66
67    endif # test Dos
68  endif # test DJGPP
69endif # test PLATFORM ansi
70
71ifeq ($(PLATFORM),dos)
72
73  # Use DJGPP (i.e. gcc) by default.
74  #
75  CONFIG_FILE := dos-gcc.mk
76  CC          ?= gcc
77
78  # additionally, we provide hooks for various other compilers
79  #
80  ifneq ($(findstring emx,$(MAKECMDGOALS)),)        # EMX gcc
81    CONFIG_FILE := dos-emx.mk
82    CC          := gcc
83
84    .PHONY: emx
85    emx: setup
86	    @cd .
87  endif
88
89  ifneq ($(findstring turboc,$(MAKECMDGOALS)),)     # Turbo C
90    CONFIG_FILE := dos-tcc.mk
91    CC          := tcc
92
93    .PHONY: turboc
94    turboc: setup
95	    @cd .
96  endif
97
98  ifneq ($(findstring watcom,$(MAKECMDGOALS)),)     # Watcom C/C++
99    CONFIG_FILE := dos-wat.mk
100    CC          := wcc386
101
102    .PHONY: watcom
103    watcom: setup
104	    @cd .
105  endif
106
107  ifneq ($(findstring borlandc,$(MAKECMDGOALS)),)   # Borland C/C++ 32-bit
108    CONFIG_FILE := dos-bcc.mk
109    CC          := bcc32
110
111    .PHONY: borlandc
112    borlandc: setup
113	    @cd .
114  endif
115
116  ifneq ($(findstring borlandc16,$(MAKECMDGOALS)),) # Borland C/C++ 16-bit
117    CONFIG_FILE := dos-bcc.mk
118    CC          := bcc
119
120    .PHONY: borlandc16
121    borlandc16: setup
122	    @cd .
123  endif
124
125  ifneq ($(findstring bash,$(SHELL)),)              # check for bash
126    SEP    := /
127    DELETE := rm
128    COPY   := cp
129    CAT    := cat
130    setup: std_setup
131  else
132    SEP    := $(BACKSLASH)
133    DELETE := del
134    CAT    := type
135
136    # Setting COPY is a bit trickier.  We can be running DJGPP on some
137    # Windows NT derivatives, like XP.  See builds/windows/detect.mk for
138    # explanations why we need hacking here.
139    #
140    ifeq ($(OS),Windows_NT)
141      COPY := cmd.exe /c copy
142    else
143      COPY := copy
144    endif  # test NT
145
146    setup: std_setup
147  endif
148
149endif     # test PLATFORM dos
150
151
152# EOF
153