summaryrefslogtreecommitdiff
path: root/gcc/config/i386/x-mingw32
blob: 6eb61677a2b8ca7865a6b09990c2d8daa9f3b5c4 (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
# Copyright (C) 2003-2016 Free Software Foundation, Inc.
#
# This file is part of GCC.
#
# GCC is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3, or (at your option)
# any later version.
#
# GCC is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GCC; see the file COPYING3.  If not see
# <http://www.gnu.org/licenses/>.
#

# MSYS will zealously translate all paths to Windows form, so /usr/include becomes c:/msysX/usr/include.
# This is undesirable when TARGET_SYSTEM_ROOT is specified, so this function converts /usr/include to //usr\include,
# which will become /usr/include again when passed to gcc.

# This function takes two parameters: first parameter is include directory path, second parameter tells
# if the path is relative to TARGET_SYSTEM_ROOT.
# If TARGET_SYSTEM_ROOT is not configured, or
#   this function always expands to the unmodified first parameter
# if TARGET_SYSTEM_ROOT is configured, but second parameter is not 1,
#   this function again expands to the unmodified first parameter
# otherwise,
#  it expands to a shell expression which will transform the first parameter as described above.
ifneq ($(TARGET_SYSTEM_ROOT),)
sysroot_relative_path = $(if $(filter 1,$(2)),`echo "$(1)" | tr '/' '\\\\' | sed 's|^\\\\|//|'`,$(1))
else
sysroot_relative_path = $(1)
endif

ifneq ($(TARGET_SYSTEM_ROOT),)
#
# Make sure that relative the path is not converted to absolute DOS style path
#
local_includedir = $(call sysroot_relative_path,$(local_prefix)/include,1)
else
#
# Make local_includedir relative to EXEC_PREFIX 
#
local_includedir=$(libsubdir)/$(unlibsubdir)/..`echo $(exec_prefix) | sed -e 's|^$(prefix)||' -e 's|/[^/]*|/..|g'`/include
endif

#
# Make sure that relative path are not converted to absolute DOS style paths
#
gplusplus_includedir = $(call sysroot_relative_path,$(gcc_gxx_include_dir),$(gcc_gxx_include_dir_add_sysroot))
gplusplus_tool_includedir = $(call sysroot_relative_path,$(gcc_gxx_include_dir)/$(target_noncanonical),$(gcc_gxx_include_dir_add_sysroot))
gplusplus_backward_includedir = $(call sysroot_relative_path,$(gcc_gxx_include_dir)/backward,$(gcc_gxx_include_dir_add_sysroot))
native_system_includedir = $(call sysroot_relative_path,$(NATIVE_SYSTEM_HEADER_DIR),1)

# On MinGW, we use "%IA64d" to print 64-bit integers, and the format-checking
# code does not handle that, so we have to disable checking here.
WERROR_FLAGS += -Wno-format

host-mingw32.o : $(srcdir)/config/i386/host-mingw32.c $(CONFIG_H) $(SYSTEM_H) \
  coretypes.h hosthooks.h hosthooks-def.h toplev.h $(DIAGNOSTIC_H) $(HOOKS_H)
	$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
		$(srcdir)/config/i386/host-mingw32.c