OLD | NEW |
---|---|
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
Sam Clegg
2013/08/10 00:54:01
Was that deliberate? 3 spaces?
| |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 # | 5 # |
6 # GNU Make based build file. For details on GNU Make see: | 6 # GNU Make based build file. For details on GNU Make see: |
7 # http://www.gnu.org/software/make/manual/make.html | 7 # http://www.gnu.org/software/make/manual/make.html |
8 # | 8 # |
9 | 9 |
10 # | 10 # |
11 # Paths to Tools | 11 # Paths to Tools |
12 # | 12 # |
13 PNACL_BIN = $(TC_PATH)/$(OSNAME)_x86_$(TOOLCHAIN)/newlib/bin | 13 PNACL_BIN = $(TC_PATH)/$(OSNAME)_x86_$(TOOLCHAIN)/newlib/bin |
14 PNACL_CC ?= $(PNACL_BIN)/pnacl-clang -c | 14 PNACL_CC ?= $(PNACL_BIN)/pnacl-clang -c |
15 PNACL_CXX ?= $(PNACL_BIN)/pnacl-clang++ -c | 15 PNACL_CXX ?= $(PNACL_BIN)/pnacl-clang++ -c |
16 PNACL_LINK ?= $(PNACL_BIN)/pnacl-clang++ | 16 PNACL_LINK ?= $(PNACL_BIN)/pnacl-clang++ |
17 PNACL_LIB ?= $(PNACL_BIN)/pnacl-ar | 17 PNACL_LIB ?= $(PNACL_BIN)/pnacl-ar |
18 PNACL_STRIP ?= $(PNACL_BIN)/pnacl-strip | 18 PNACL_STRIP ?= $(PNACL_BIN)/pnacl-strip |
19 PNACL_FINALIZE ?= $(PNACL_BIN)/pnacl-finalize | 19 PNACL_FINALIZE ?= $(PNACL_BIN)/pnacl-finalize |
20 | 20 |
21 # if you want to debug, do not use PEXE, use BC | |
Sam Clegg
2013/08/10 00:54:01
You mean "use NEXE"?
This comment could be fill
noelallen1
2013/08/10 19:08:49
Done.
| |
22 PNACL_TRANSLATE ?= $(PNACL_BIN)/pnacl-translate | |
23 | |
21 # | 24 # |
22 # Compile Macro | 25 # Compile Macro |
23 # | 26 # |
24 # $1 = Source Name | 27 # $1 = Source Name |
25 # $2 = Compile Flags | 28 # $2 = Compile Flags |
26 # $3 = Include Directories | 29 # $3 = Include Directories |
27 # | 30 # |
28 define C_COMPILER_RULE | 31 define C_COMPILER_RULE |
29 -include $(call SRC_TO_DEP,$(1),_pnacl) | 32 -include $(call SRC_TO_DEP,$(1),_pnacl) |
30 $(call SRC_TO_OBJ,$(1),_pnacl): $(1) $(TOP_MAKE) | $(dir $(call SRC_TO_OBJ,$(1)) )dir.stamp | 33 $(call SRC_TO_OBJ,$(1),_pnacl): $(1) $(TOP_MAKE) | $(dir $(call SRC_TO_OBJ,$(1)) )dir.stamp |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
87 # Specific Link Macro | 90 # Specific Link Macro |
88 # | 91 # |
89 # $1 = Target Name | 92 # $1 = Target Name |
90 # $2 = List of inputs | 93 # $2 = List of inputs |
91 # $3 = List of libs | 94 # $3 = List of libs |
92 # $4 = List of deps | 95 # $4 = List of deps |
93 # $5 = List of lib dirs | 96 # $5 = List of lib dirs |
94 # $6 = Other Linker Args | 97 # $6 = Other Linker Args |
95 # | 98 # |
96 define LINKER_RULE | 99 define LINKER_RULE |
97 all: $(1).pexe | 100 all: $(1).pexe |
101 $(1)_x86_32.nexe : $(1).bc | |
102 » $(call LOG,TRANSLATE,$$@,$(PNACL_TRANSLATE) -arch x86-32 $$^ -o $$@) | |
103 | |
104 $(1)_x86_64.nexe : $(1).bc | |
105 » $(call LOG,TRANSLATE,$$@,$(PNACL_TRANSLATE) -arch x86-64 $$^ -o $$@) | |
106 | |
107 $(1)_arm.nexe : $(1).bc | |
108 » $(call LOG,TRANSLATE,$$@,$(PNACL_TRANSLATE) -arch arm $$^ -o $$@) | |
109 | |
98 $(1).pexe: $(1).bc | 110 $(1).pexe: $(1).bc |
99 $(call LOG,FINALIZE,$$@,$(PNACL_FINALIZE) -o $$@ $$^) | 111 $(call LOG,FINALIZE,$$@,$(PNACL_FINALIZE) -o $$@ $$^) |
100 | 112 |
101 $(1).bc: $(2) $(foreach dep,$(4),$(STAMPDIR)/$(dep).stamp) | 113 $(1).bc: $(2) $(foreach dep,$(4),$(STAMPDIR)/$(dep).stamp) |
102 $(call LOG,LINK,$$@,$(PNACL_LINK) -o $$@ $(2) $(foreach path,$(5),-L$(pa th)/pnacl/$(CONFIG)) $(foreach lib,$(3),-l$(lib)) $(6)) | 114 $(call LOG,LINK,$$@,$(PNACL_LINK) -o $$@ $(2) $(foreach path,$(5),-L$(pa th)/pnacl/$(CONFIG)) $(foreach lib,$(3),-l$(lib)) $(6)) |
103 endef | 115 endef |
104 | 116 |
105 | 117 |
106 # | 118 # |
107 # Generalized Link Macro | 119 # Generalized Link Macro |
108 # | 120 # |
109 # $1 = Target Name | 121 # $1 = Target Name |
110 # $2 = List of Sources | 122 # $2 = List of Sources |
111 # $3 = List of LIBS | 123 # $3 = List of LIBS |
112 # $4 = List of DEPS | 124 # $4 = List of DEPS |
113 # $5 = POSIX Linker Switches | 125 # $5 = POSIX Linker Switches |
114 # $6 = VC Linker Switches | 126 # $6 = VC Linker Switches |
115 # | 127 # |
116 define LINK_RULE | 128 define LINK_RULE |
129 ifeq ($(CONFIG),Debug) | |
130 EXECUTABLES=$(OUTDIR)/$(1)_x86_32.nexe $(OUTDIR)/$(1)_x86_64.nexe $(OUTDIR)/$(1) _arm.nexe | |
131 else | |
132 EXECUTABLES=$(OUTDIR)/$(1).pexe | |
133 endif | |
117 $(call LINKER_RULE,$(OUTDIR)/$(1),$(foreach src,$(2),$(call SRC_TO_OBJ,$(src),_p nacl)),$(filter-out pthread,$(3)),$(4),$(LIB_PATHS),$(5)) | 134 $(call LINKER_RULE,$(OUTDIR)/$(1),$(foreach src,$(2),$(call SRC_TO_OBJ,$(src),_p nacl)),$(filter-out pthread,$(3)),$(4),$(LIB_PATHS),$(5)) |
118 endef | 135 endef |
119 | 136 |
120 | 137 |
121 # | 138 # |
122 # Strip Macro | 139 # Strip Macro |
123 # | 140 # |
124 # NOTE: pnacl-strip does not currently support stripping finalized pexes (in a | 141 # NOTE: pnacl-strip does not currently support stripping finalized pexes (in a |
125 # sense, they are already stripped). So we just copy the file instead. | 142 # sense, they are already stripped). So we just copy the file instead. |
126 # | 143 # |
127 # See https://code.google.com/p/nativeclient/issues/detail?id=3534 | 144 # See https://code.google.com/p/nativeclient/issues/detail?id=3534 |
128 # | 145 # |
129 # $1 = Target Name | 146 # $1 = Target Name |
130 # $2 = Input Name | 147 # $2 = Input Name |
131 # | 148 # |
132 define STRIP_RULE | 149 define STRIP_RULE |
133 all: $(OUTDIR)/$(1).pexe | 150 all: $(OUTDIR)/$(1).pexe |
134 $(OUTDIR)/$(1).pexe: $(OUTDIR)/$(2).pexe | 151 $(OUTDIR)/$(1).pexe: $(OUTDIR)/$(2).pexe |
135 $(CP) $$^ $$@ | 152 $(CP) $$^ $$@ |
136 endef | 153 endef |
137 | 154 |
138 | 155 |
156 | |
157 EXECUTABLES=$(foreach arch,$(ARCH_SUFFIXES),$(OUTDIR)/$(1)$(arch)) | |
158 | |
Sam Clegg
2013/08/10 00:54:01
This variable seems to be specified twice.
Does t
noelallen1
2013/08/10 19:08:49
Done.
| |
159 | |
139 # | 160 # |
140 # NMF Manifiest generation | 161 # NMF Manifiest generation |
141 # | 162 # |
142 # Use the python script create_nmf to scan the binaries for dependencies using | 163 # Use the python script create_nmf to scan the binaries for dependencies using |
143 # objdump. Pass in the (-L) paths to the default library toolchains so that we | 164 # objdump. Pass in the (-L) paths to the default library toolchains so that we |
144 # can find those libraries and have it automatically copy the files (-s) to | 165 # can find those libraries and have it automatically copy the files (-s) to |
145 # the target directory for us. | 166 # the target directory for us. |
146 # | 167 # |
147 # $1 = Target Name (the basename of the nmf | 168 # $1 = Target Name (the basename of the nmf |
148 # $2 = Additional create_nmf.py arguments | 169 # $2 = Additional create_nmf.py arguments |
149 # | 170 # |
150 NMF:=python $(NACL_SDK_ROOT)/tools/create_nmf.py | 171 NMF:=python $(NACL_SDK_ROOT)/tools/create_nmf.py |
151 | 172 |
152 define NMF_RULE | 173 define NMF_RULE |
153 all: $(OUTDIR)/$(1).nmf | 174 all: $(OUTDIR)/$(1).nmf |
154 $(OUTDIR)/$(1).nmf: $(OUTDIR)/$(1).pexe | 175 $(OUTDIR)/$(1).nmf: $(EXECUTABLES) |
155 $(call LOG,CREATE_NMF,$$@,$(NMF) -o $$@ $$^ -s $(OUTDIR) $(2)) | 176 $(call LOG,CREATE_NMF,$$@,$(NMF) -o $$@ $$^ -s $(OUTDIR) $(2)) |
156 endef | 177 endef |
157 | 178 |
158 # | 179 # |
159 # HTML file generation | 180 # HTML file generation |
160 # | 181 # |
161 CREATE_HTML := python $(NACL_SDK_ROOT)/tools/create_html.py | 182 CREATE_HTML := python $(NACL_SDK_ROOT)/tools/create_html.py |
162 | 183 |
163 define HTML_RULE | 184 define HTML_RULE |
164 all: $(OUTDIR)/$(1).html | 185 all: $(OUTDIR)/$(1).html |
165 $(OUTDIR)/$(1).html: $(OUTDIR)/$(1).pexe | 186 $(OUTDIR)/$(1).html: $(EXECUTABLES) |
166 $(call LOG,CREATE_HTML,$$@,$(CREATE_HTML) -o $$@ $$^) | 187 $(call LOG,CREATE_HTML,$$@,$(CREATE_HTML) -o $$@ $$^) |
167 endef | 188 endef |
OLD | NEW |