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.
6 # GNU Make based build file. For details on GNU Make see:
7 # http://www.gnu.org/software/make/manual/make.html
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.
24 LINUX_WARNINGS?
=-Wno-long-long
25 LINUX_CCFLAGS
=-fPIC
-pthread
$(LINUX_WARNINGS
) -I
$(NACL_SDK_ROOT
)/include -I
$(NACL_SDK_ROOT
)/include/linux
34 define C_COMPILER_RULE
35 $(OUTDIR
)/$(basename $(1)).o
: $(1) $(TOP_MAKE
) |
$(OUTDIR
)
36 $(HOST_CC
) -o
$$@
-c
$$< -fPIC
$(POSIX_FLAGS
) $(2) $(LINUX_FLAGS
)
39 define CXX_COMPILER_RULE
40 $(OUTDIR
)/$(basename $(1)).o
: $(1) $(TOP_MAKE
) |
$(OUTDIR
)
41 $(HOST_CXX
) -o
$$@
-c
$$< -fPIC
$(POSIX_FLAGS
) $(2) $(LINUX_FLAGS
)
46 # $2 = POSIX Compile Flags
47 # $3 = VC Flags (unused)
50 ifeq ('.c','$(suffix $(1))')
51 $(call C_COMPILER_RULE
,$(1),$(2) $(foreach inc
,$(INC_PATHS
),-I
$(inc
)))
53 $(call CXX_COMPILER_RULE
,$(1),$(2) $(foreach inc
,$(INC_PATHS
),-I
$(inc
)))
62 # $2 = List of Sources
66 $(error
'Shared libraries not supported by Host')
74 # $2 = List of Sources
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),$(OUTDIR
)/$(basename $(src
)).o
)
80 $(MKDIR
) -p
$$(dir $$@
)
92 # $5 = List of lib dirs
93 # $6 = Other Linker Args
98 $(HOST_LINK
) -shared
-o
$(1) $(2) $(foreach path
,$(5),-L
$(path
)/$(OSNAME
)_host
)/$(CONFIG
) $(foreach lib
,$(3),-l
$(lib
)) $(6)
106 # $2 = List of Sources
109 # $5 = POSIX Linker Switches
110 # $6 = VC Linker Switches
113 $(call LINKER_RULE
,$(OUTDIR
)/$(1)$(HOST_EXT
),$(foreach src
,$(2),$(OUTDIR
)/$(basename $(src
)).o
),$(filter-out pthread
,$(3)),$(4),$(LIB_PATHS
),$(5))
118 # NMF Manifiest generation
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.
125 # $1 = Target Name (the basename of the nmf
126 # $2 = Additional create_nmf.py arguments
128 NMF
:=python
$(NACL_SDK_ROOT
)/tools
/create_nmf.py
131 NMF_LIST
+=$(OUTDIR
)/$(1).nmf
132 $(OUTDIR
)/$(1).nmf
: $(OUTDIR
)/$(1)$(HOST_EXT
)
133 @echo
"Host Toolchain" > $$@
136 all : $(LIB_LIST
) $(DEPS_LIST
) $(NMF_LIST
)