Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
83 lines (69 loc) · 2.22 KB
/
Copy pathMakefile
File metadata and controls
83 lines (69 loc) · 2.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#
# SPDX-FileCopyrightText: Copyright (c) 2015-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
# See LICENSE.txt for more license information
#
.PHONY: all clean ir-emit
# Every goal in this Makefile recurses into a sub-directory, and several of
# those sub-makes write to shared locations (build/include, build/lib,
# build/test/gtest.a, build/test/os, ...). Run the top-level goals serially so
# two sub-makes never race on those files, e.g.
# `make -j test.perf.build test.apitest.build`. Each sub-make still runs its
# own recipes in parallel with the -j setting passed down through the jobserver.
.NOTPARALLEL:
NCCL_EMIT_LLVM_IR ?= 0
NCCL_EMIT_LTO_IR ?= 0
# Set up one make target to avoid race
IR_GOALS :=
ifneq ($(NCCL_EMIT_LLVM_IR), 0)
IR_GOALS += llvm_ir
endif
ifneq ($(NCCL_EMIT_LTO_IR), 0)
IR_GOALS += ltoir
endif
default: src.build
ifneq ($(IR_GOALS),)
default: ir-emit
endif
install: src.install
BUILDDIR ?= $(abspath ./build)
ABSBUILDDIR := $(abspath $(BUILDDIR))
TARGETS := src pkg nccl4py ir
clean: ${TARGETS:%=%.clean}
TEST_BUILD_DEPS := src.build
ifneq ($(IR_GOALS),)
TEST_BUILD_DEPS += ir-emit
endif
test.build: $(TEST_BUILD_DEPS)
examples.build: src.build
ir.build: src.build
ir.llvm_ir: src.build
ir.ltoir: src.build
LICENSE_FILES := LICENSE.txt
LICENSE_TARGETS := $(LICENSE_FILES:%=$(BUILDDIR)/%)
lic: $(LICENSE_TARGETS)
${BUILDDIR}/%.txt: %.txt
@printf "Copying %-35s > %s\n" $< $@
mkdir -p ${BUILDDIR}
install -m 644 $< $@
src.%:
${MAKE} -C src $* BUILDDIR=${ABSBUILDDIR}
# Individual test sub-targets (test.perf.build, test.apitest.build, ...) need the
# exported headers and libnccl, just like test.build does. Build device IR
# libraries only when the corresponding IR tests are enabled.
test.%.build: $(TEST_BUILD_DEPS)
${MAKE} -C test $*.build BUILDDIR=${ABSBUILDDIR}
examples: src.build
${MAKE} -C docs/examples NCCL_HOME=${ABSBUILDDIR}
pkg.%:
${MAKE} -C pkg $* BUILDDIR=${ABSBUILDDIR}
nccl4py.%:
${MAKE} -C bindings/nccl4py $* BUILDDIR=${ABSBUILDDIR}
# IR generation requires src.build first
ir.%:
${MAKE} -C bindings/ir $* BUILDDIR=${ABSBUILDDIR}
ir-emit: src.build
${MAKE} -C bindings/ir $(IR_GOALS) BUILDDIR=${ABSBUILDDIR}
pkg.debian.prep: lic
pkg.txz.prep: lic