| OLD | NEW |
| 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 PNACL_TRANSLATE ?= $(PNACL_BIN)/pnacl-translate |
| 20 | 21 |
| 21 # | 22 # |
| 22 # Compile Macro | 23 # Compile Macro |
| 23 # | 24 # |
| 24 # $1 = Source Name | 25 # $1 = Source Name |
| 25 # $2 = Compile Flags | 26 # $2 = Compile Flags |
| 26 # $3 = Include Directories | 27 # $3 = Include Directories |
| 27 # | 28 # |
| 28 define C_COMPILER_RULE | 29 define C_COMPILER_RULE |
| 29 -include $(call SRC_TO_DEP,$(1),_pnacl) | 30 -include $(call SRC_TO_DEP,$(1),_pnacl) |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 # | 87 # |
| 87 # Specific Link Macro | 88 # Specific Link Macro |
| 88 # | 89 # |
| 89 # $1 = Target Name | 90 # $1 = Target Name |
| 90 # $2 = List of inputs | 91 # $2 = List of inputs |
| 91 # $3 = List of libs | 92 # $3 = List of libs |
| 92 # $4 = List of deps | 93 # $4 = List of deps |
| 93 # $5 = List of lib dirs | 94 # $5 = List of lib dirs |
| 94 # $6 = Other Linker Args | 95 # $6 = Other Linker Args |
| 95 # | 96 # |
| 97 # For debugging, we translate the pre-finalized .bc file. |
| 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) --allow-llvm-bitcode-input -
arch x86-32 $$^ -o $$@) |
| 103 |
| 104 $(1)_x86_64.nexe : $(1).bc |
| 105 » $(call LOG,TRANSLATE,$$@,$(PNACL_TRANSLATE) --allow-llvm-bitcode-input -
arch x86-64 $$^ -o $$@) |
| 106 |
| 107 $(1)_arm.nexe : $(1).bc |
| 108 » $(call LOG,TRANSLATE,$$@,$(PNACL_TRANSLATE) --allow-llvm-bitcode-input -
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 # |
| 128 # NOTE: For Debug builds we translate the .bc file to a .nexe instead of |
| 129 # using the finalizing to a .pexe. This enables debugging. |
| 130 # |
| 116 define LINK_RULE | 131 define LINK_RULE |
| 132 ifeq ($(CONFIG),Debug) |
| 133 EXECUTABLES=$(OUTDIR)/$(1)_x86_32.nexe $(OUTDIR)/$(1)_x86_64.nexe $(OUTDIR)/$(1)
_arm.nexe |
| 134 else |
| 135 EXECUTABLES=$(OUTDIR)/$(1).pexe |
| 136 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)) | 137 $(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 | 138 endef |
| 119 | 139 |
| 120 | 140 |
| 121 # | 141 # |
| 122 # Strip Macro | 142 # Strip Macro |
| 123 # | 143 # |
| 124 # NOTE: pnacl-strip does not currently support stripping finalized pexes (in a | 144 # 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. | 145 # sense, they are already stripped). So we just copy the file instead. |
| 126 # | 146 # |
| (...skipping 17 matching lines...) Expand all Loading... |
| 144 # can find those libraries and have it automatically copy the files (-s) to | 164 # can find those libraries and have it automatically copy the files (-s) to |
| 145 # the target directory for us. | 165 # the target directory for us. |
| 146 # | 166 # |
| 147 # $1 = Target Name (the basename of the nmf | 167 # $1 = Target Name (the basename of the nmf |
| 148 # $2 = Additional create_nmf.py arguments | 168 # $2 = Additional create_nmf.py arguments |
| 149 # | 169 # |
| 150 NMF:=python $(NACL_SDK_ROOT)/tools/create_nmf.py | 170 NMF:=python $(NACL_SDK_ROOT)/tools/create_nmf.py |
| 151 | 171 |
| 152 define NMF_RULE | 172 define NMF_RULE |
| 153 all: $(OUTDIR)/$(1).nmf | 173 all: $(OUTDIR)/$(1).nmf |
| 154 $(OUTDIR)/$(1).nmf: $(OUTDIR)/$(1).pexe | 174 $(OUTDIR)/$(1).nmf: $(EXECUTABLES) |
| 155 $(call LOG,CREATE_NMF,$$@,$(NMF) -o $$@ $$^ -s $(OUTDIR) $(2)) | 175 $(call LOG,CREATE_NMF,$$@,$(NMF) -o $$@ $$^ -s $(OUTDIR) $(2)) |
| 156 endef | 176 endef |
| 157 | 177 |
| 158 # | 178 # |
| 159 # HTML file generation | 179 # HTML file generation |
| 160 # | 180 # |
| 161 CREATE_HTML := python $(NACL_SDK_ROOT)/tools/create_html.py | 181 CREATE_HTML := python $(NACL_SDK_ROOT)/tools/create_html.py |
| 162 | 182 |
| 163 define HTML_RULE | 183 define HTML_RULE |
| 164 all: $(OUTDIR)/$(1).html | 184 all: $(OUTDIR)/$(1).html |
| 165 $(OUTDIR)/$(1).html: $(OUTDIR)/$(1).pexe | 185 $(OUTDIR)/$(1).html: $(EXECUTABLES) |
| 166 $(call LOG,CREATE_HTML,$$@,$(CREATE_HTML) -o $$@ $$^) | 186 $(call LOG,CREATE_HTML,$$@,$(CREATE_HTML) -o $$@ $$^) |
| 167 endef | 187 endef |
| 168 | 188 |
| 169 | 189 |
| 170 # | 190 # |
| 171 # Determine which executable to pass into the debugger. For pnacl, this is | 191 # Determine which executable to pass into the debugger. For pnacl, this is |
| 172 # the .bc -> .nexe translated app. | 192 # the .bc -> .nexe translated app. |
| 173 # | 193 # |
| 174 GDB_DEBUG_TARGET = $(abspath $(OUTDIR))/$(TARGET)_$(SYSARCH).nexe | 194 GDB_DEBUG_TARGET = $(abspath $(OUTDIR))/$(TARGET)_$(SYSARCH).nexe |
| OLD | NEW |