Revert "Merged all Chromoting Host code into remoting_core.dll (Windows)."
[chromium-blink-merge.git] / native_client_sdk / src / tools / nacl_llvm.mk
blob870b304648f7902f4c78241dfea239ef4a4f36bc
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 # Paths to Tools
15 PNACL_CC?=$(TC_PATH)/$(OSNAME)_x86_$(TOOLCHAIN)/newlib/bin/pnacl-clang -c
16 PNACL_CXX?=$(TC_PATH)/$(OSNAME)_x86_$(TOOLCHAIN)/newlib/bin/pnacl-clang++ -c
17 PNACL_LINK?=$(TC_PATH)/$(OSNAME)_x86_$(TOOLCHAIN)/newlib/bin/pnacl-clang++
18 PNACL_LIB?=$(TC_PATH)/$(OSNAME)_x86_$(TOOLCHAIN)/newlib/bin/pnacl-ar r
22 # Compile Macro
24 # $1 = Source Name
25 # $2 = Compile Flags
26 # $3 = Include Directories
28 define C_COMPILER_RULE
29 $(OUTDIR)/$(basename $(1))_pnacl.o : $(1) $(TOP_MAKE) | $(OUTDIR)
30 $(PNACL_CC) -o $$@ -c $$< $(POSIX_FLAGS) $(2) $(NACL_CFLAGS)
31 endef
33 define CXX_COMPILER_RULE
34 $(OUTDIR)/$(basename $(1))_pnacl.o : $(1) $(TOP_MAKE) | $(OUTDIR)
35 $(PNACL_CXX) -o $$@ -c $$< $(POSIX_FLAGS) $(2) $(NACL_CFLAGS)
36 endef
39 # $1 = Source Name
40 # $2 = POSIX Compile Flags
41 # $3 = Include Directories
42 # $4 = VC Flags (unused)
43 define COMPILE_RULE
44 ifeq ('.c','$(suffix $(1))')
45 $(call C_COMPILER_RULE,$(1),$(2) -I$(NACL_SDK_ROOT)/include $(foreach inc,$(3),-I$(inc)))
46 else
47 $(call CXX_COMPILER_RULE,$(1),$(2) -I$(NACL_SDK_ROOT)/include $(foreach inc,$(3),-I$(inc)))
48 endif
49 endef
53 # SO Macro
55 # $1 = Target Name
56 # $2 = List of Sources
59 define SO_RULE
60 $(error 'Shared libraries not supported by PNaCl')
61 endef
65 # LIB Macro
67 # $1 = Target Name
68 # $2 = List of Sources
69 # $3 = POSIX Link Flags
70 # $4 = VC Link Flags (unused)
71 define LIB_RULE
72 all: $(NACL_SDK_ROOT)/lib/$(TOOLCHAIN)/$(CONFIG)/lib$(1).a
73 $(NACL_SDK_ROOT)/lib/$(TOOLCHAIN)/$(CONFIG)/lib$(1).a : $(foreach src,$(2),$(OUTDIR)/$(basename $(src))_pnacl.o)
74 $(MKDIR) -p $$(dir $$@)
75 $(PNACL_LIB) $$@ $$^ $(3)
76 endef
80 # Specific Link Macro
82 # $1 = Target Name
83 # $2 = List of inputs
84 # $3 = List of libs
85 # $4 = List of deps
86 # $5 = List of lib dirs
87 # $6 = Other Linker Args
89 define LINKER_RULE
90 all: $(1)
91 $(1) : $(2) $(4)
92 $(PNACL_LINK) -o $(1) $(2) $(foreach path,$(5),-L$(path)/pnacl/$(CONFIG)) $(foreach lib,$(3),-l$(lib)) $(6)
93 endef
98 # Generalized Link Macro
100 # $1 = Target Name
101 # $2 = List of Sources
102 # $3 = List of LIBS
103 # $4 = List of DEPS
104 # $5 = POSIX Linker Switches
105 # $6 = VC Linker Switches
107 define LINK_RULE
108 $(call LINKER_RULE,$(OUTDIR)/$(1).pexe,$(foreach src,$(2),$(OUTDIR)/$(basename $(src))_pnacl.o),$(filter-out pthread,$(3)),$(4),$(LIB_PATHS),$(5))
109 endef
114 # NMF Manifiest generation
116 # Use the python script create_nmf to scan the binaries for dependencies using
117 # objdump. Pass in the (-L) paths to the default library toolchains so that we
118 # can find those libraries and have it automatically copy the files (-s) to
119 # the target directory for us.
121 # $1 = Target Name (the basename of the nmf
122 # $2 = Additional create_nmf.py arguments
124 NMF:=python $(NACL_SDK_ROOT)/tools/create_nmf.py
126 define NMF_RULE
127 all:$(OUTDIR)/$(1).nmf
128 $(OUTDIR)/$(1).nmf : $(OUTDIR)/$(1).pexe
129 $(NMF) -o $$@ $$^ -s $(OUTDIR) $(2)
130 endef