aboutsummaryrefslogtreecommitdiff
path: root/freetype/builds/dos/detect.mk
blob: 3e5e967e430d317e9bcf1831cf9edb1ce484dc61 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
#
# FreeType 2 configuration file to detect a DOS host platform.
#


# Copyright 1996-2000, 2003, 2004, 2006, 2014 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
# and distributed under the terms of the FreeType project license,
# LICENSE.TXT.  By continuing to use, modify, or distribute this file you
# indicate that you have read the license and understand and accept it
# fully.


.PHONY: setup


ifeq ($(PLATFORM),ansi)

  # Test for DJGPP by checking the DJGPP environment variable, which must be
  # set in order to use the system (ie. it will always be present when the
  # `make' utility is run).
  #
  # We test for the COMSPEC environment variable, then run the `ver'
  # command-line program to see if its output contains the word `Dos' or
  # `DOS'.
  #
  # If this is true, we are running a Dos-ish platform (or an emulation).
  #
  ifdef DJGPP
    PLATFORM := dos
  else
    ifdef COMSPEC
      is_dos := $(findstring DOS,$(subst Dos,DOS,$(shell ver)))

      # We try to recognize a Dos session under OS/2.  The `ver' command
      # returns `Operating System/2 ...' there, so `is_dos' should be empty.
      #
      # To recognize a Dos session under OS/2, we check COMSPEC for the
      # substring `MDOS\COMMAND'
      #
      ifeq ($(is_dos),)
        is_dos := $(findstring MDOS\COMMAND,$(COMSPEC))
      endif

      # We also try to recognize Dos 7.x without Windows 9X launched.
      # See builds/windows/detect.mk for explanations about the logic.
      #
      ifeq ($(is_dos),)
        ifdef winbootdir
#ifneq ($(OS),Windows_NT)
          # If windows is available, do not trigger this test.
          ifndef windir
            is_dos := $(findstring Windows,$(strip $(shell ver)))
          endif
#endif
        endif
      endif

    endif # test COMSPEC

    ifneq ($(is_dos),)

      PLATFORM := dos

    endif # test Dos
  endif # test DJGPP
endif # test PLATFORM ansi

ifeq ($(PLATFORM),dos)

  # Use DJGPP (i.e. gcc) by default.
  #
  CONFIG_FILE := dos-gcc.mk
  CC          ?= gcc

  # additionally, we provide hooks for various other compilers
  #
  ifneq ($(findstring emx,$(MAKECMDGOALS)),)        # EMX gcc
    CONFIG_FILE := dos-emx.mk
    CC          := gcc
    emx: setup
    .PHONY: emx
  endif

  ifneq ($(findstring turboc,$(MAKECMDGOALS)),)     # Turbo C
    CONFIG_FILE := dos-tcc.mk
    CC          := tcc
    turboc: setup
    .PHONY: turboc
  endif

  ifneq ($(findstring watcom,$(MAKECMDGOALS)),)     # Watcom C/C++
    CONFIG_FILE := dos-wat.mk
    CC          := wcc386
    watcom: setup
    .PHONY: watcom
  endif

  ifneq ($(findstring borlandc,$(MAKECMDGOALS)),)   # Borland C/C++ 32-bit
    CONFIG_FILE := dos-bcc.mk
    CC          := bcc32
    borlandc: setup
    .PHONY: borlandc
  endif

  ifneq ($(findstring borlandc16,$(MAKECMDGOALS)),) # Borland C/C++ 16-bit
    CONFIG_FILE := dos-bcc.mk
    CC          := bcc
    borlandc16: setup
    .PHONY: borlandc16
  endif

  ifneq ($(findstring bash,$(SHELL)),)              # check for bash
    SEP    := /
    DELETE := rm
    COPY   := cp
    CAT    := cat
    setup: std_setup
  else
    SEP    := $(BACKSLASH)
    DELETE := del
    CAT    := type

    # Setting COPY is a bit trickier.  We can be running DJGPP on some
    # Windows NT derivatives, like XP.  See builds/windows/detect.mk for
    # explanations why we need hacking here.
    #
    ifeq ($(OS),Windows_NT)
      COPY := cmd.exe /c copy
    else
      COPY := copy
    endif  # test NT

    setup: dos_setup
  endif

endif     # test PLATFORM dos


# EOF