| 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_CC := $(shell $(NACL_CONFIG) -t $(TOOLCHAIN) --tool=cc) | 13 PNACL_CC := $(shell $(NACL_CONFIG) -t $(TOOLCHAIN) --tool=cc) |
| 14 PNACL_CXX := $(shell $(NACL_CONFIG) -t $(TOOLCHAIN) --tool=c++) | 14 PNACL_CXX := $(shell $(NACL_CONFIG) -t $(TOOLCHAIN) --tool=c++) |
| 15 PNACL_LINK := $(shell $(NACL_CONFIG) -t $(TOOLCHAIN) --tool=c++) | 15 PNACL_LINK := $(shell $(NACL_CONFIG) -t $(TOOLCHAIN) --tool=c++) |
| 16 PNACL_LIB := $(shell $(NACL_CONFIG) -t $(TOOLCHAIN) --tool=ar) | 16 PNACL_LIB := $(shell $(NACL_CONFIG) -t $(TOOLCHAIN) --tool=ar) |
| 17 PNACL_STRIP := $(shell $(NACL_CONFIG) -t $(TOOLCHAIN) --tool=strip) | 17 PNACL_STRIP := $(shell $(NACL_CONFIG) -t $(TOOLCHAIN) --tool=strip) |
| 18 PNACL_FINALIZE := $(shell $(NACL_CONFIG) -t $(TOOLCHAIN) --tool=finalize) | 18 PNACL_FINALIZE := $(shell $(NACL_CONFIG) -t $(TOOLCHAIN) --tool=finalize) |
| 19 PNACL_TRANSLATE := $(shell $(NACL_CONFIG) -t $(TOOLCHAIN) --tool=translate) |
| 19 | 20 |
| 20 # | 21 # |
| 21 # Compile Macro | 22 # Compile Macro |
| 22 # | 23 # |
| 23 # $1 = Source Name | 24 # $1 = Source Name |
| 24 # $2 = Compile Flags | 25 # $2 = Compile Flags |
| 25 # $3 = Include Directories | 26 # $3 = Include Directories |
| 26 # | 27 # |
| 27 define C_COMPILER_RULE | 28 define C_COMPILER_RULE |
| 28 -include $(call SRC_TO_DEP,$(1)) | 29 -include $(call SRC_TO_DEP,$(1)) |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 # $5 = List of lib dirs | 94 # $5 = List of lib dirs |
| 94 # $6 = Other Linker Args | 95 # $6 = Other Linker Args |
| 95 # | 96 # |
| 96 define LINKER_RULE | 97 define LINKER_RULE |
| 97 all: $(1).pexe | 98 all: $(1).pexe |
| 98 $(1).pexe: $(1).bc | 99 $(1).pexe: $(1).bc |
| 99 $(call LOG,FINALIZE,$$@,$(PNACL_FINALIZE) -o $$@ $$^) | 100 $(call LOG,FINALIZE,$$@,$(PNACL_FINALIZE) -o $$@ $$^) |
| 100 | 101 |
| 101 $(1).bc: $(2) $(foreach dep,$(4),$(STAMPDIR)/$(dep).stamp) | 102 $(1).bc: $(2) $(foreach dep,$(4),$(STAMPDIR)/$(dep).stamp) |
| 102 $(call LOG,LINK,$$@,$(PNACL_LINK) -o $$@ $(2) $(PNACL_LDFLAGS) $(foreach
path,$(5),-L$(path)/pnacl/$(CONFIG)) $(foreach lib,$(3),-l$(lib)) $(6)) | 103 $(call LOG,LINK,$$@,$(PNACL_LINK) -o $$@ $(2) $(PNACL_LDFLAGS) $(foreach
path,$(5),-L$(path)/pnacl/$(CONFIG)) $(foreach lib,$(3),-l$(lib)) $(6)) |
| 104 |
| 105 $(1)_x86_32.nexe: $(1).bc |
| 106 $(call LOG,TRANSLATE,$$@,$(PNACL_TRANSLATE) --allow-llvm-bitcode-input -
arch x86-32 $$^ -o $$@) |
| 107 |
| 108 $(1)_x86_64.nexe: $(1).bc |
| 109 $(call LOG,TRANSLATE,$$@,$(PNACL_TRANSLATE) --allow-llvm-bitcode-input -
arch x86-64 $$^ -o $$@) |
| 110 |
| 111 $(1)_arm.nexe: $(1).bc |
| 112 $(call LOG,TRANSLATE,$$@,$(PNACL_TRANSLATE) --allow-llvm-bitcode-input -
arch arm $$^ -o $$@) |
| 103 endef | 113 endef |
| 104 | 114 |
| 105 | 115 |
| 106 # | 116 # |
| 107 # Generalized Link Macro | 117 # Generalized Link Macro |
| 108 # | 118 # |
| 109 # $1 = Target Name | 119 # $1 = Target Name |
| 110 # $2 = List of Sources | 120 # $2 = List of Sources |
| 111 # $3 = List of LIBS | 121 # $3 = List of LIBS |
| 112 # $4 = List of DEPS | 122 # $4 = List of DEPS |
| (...skipping 11 matching lines...) Expand all Loading... |
| 124 # NOTE: pnacl-strip does not really do much for finalized pexes (in a | 134 # NOTE: pnacl-strip does not really do much for finalized pexes (in a |
| 125 # sense, they are already stripped), but set this rule up for uniformity. | 135 # sense, they are already stripped), but set this rule up for uniformity. |
| 126 # | 136 # |
| 127 # $1 = Target Name | 137 # $1 = Target Name |
| 128 # $2 = Input Name | 138 # $2 = Input Name |
| 129 # | 139 # |
| 130 define STRIP_RULE | 140 define STRIP_RULE |
| 131 all: $(OUTDIR)/$(1).pexe | 141 all: $(OUTDIR)/$(1).pexe |
| 132 $(OUTDIR)/$(1).pexe: $(OUTDIR)/$(2).pexe | 142 $(OUTDIR)/$(1).pexe: $(OUTDIR)/$(2).pexe |
| 133 $(call LOG,STRIP,$$@,$(PNACL_STRIP) $$^ -o $$@) | 143 $(call LOG,STRIP,$$@,$(PNACL_STRIP) $$^ -o $$@) |
| 144 |
| 145 $(OUTDIR)/$(1)_x86_32.nexe: $(OUTDIR)/$(2)_x86_32.nexe |
| 146 $(call LOG,STRIP,$$@,$(PNACL_STRIP) $$^ -o $$@) |
| 147 |
| 148 $(OUTDIR)/$(1)_x86_64.nexe: $(OUTDIR)/$(2)_x86_64.nexe |
| 149 $(call LOG,STRIP,$$@,$(PNACL_STRIP) $$^ -o $$@) |
| 150 |
| 151 $(OUTDIR)/$(1)_arm.nexe: $(OUTDIR)/$(2)_arm.nexe |
| 152 $(call LOG,STRIP,$$@,$(PNACL_STRIP) $$^ -o $$@) |
| 134 endef | 153 endef |
| 135 | 154 |
| 136 | 155 |
| 137 # | 156 # |
| 138 # NMF Manifest generation | 157 # NMF Manifest generation |
| 139 # | 158 # |
| 140 # Use the python script create_nmf to scan the binaries for dependencies using | 159 # Use the python script create_nmf to scan the binaries for dependencies using |
| 141 # objdump. Pass in the (-L) paths to the default library toolchains so that we | 160 # objdump. Pass in the (-L) paths to the default library toolchains so that we |
| 142 # can find those libraries and have it automatically copy the files (-s) to | 161 # can find those libraries and have it automatically copy the files (-s) to |
| 143 # the target directory for us. | 162 # the target directory for us. |
| (...skipping 14 matching lines...) Expand all Loading... |
| 158 # | 177 # |
| 159 # HTML file generation | 178 # HTML file generation |
| 160 # | 179 # |
| 161 CREATE_HTML := python $(NACL_SDK_ROOT)/tools/create_html.py | 180 CREATE_HTML := python $(NACL_SDK_ROOT)/tools/create_html.py |
| 162 | 181 |
| 163 define HTML_RULE | 182 define HTML_RULE |
| 164 all: $(OUTDIR)/$(1).html | 183 all: $(OUTDIR)/$(1).html |
| 165 $(OUTDIR)/$(1).html: $(EXECUTABLES) | 184 $(OUTDIR)/$(1).html: $(EXECUTABLES) |
| 166 $(call LOG,CREATE_HTML,$$@,$(CREATE_HTML) -o $$@ $$^) | 185 $(call LOG,CREATE_HTML,$$@,$(CREATE_HTML) -o $$@ $$^) |
| 167 endef | 186 endef |
| 187 |
| 188 |
| 189 ifdef STANDALONE |
| 190 run: $(OUTDIR)/$(TARGET)_$(NACL_ARCH).nexe |
| 191 ifndef NACL_ARCH |
| 192 $(error Cannot run in sel_ldr unless $$NACL_ARCH is set) |
| 193 endif |
| 194 $(SEL_LDR_PATH) $(SEL_LDR_ARGS) $(OUTDIR)/$(TARGET)_$(NACL_ARCH).nexe --
$(EXE_ARGS) |
| 195 |
| 196 debug: $(OUTDIR)/$(TARGET)_$(NACL_ARCH).nexe |
| 197 ifndef NACL_ARCH |
| 198 $(error Cannot run in sel_ldr unless $$NACL_ARCH is set) |
| 199 endif |
| 200 $(SEL_LDR_PATH) -d $(SEL_LDR_ARGS) $(OUTDIR)/$(TARGET)_$(NACL_ARCH).nexe
-- $(EXE_ARGS) |
| 201 endif |
| OLD | NEW |