Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
|
binji
2013/01/16 22:46:55
maybe should be called nacl_pnacl instead...?
noelallen1
2013/01/16 23:21:10
I'll do rename as a seperate CL to make it cleaner
| |
| 2 # Use of this source code is governed by a BSD-style license that can be | |
| 3 # found in the LICENSE file. | |
| 4 | |
| 5 # | |
| 6 # GNU Make based build file. For details on GNU Make see: | |
| 7 # http://www.gnu.org/software/make/manual/make.html | |
| 8 # | |
| 9 # | |
| 10 | |
| 11 | |
| 12 # | |
| 13 # Library Paths | |
| 14 # | |
| 15 # Libraries are stored in different directories for each achitecture as well | |
| 16 # as different subdirectories for Debug vs Release configurations. This make | |
| 17 # only supports the Debug configuration for simplicity. | |
|
binji
2013/01/16 22:46:55
comment is wrong
noelallen1
2013/01/16 23:21:10
Done.
| |
| 18 # | |
| 19 # By default for x86 32 bit this expands to: | |
| 20 # $(NACL_SDK_ROOT)/lib/newlib_x86_32/Debug | |
| 21 # | |
| 22 LD_PNACL:=-L$(NACL_SDK_ROOT)/lib/pnacl/$(CONFIG) | |
| 23 | |
| 24 | |
| 25 # | |
| 26 # Macros for TOOLS | |
| 27 # | |
| 28 # We use the C++ compiler for everything and then use the -Wl,-as-needed flag | |
|
binji
2013/01/16 22:46:55
comment is wrong
noelallen1
2013/01/16 23:21:10
Done.
| |
| 29 # in the linker to drop libc++ unless it's actually needed. | |
| 30 # | |
| 31 PNACL_CC?=$(TC_PATH)/$(OSNAME)_x86_$(TOOLCHAIN)/newlib/bin/pnacl-clang -c | |
| 32 PNACL_CXX?=$(TC_PATH)/$(OSNAME)_x86_$(TOOLCHAIN)/newlib/bin/pnacl-clang++ -c | |
| 33 PNACL_LINK?=$(TC_PATH)/$(OSNAME)_x86_$(TOOLCHAIN)/newlib/bin/pnacl-clang++ | |
| 34 PNACL_LIB?=$(TC_PATH)/$(OSNAME)_x86_$(TOOLCHAIN)/newlib/bin/pnacl-ar r | |
| 35 | |
| 36 | |
| 37 # | |
| 38 # Compile Macro | |
| 39 # | |
| 40 # $1 = Source Name | |
| 41 # $2 = Compile Flags | |
| 42 # $3 = Include Directories | |
| 43 # | |
| 44 define C_COMPILER_RULE | |
| 45 $(OUTDIR)/$(basename $(1))_pnacl.o : $(1) $(TOP_MAKE) | $(OUTDIR) | |
| 46 $(PNACL_CC) -o $$@ -c $$< $(POSIX_OPT_FLAGS) $(2) $(NACL_CFLAGS) | |
| 47 endef | |
| 48 | |
| 49 define CXX_COMPILER_RULE | |
| 50 $(OUTDIR)/$(basename $(1))_pnacl.o : $(1) $(TOP_MAKE) | $(OUTDIR) | |
| 51 $(PNACL_CXX) -o $$@ -c $$< $(POSIX_OPT_FLAGS) $(2) $(NACL_CFLAGS) | |
| 52 endef | |
| 53 | |
| 54 | |
| 55 # $1 = Source Name | |
| 56 # $2 = POSIX Compile Flags | |
| 57 # $3 = Include Directories | |
| 58 # $4 = VC Flags (unused) | |
| 59 define COMPILE_RULE | |
| 60 ifeq ('.c','$(suffix $(1))') | |
| 61 $(call C_COMPILER_RULE,$(1),$(2) -I$(NACL_SDK_ROOT)/include $(foreach inc,$(3),- I$(inc))) | |
| 62 else | |
| 63 $(call CXX_COMPILER_RULE,$(1),$(2) -I$(NACL_SDK_ROOT)/include $(foreach inc,$(3) ,-I$(inc))) | |
| 64 endif | |
| 65 endef | |
| 66 | |
| 67 | |
| 68 # | |
| 69 # SO Macro | |
| 70 # | |
| 71 # $1 = Target Name | |
| 72 # $2 = List of Sources | |
| 73 # | |
| 74 # | |
| 75 GLIBC_REMAP:= | |
| 76 | |
| 77 define SO_RULE | |
| 78 $(error 'Shared libraries not supported by PNaCl') | |
| 79 endef | |
| 80 | |
| 81 | |
| 82 # | |
| 83 # LIB Macro | |
| 84 # | |
| 85 # $1 = Target Name | |
| 86 # $2 = List of Sources | |
| 87 # $3 = POSIX Link Flags | |
| 88 # $4 = VC Link Flags (unused) | |
| 89 define LIB_RULE | |
| 90 all: $(NACL_SDK_ROOT)/lib/$(TOOLCHAIN)/$(CONFIG)/lib$(1).a | |
| 91 $(NACL_SDK_ROOT)/lib/$(TOOLCHAIN)/$(CONFIG)/lib$(1).a : $(foreach src,$(2),$(OUT DIR)/$(basename $(src))_pnacl.o) | |
| 92 $(MKDIR) -p $$(dir $$@) | |
| 93 $(PNACL_LIB) $$@ $$^ $(3) | |
| 94 endef | |
| 95 | |
| 96 | |
| 97 # | |
| 98 # Link Macro | |
| 99 # | |
| 100 # $1 = Target Name | |
| 101 # $2 = List of Sources | |
| 102 # $3 = List of LIBS | |
| 103 # $4 = List of DEPS | |
| 104 # $5 = POSIX Link Flags | |
| 105 # $6 = VC Link Flags (unused) | |
| 106 # | |
| 107 define LINK_RULE | |
| 108 NMF_TARGETS+=$(OUTDIR)/$(1).pexe | |
| 109 $(OUTDIR)/$(1).pexe : $(foreach src,$(2),$(OUTDIR)/$(basename $(src))_pnacl.o) $ (4) | |
| 110 $(PNACL_LINK) -o $$@ $$(filter-out $(4),$$^) $(LD_PNACL) $$(LD_FLAGS) $( foreach lib,$(3),-l$(lib)) $(5) | |
| 111 endef | |
| 112 | |
| 113 | |
| 114 # | |
| 115 # Generate NMF_TARGETS | |
| 116 # | |
| 117 NMF_ARCHES:=.pexe | |
| 118 | |
| 119 | |
| 120 # | |
| 121 # NMF Manifiest generation | |
| 122 # | |
| 123 # Use the python script create_nmf to scan the binaries for dependencies using | |
| 124 # objdump. Pass in the (-L) paths to the default library toolchains so that we | |
| 125 # can find those libraries and have it automatically copy the files (-s) to | |
| 126 # the target directory for us. | |
| 127 # | |
| 128 # $1 = Target Name (the basename of the nmf | |
| 129 # $2 = Additional create_nmf.py arguments | |
| 130 # | |
| 131 NMF:=python $(NACL_SDK_ROOT)/tools/create_nmf.py | |
| 132 | |
| 133 define NMF_RULE | |
| 134 all:$(OUTDIR)/$(1).nmf | |
| 135 $(OUTDIR)/$(1).nmf : $(foreach arch,$(NMF_ARCHES),$(OUTDIR)/$(1)$(arch)) | |
| 136 $(NMF) -o $$@ $$^ -s $(OUTDIR) $(2) | |
| 137 endef | |
| 138 | |
| 139 | |
| OLD | NEW |