Add more checks to investigate SupervisedUserPrefStore crash at startup.
[chromium-blink-merge.git] / native_client_sdk / src / tools / host_vc.mk
blob31c05b24ef11f17710ff35bb5f750879ad325195
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
6 # GNU Make based build file. For details on GNU Make see:
7 # http://www.gnu.org/software/make/manual/make.html
12 # Macros for TOOLS
14 # We use the C++ compiler for everything and then use the -Wl,-as-needed flag
15 # in the linker to drop libc++ unless it's actually needed.
17 HOST_CC ?= cl.exe /nologo
18 HOST_CXX ?= cl.exe /nologo /EHsc
19 HOST_LINK ?= link.exe /nologo
20 HOST_LIB ?= lib.exe /nologo
22 ifeq (,$(findstring cl.exe,$(shell $(WHICH) cl.exe)))
23 $(warning To skip the host build use:)
24 $(warning "make NO_HOST_BUILDS=1")
25 $(error Unable to find cl.exe in PATH while building Windows host build)
26 endif
29 ifeq ($(CONFIG),Release)
30 WIN_OPT_FLAGS ?= /O2 /MT /Z7 -DNDEBUG
31 else
32 WIN_OPT_FLAGS ?= /Od /MTd /Z7 -DNACL_SDK_DEBUG
33 endif
35 WIN_FLAGS ?= -DWIN32 -D_WIN32 -DPTW32_STATIC_LIB
39 # Individual Macros
41 # $1 = Source Name
42 # $2 = Compile Flags
44 define C_COMPILER_RULE
45 $(call SRC_TO_OBJ,$(1)): $(1) $(TOP_MAKE) | $(dir $(call SRC_TO_OBJ,$(1)))dir.stamp
46 $(call LOG,CC,$$@,$(HOST_CC) /Fo$$@ /c $$< $(WIN_OPT_FLAGS) $(2) $(WIN_FLAGS))
47 endef
49 define CXX_COMPILER_RULE
50 $(call SRC_TO_OBJ,$(1)): $(1) $(TOP_MAKE) | $(dir $(call SRC_TO_OBJ,$(1)))dir.stamp
51 $(call LOG,CXX,$$@,$(HOST_CXX) /Fo$$@ -c $$< $(WIN_OPT_FLAGS) $(2) $(WIN_FLAGS))
52 endef
55 # $1 = Source Name
56 # $2 = POSIX Compile Flags (unused)
57 # $3 = VC Compile Flags
59 define COMPILE_RULE
60 ifeq ($(suffix $(1)),.c)
61 $(call C_COMPILER_RULE,$(1),$(3) $(foreach inc,$(INC_PATHS),/I$(inc)))
62 else
63 $(call CXX_COMPILER_RULE,$(1),$(3) $(foreach inc,$(INC_PATHS),/I$(inc)))
64 endif
65 endef
69 # LIB Macro
71 # $1 = Target Name
72 # $2 = List of Sources
75 define LIB_RULE
76 $(STAMPDIR)/$(1).stamp: $(LIBDIR)/$(OSNAME)_x86_32_host/$(CONFIG)/$(1).lib
77 @echo "TOUCHED $$@" > $(STAMPDIR)/$(1).stamp
79 all:$(LIBDIR)/$(OSNAME)_x86_32_host/$(CONFIG)/$(1).lib
80 $(LIBDIR)/$(OSNAME)_x86_32_host/$(CONFIG)/$(1).lib: $(foreach src,$(2),$(OUTDIR)/$(basename $(src)).o)
81 $(MKDIR) -p $$(dir $$@)
82 $(call LOG,LIB,$$@,$(HOST_LIB) /OUT:$$@ $$^ $(WIN_LDFLAGS))
83 endef
87 # Link Macro
89 # $1 = Target Name
90 # $2 = List of inputs
91 # $3 = List of libs
92 # $4 = List of deps
93 # $5 = List of lib dirs
94 # $6 = Other Linker Args
96 define LINKER_RULE
97 all: $(1)
98 $(1): $(2) $(foreach dep,$(4),$(STAMPDIR)/$(dep).stamp)
99 $(call LOG,LINK,$$@,$(HOST_LINK) /DLL /OUT:$(1) /PDB:$(1).pdb $(2) /DEBUG $(foreach path,$(5),/LIBPATH:$(path)/$(OSNAME)_x86_32_host/$(CONFIG)) $(foreach lib,$(3),$(lib).lib) $(6))
100 endef
104 # Link Macro
106 # $1 = Target Name
107 # $2 = List of Sources
108 # $3 = List of LIBS
109 # $4 = List of DEPS
110 # $5 = POSIX Linker Switches
111 # $6 = VC Linker Switches
113 define LINK_RULE
114 $(call LINKER_RULE,$(OUTDIR)/$(1)$(HOST_EXT),$(foreach src,$(2),$(OUTDIR)/$(basename $(src)).o),$(3),$(4),$(LIB_PATHS),$(6))
115 endef
119 # Strip Macro
120 # This is a nop (copy) since visual studio already keeps debug info
121 # separate from the binaries
123 # $1 = Target Name
124 # $2 = Input Name
126 define STRIP_RULE
127 all: $(OUTDIR)/$(1)$(HOST_EXT)
128 $(OUTDIR)/$(1)$(HOST_EXT): $(OUTDIR)/$(2)$(HOST_EXT)
129 $(call LOG,COPY,$$@,$(CP) $$^ $$@)
130 endef
132 all: $(LIB_LIST) $(DEPS_LIST)