Revert "Merged all Chromoting Host code into remoting_core.dll (Windows)."
[chromium-blink-merge.git] / native_client_sdk / src / tools / host_gcc.mk
blobe5e72e8ed3e7b455b630c513ef46048c28d58c06
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
13 # Macros for TOOLS
15 # We use the C++ compiler for everything and then use the -Wl,-as-needed flag
16 # in the linker to drop libc++ unless it's actually needed.
18 HOST_CC?=gcc
19 HOST_CXX?=g++
20 HOST_LINK?=g++
21 HOST_LIB?=ar r
24 LINUX_WARNINGS?=-Wno-long-long
25 LINUX_CCFLAGS=-fPIC -pthread $(LINUX_WARNINGS) -I$(NACL_SDK_ROOT)/include -I$(NACL_SDK_ROOT)/include/linux
29 # Individual Macros
31 # $1 = Source Name
32 # $2 = Compile Flags
34 define C_COMPILER_RULE
35 $(OUTDIR)/$(basename $(1)).o : $(1) $(TOP_MAKE) | $(OUTDIR)
36 $(HOST_CC) -o $$@ -c $$< -fPIC $(POSIX_FLAGS) $(2) $(LINUX_FLAGS)
37 endef
39 define CXX_COMPILER_RULE
40 $(OUTDIR)/$(basename $(1)).o : $(1) $(TOP_MAKE) | $(OUTDIR)
41 $(HOST_CXX) -o $$@ -c $$< -fPIC $(POSIX_FLAGS) $(2) $(LINUX_FLAGS)
42 endef
45 # $1 = Source Name
46 # $2 = POSIX Compile Flags
47 # $3 = VC Flags (unused)
49 define COMPILE_RULE
50 ifeq ('.c','$(suffix $(1))')
51 $(call C_COMPILER_RULE,$(1),$(2) $(foreach inc,$(INC_PATHS),-I$(inc)))
52 else
53 $(call CXX_COMPILER_RULE,$(1),$(2) $(foreach inc,$(INC_PATHS),-I$(inc)))
54 endif
55 endef
59 # SO Macro
61 # $1 = Target Name
62 # $2 = List of Sources
65 define SO_RULE
66 $(error 'Shared libraries not supported by Host')
67 endef
71 # LIB Macro
73 # $1 = Target Name
74 # $2 = List of Sources
77 define LIB_RULE
78 all:$(NACL_SDK_ROOT)/lib/$(OSNAME)_host/$(CONFIG)/lib$(1).a
79 $(NACL_SDK_ROOT)/lib/$(OSNAME)_host/$(CONFIG)/lib$(1).a : $(foreach src,$(2),$(OUTDIR)/$(basename $(src)).o)
80 $(MKDIR) -p $$(dir $$@)
81 $(HOST_LIB) $$@ $$^
82 endef
86 # Link Macro
88 # $1 = Target Name
89 # $2 = List of inputs
90 # $3 = List of libs
91 # $4 = List of deps
92 # $5 = List of lib dirs
93 # $6 = Other Linker Args
95 define LINKER_RULE
96 all: $(1)
97 $(1) : $(2) $(4)
98 $(HOST_LINK) -shared -o $(1) $(2) $(foreach path,$(5),-L$(path)/$(OSNAME)_host)/$(CONFIG) $(foreach lib,$(3),-l$(lib)) $(6)
99 endef
103 # Link Macro
105 # $1 = Target Name
106 # $2 = List of Sources
107 # $3 = List of LIBS
108 # $4 = List of DEPS
109 # $5 = POSIX Linker Switches
110 # $6 = VC Linker Switches
112 define LINK_RULE
113 $(call LINKER_RULE,$(OUTDIR)/$(1)$(HOST_EXT),$(foreach src,$(2),$(OUTDIR)/$(basename $(src)).o),$(filter-out pthread,$(3)),$(4),$(LIB_PATHS),$(5))
114 endef
118 # NMF Manifiest generation
120 # Use the python script create_nmf to scan the binaries for dependencies using
121 # objdump. Pass in the (-L) paths to the default library toolchains so that we
122 # can find those libraries and have it automatically copy the files (-s) to
123 # the target directory for us.
125 # $1 = Target Name (the basename of the nmf
126 # $2 = Additional create_nmf.py arguments
128 NMF:=python $(NACL_SDK_ROOT)/tools/create_nmf.py
130 define NMF_RULE
131 NMF_LIST+=$(OUTDIR)/$(1).nmf
132 $(OUTDIR)/$(1).nmf : $(OUTDIR)/$(1)$(HOST_EXT)
133 @echo "Host Toolchain" > $$@
134 endef
136 all : $(LIB_LIST) $(DEPS_LIST) $(NMF_LIST)