Chromium Code Reviews| 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?=cl.exe /nologo /WX | |
| 19 HOST_CXX?=cl.exe /nologo /EHsc /WX | |
| 20 HOST_LINK?=link.exe /nologo | |
| 21 HOST_LIB?=lib.exe /nologo | |
| 22 | |
| 23 | |
| 24 ifeq ('Debug','$(CONFIG)') | |
| 25 WIN_OPT_FLAGS?=/Od /MTd /Z7 | |
| 26 else | |
| 27 WIN_OPT_FLAGS?=/O2 /MT /Z7 | |
| 28 endif | |
| 29 | |
| 30 | |
| 31 # | |
| 32 # Individual Macros | |
| 33 # | |
| 34 # $1 = Source Name | |
| 35 # $2 = Compile Flags | |
| 36 # | |
| 37 define C_COMPILER_RULE | |
| 38 $(OUTDIR)/$(basename $(1)).o : $(1) $(TOP_MAKE) | $(OUTDIR) | |
| 39 $(HOST_CC) /Fo$$@ /c $$< $(WIN_OPT_FLAGS) $(2) $(LINUX_FLAGS) | |
| 40 endef | |
| 41 | |
| 42 define CXX_COMPILER_RULE | |
| 43 $(OUTDIR)/$(basename $(1)).o : $(1) $(TOP_MAKE) | $(OUTDIR) | |
| 44 $(HOST_CXX) -o $$@ -c $$< $(WIN_OPT_FLAGS) $(2) $(LINUX_FLAGS) | |
| 45 endef | |
| 46 | |
| 47 | |
| 48 # $1 = Source Name | |
| 49 # $2 = POSIX Compile Flags (unused) | |
| 50 # $3 = VC Compile Flags | |
| 51 # | |
| 52 define COMPILE_RULE | |
| 53 ifeq ('.c','$(suffix $(1))') | |
| 54 $(call C_COMPILER_RULE,$(1),$(3) $(foreach inc,$(INC_PATHS),/I$(inc))) | |
| 55 else | |
| 56 $(call CXX_COMPILER_RULE,$(1),$(3) $(foreach inc,$(INC_PATHS),/I$(inc))) | |
| 57 endif | |
| 58 endef | |
| 59 | |
| 60 | |
| 61 # | |
| 62 # LIB Macro | |
| 63 # | |
| 64 # $1 = Target Name | |
| 65 # $2 = List of Sources | |
| 66 # | |
| 67 # | |
| 68 define ARCHIVE_RULE | |
| 69 all:$(NACL_SDK_ROOT)/lib/$(OSNAME)_host/$(CONFIG)/$(1).lib | |
| 70 $(NACL_SDK_ROOT)/lib/$(OSNAME)_host/$(CONFIG)/$(1).lib : $(foreach src,$(2),$(OU TDIR)/$(basename $(src)).o) | |
| 71 $(MKDIR) -p $(dir $$@) | |
| 72 $(HOST_LIB) $$@ $$^ $(WIN_LDFLAGS) | |
| 73 endef | |
| 74 | |
| 75 define LIB_RULE | |
| 76 $(call ARCHIVE_RULE,$(1),$(2)) | |
| 77 endef | |
| 78 | |
| 79 | |
| 80 | |
| 81 # | |
| 82 # Link Macro | |
| 83 # | |
| 84 # $1 = Target Name | |
| 85 # $2 = List of inputs | |
| 86 # $3 = List of libs | |
| 87 # $4 = List of deps | |
| 88 # $5 = List of lib dirs | |
| 89 # $6 = Other Linker Args | |
| 90 # | |
| 91 define LINKER_RULE | |
| 92 all: $(1) | |
| 93 $(1) : $(2) $(4) | |
| 94 $(HOST_LINK) /DLL /OUT:$(1) /PDB:$(1).pdb $(2) /DEBUG $(foreach path,$(5 ),/LIBPATH:$(path)) $(foreach lib,$(3),$(lib.lib)) $(6) | |
| 95 endef | |
| 96 | |
| 97 | |
| 98 # | |
| 99 # Link Macro | |
| 100 # | |
| 101 # $1 = Target Name | |
| 102 # $2 = List of Sources | |
| 103 # $3 = List of LIBS | |
| 104 # $4 = List of DEPS | |
| 105 # $5 = POSIX Linker Switches | |
| 106 # $6 = VC Linker Switches | |
| 107 # | |
| 108 define LINK_RULE | |
| 109 $(call LINER_RULE,$(OUTDIR)/$(1)$(HOST_EXT),$(foreach src,$(2),$(OUTDIR)/$(basen ame $(src)).o),$(3),$(4),$(LIB_PATHS),$(6)) | |
|
binji
2013/01/16 22:46:55
LINKER_RULE
noelallen1
2013/01/16 23:21:10
Done.
| |
| 110 endef | |
| 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 NMF_LIST+=$(OUTDIR)/$(1).nmf | |
| 128 $(OUTDIR)/$(1).nmf : $(OUTDIR)/$(1)$(HOST_EXT) | |
| 129 @echo "Host Toolchain" > $$@ | |
| 130 endef | |
| 131 | |
| 132 all : $(LIB_LIST) $(DEPS_LIST) $(NMF_LIST) | |
| 133 | |
| OLD | NEW |