| OLD | NEW |
| (Empty) | |
| 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. |
| 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 # Paths to Tools |
| 14 # |
| 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 |
| 19 |
| 20 |
| 21 # |
| 22 # Compile Macro |
| 23 # |
| 24 # $1 = Source Name |
| 25 # $2 = Compile Flags |
| 26 # $3 = Include Directories |
| 27 # |
| 28 define C_COMPILER_RULE |
| 29 $(OUTDIR)/$(basename $(1))_pnacl.o : $(1) $(TOP_MAKE) | $(OUTDIR) |
| 30 $(PNACL_CC) -o $$@ -c $$< $(POSIX_OPT_FLAGS) $(2) $(NACL_CFLAGS) |
| 31 endef |
| 32 |
| 33 define CXX_COMPILER_RULE |
| 34 $(OUTDIR)/$(basename $(1))_pnacl.o : $(1) $(TOP_MAKE) | $(OUTDIR) |
| 35 $(PNACL_CXX) -o $$@ -c $$< $(POSIX_OPT_FLAGS) $(2) $(NACL_CFLAGS) |
| 36 endef |
| 37 |
| 38 |
| 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 |
| 50 |
| 51 |
| 52 # |
| 53 # SO Macro |
| 54 # |
| 55 # $1 = Target Name |
| 56 # $2 = List of Sources |
| 57 # |
| 58 # |
| 59 define SO_RULE |
| 60 $(error 'Shared libraries not supported by PNaCl') |
| 61 endef |
| 62 |
| 63 |
| 64 # |
| 65 # LIB Macro |
| 66 # |
| 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),$(OUT
DIR)/$(basename $(src))_pnacl.o) |
| 74 $(MKDIR) -p $$(dir $$@) |
| 75 $(PNACL_LIB) $$@ $$^ $(3) |
| 76 endef |
| 77 |
| 78 |
| 79 # |
| 80 # Specific Link Macro |
| 81 # |
| 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 |
| 88 # |
| 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 |
| 94 |
| 95 |
| 96 |
| 97 # |
| 98 # Generalized 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 Linker Switches |
| 105 # $6 = VC Linker Switches |
| 106 # |
| 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 |
| 110 |
| 111 |
| 112 |
| 113 # |
| 114 # NMF Manifiest generation |
| 115 # |
| 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. |
| 120 # |
| 121 # $1 = Target Name (the basename of the nmf |
| 122 # $2 = Additional create_nmf.py arguments |
| 123 # |
| 124 NMF:=python $(NACL_SDK_ROOT)/tools/create_nmf.py |
| 125 |
| 126 define NMF_RULE |
| 127 all:$(OUTDIR)/$(1).nmf |
| 128 $(OUTDIR)/$(1).nmf : $(OUTDIR)/$(1).pexe |
| 129 $(NMF) -o $$@ $$^ -s $(OUTDIR) $(2) |
| 130 endef |
| 131 |
| 132 |
| OLD | NEW |