| 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 # Macros for TOOLS |
| 14 # |
| 15 # We use the C++ compiler for everything and then use the -Wl,-as-needed flag |
| 16 # in the linker to drop libc++ unless it's actually needed. |
| 17 # |
| 18 HOST_CC?=gcc |
| 19 HOST_CXX?=g++ |
| 20 HOST_LINK?=g++ |
| 21 HOST_LIB?=ar r |
| 22 |
| 23 |
| 24 LINUX_WARNINGS?=-Wno-long-long |
| 25 LINUX_CCFLAGS=-fPIC -MMD -pthread $(LINUX_WARNINGS) -I$(NACL_SDK_ROOT)/include -
I$(NACL_SDK_ROOT)/include/linux |
| 26 |
| 27 |
| 28 # |
| 29 # Individual Macros |
| 30 # |
| 31 # $1 = Source Name |
| 32 # $2 = Compile Flags |
| 33 # |
| 34 define C_COMPILER_RULE |
| 35 $(OUTDIR)/$(basename $(1)).o : $(1) $(TOP_MAKE) | $(OUTDIR) |
| 36 $(HOST_CC) -o $$@ -c $$< -fPIC $(POSIX_OPT_FLAGS) $(2) $(LINUX_FLAGS) |
| 37 endef |
| 38 |
| 39 define CXX_COMPILER_RULE |
| 40 $(OUTDIR)/$(basename $(1)).o : $(1) $(TOP_MAKE) | $(OUTDIR) |
| 41 $(HOST_CXX) -o $$@ -c $$< -fPIC $(POSIX_OPT_FLAGS) $(2) $(LINUX_FLAGS) |
| 42 endef |
| 43 |
| 44 |
| 45 # $1 = Source Name |
| 46 # $2 = POSIX Compile Flags |
| 47 # $3 = VC Flags (unused) |
| 48 # |
| 49 define COMPILE_RULE |
| 50 ifeq ('.c','$(suffix $(1))') |
| 51 $(call C_COMPILER_RULE,$(1),$(2) $(foreach inc,$(INC_PATHS),-I$(inc))) |
| 52 else |
| 53 $(call CXX_COMPILER_RULE,$(1),$(2) $(foreach inc,$(INC_PATHS),-I$(inc))) |
| 54 endif |
| 55 endef |
| 56 |
| 57 |
| 58 # |
| 59 # SO Macro |
| 60 # |
| 61 # $1 = Target Name |
| 62 # $2 = List of Sources |
| 63 # |
| 64 # |
| 65 define SO_RULE |
| 66 $(error 'Shared libraries not supported by Host') |
| 67 endef |
| 68 |
| 69 |
| 70 # |
| 71 # LIB Macro |
| 72 # |
| 73 # $1 = Target Name |
| 74 # $2 = List of Sources |
| 75 # |
| 76 # |
| 77 define LIB_RULE |
| 78 all:$(NACL_SDK_ROOT)/lib/$(OSNAME)_host/$(CONFIG)/lib$(1).a |
| 79 $(NACL_SDK_ROOT)/lib/$(OSNAME)_host/$(CONFIG)/lib$(1).a : $(foreach src,$(2),$(O
UTDIR)/$(basename $(src)).o) |
| 80 $(MKDIR) -p $(dir $$@) |
| 81 $(HOST_LIB) $$@ $$^ |
| 82 endef |
| 83 |
| 84 |
| 85 # |
| 86 # Link Macro |
| 87 # |
| 88 # $1 = Target Name |
| 89 # $2 = List of inputs |
| 90 # $3 = List of libs |
| 91 # $4 = List of deps |
| 92 # $5 = List of lib dirs |
| 93 # $6 = Other Linker Args |
| 94 # |
| 95 define LINKER_RULE |
| 96 all: $(1) |
| 97 $(1) : $(2) $(4) |
| 98 $(HOST_LINK) -shared -o $(1) $(2) $(foreach path,$(5),-L$(path)/$(OSNAME
)_host)/$(CONFIG) $(foreach lib,$(3),-l$(lib)) $(6) |
| 99 endef |
| 100 |
| 101 |
| 102 # |
| 103 # Link Macro |
| 104 # |
| 105 # $1 = Target Name |
| 106 # $2 = List of Sources |
| 107 # $3 = List of LIBS |
| 108 # $4 = List of DEPS |
| 109 # $5 = POSIX Linker Switches |
| 110 # $6 = VC Linker Switches |
| 111 # |
| 112 define LINK_RULE |
| 113 $(call LINKER_RULE,$(OUTDIR)/$(1)$(HOST_EXT),$(foreach src,$(2),$(OUTDIR)/$(base
name $(src)).o),$(filter-out pthread,$(3)),$(4),$(LIB_PATHS),$(5)) |
| 114 endef |
| 115 |
| 116 |
| 117 # |
| 118 # NMF Manifiest generation |
| 119 # |
| 120 # Use the python script create_nmf to scan the binaries for dependencies using |
| 121 # objdump. Pass in the (-L) paths to the default library toolchains so that we |
| 122 # can find those libraries and have it automatically copy the files (-s) to |
| 123 # the target directory for us. |
| 124 # |
| 125 # $1 = Target Name (the basename of the nmf |
| 126 # $2 = Additional create_nmf.py arguments |
| 127 # |
| 128 NMF:=python $(NACL_SDK_ROOT)/tools/create_nmf.py |
| 129 |
| 130 define NMF_RULE |
| 131 NMF_LIST+=$(OUTDIR)/$(1).nmf |
| 132 $(OUTDIR)/$(1).nmf : $(OUTDIR)/$(1)$(HOST_EXT) |
| 133 @echo "Host Toolchain" > $$@ |
| 134 endef |
| 135 |
| 136 all : $(LIB_LIST) $(DEPS_LIST) $(NMF_LIST) |
| 137 |
| OLD | NEW |