Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(288)

Side by Side Diff: native_client_sdk/src/tools/host_gcc.mk

Issue 11882012: Convert all project to use common.mk (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix missing common.mk path Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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=-MMD -pthread $(LINUX_WARNINGS) -I$(NACL_SDK_ROOT)/include -I$(NAC L_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 $$< $(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 $$< $(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 # LIB Macro
60 #
61 # $1 = Target Name
62 # $2 = List of Sources
63 #
64 #
65 define ARCHIVE_RULE
binji 2013/01/16 22:46:55 why do you need a separate macro? Can't this all l
noelallen1 2013/01/16 23:21:10 Done.
66 all:$(NACL_SDK_ROOT)/lib/$(OSNAME)_host/$(CONFIG)/lib$(1).a
67 $(NACL_SDK_ROOT)/lib/$(OSNAME)_host/$(CONFIG)/lib$(1).a : $(foreach src,$(2),$(O UTDIR)/$(basename $(src)).o)
68 $(MKDIR) -p $(dir $$@)
69 $(HOST_LIB) $$@ $$^
70 endef
71
72
73 define LIB_RULE
74 $(call ARCHIVE_RULE,$(1),$(2))
75 endef
76
77
78
79 #
80 # 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 $(HOST_LINK) -shared -o $(1) $(2) $(foreach path,$(5),-L$(path)) $(forea ch lib,$(3),-l$(lib)) $(6)
93 endef
94
95
96 #
97 # Link Macro
98 #
99 # $1 = Target Name
100 # $2 = List of Sources
101 # $3 = List of LIBS
102 # $4 = List of DEPS
103 # $5 = POSIX Linker Switches
104 # $6 = VC Linker Switches
105 #
106 define LINK_RULE
107 $(call LINER_RULE,$(OUTDIR)/$(1)$(HOST_EXT),$(foreach src,$(2),$(OUTDIR)/$(basen ame $(src)).o),$(3),$(4),$(LIB_PATHS),$(5))
binji 2013/01/16 22:46:55 LINKER_RULE
noelallen1 2013/01/16 23:21:10 Done.
108 endef
109
110
111 #
112 # NMF Manifiest generation
113 #
114 # Use the python script create_nmf to scan the binaries for dependencies using
115 # objdump. Pass in the (-L) paths to the default library toolchains so that we
116 # can find those libraries and have it automatically copy the files (-s) to
117 # the target directory for us.
118 #
119 # $1 = Target Name (the basename of the nmf
120 # $2 = Additional create_nmf.py arguments
121 #
122 NMF:=python $(NACL_SDK_ROOT)/tools/create_nmf.py
123
124 define NMF_RULE
125 NMF_LIST+=$(OUTDIR)/$(1).nmf
126 $(OUTDIR)/$(1).nmf : $(OUTDIR)/$(1)$(HOST_EXT)
127 @echo "Host Toolchain" > $$@
128 endef
129
130 all : $(LIB_LIST) $(DEPS_LIST) $(NMF_LIST)
131
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698