Imported Upstream version 2.5.5
[platform/upstream/freetype2.git] / builds / unix / detect.mk
1 #
2 # FreeType 2 configuration file to detect a UNIX host platform.
3 #
4
5
6 # Copyright 1996-2000, 2002-2004, 2006, 2013 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 .PHONY: setup
16
17 ifeq ($(PLATFORM),ansi)
18
19   # Note: this test is duplicated in "builds/toplevel.mk".
20   #
21   is_unix := $(strip $(wildcard /sbin/init) \
22                      $(wildcard /usr/sbin/init) \
23                      $(wildcard /dev/null) \
24                      $(wildcard /hurd/auth))
25   ifneq ($(is_unix),)
26
27     PLATFORM := unix
28
29   endif # test is_unix
30 endif # test PLATFORM ansi
31
32 ifeq ($(PLATFORM),unix)
33   COPY   := cp
34   DELETE := rm -f
35   CAT    := cat
36
37   # If `devel' is the requested target, we use a special configuration
38   # file named `unix-dev.mk'.  It disables optimization and libtool.
39   #
40   ifneq ($(findstring devel,$(MAKECMDGOALS)),)
41     CONFIG_FILE := unix-dev.mk
42     CC          := gcc
43     devel: setup
44     .PHONY: devel
45   else
46
47     # If `lcc' is the requested target, we use a special configuration
48     # file named `unix-lcc.mk'.  It disables libtool for LCC.
49     #
50     ifneq ($(findstring lcc,$(MAKECMDGOALS)),)
51       CONFIG_FILE := unix-lcc.mk
52       CC          := lcc
53       lcc: setup
54       .PHONY: lcc
55     else
56
57       # If a Unix platform is detected, the configure script is called and
58       # `unix-def.mk' together with `unix-cc.mk' is created.
59       #
60       # Arguments to `configure' should be in the CFG variable.  Example:
61       #
62       #   make CFG="--prefix=/usr --disable-static"
63       #
64       # If you need to set CFLAGS or LDFLAGS, do it here also.
65       #
66       # Feel free to add support for other platform specific compilers in
67       # this directory (e.g. solaris.mk + changes here to detect the
68       # platform).
69       #
70       CONFIG_FILE := unix.mk
71       unix: setup
72       must_configure := 1
73       .PHONY: unix
74     endif
75   endif
76
77   have_Makefile := $(wildcard $(OBJ_DIR)/Makefile)
78
79       CONFIG_SHELL ?= /bin/sh
80       setup: std_setup
81   ifdef must_configure
82     ifneq ($(have_Makefile),)
83       # we are building FT2 not in the src tree
84               $(CONFIG_SHELL) $(TOP_DIR)/builds/unix/configure $(value CFG)
85     else
86               cd builds/unix; $(CONFIG_SHELL) ./configure $(value CFG)
87     endif
88   endif
89
90 endif   # test PLATFORM unix
91
92
93 # EOF