]>
Commit | Line | Data |
---|---|---|
684f434c IM |
1 | # |
2 | # This is a simple wrapper Makefile that calls the main Makefile.perf | |
3 | # with a -j option to do parallel builds | |
4 | # | |
5 | # If you want to invoke the perf build in some non-standard way then | |
6 | # you can use the 'make -f Makefile.perf' method to invoke it. | |
7 | # | |
b016a0dd IM |
8 | |
9 | # | |
10 | # Clear out the built-in rules GNU make defines by default (such as .o targets), | |
11 | # so that we pass through all targets to Makefile.perf: | |
12 | # | |
13 | .SUFFIXES: | |
14 | ||
684f434c IM |
15 | # |
16 | # We don't want to pass along options like -j: | |
17 | # | |
18 | unexport MAKEFLAGS | |
19 | ||
4e34d958 | 20 | # |
bd69cc28 IM |
21 | # Do a parallel build with multiple jobs, based on the number of CPUs online |
22 | # in this system: 'make -j8' on a 8-CPU system, etc. | |
79d824e3 | 23 | # |
bd69cc28 | 24 | # (To override it, run 'make JOBS=1' and similar.) |
4e22db46 | 25 | # |
bd69cc28 IM |
26 | ifeq ($(JOBS),) |
27 | JOBS := $(shell grep -c ^processor /proc/cpuinfo 2>/dev/null) | |
28 | ifeq ($(JOBS),) | |
29 | JOBS := 1 | |
8e1b3f68 | 30 | endif |
2bcd355b | 31 | endif |
f4e7ac0a | 32 | |
b102420b IM |
33 | # |
34 | # Only pass canonical directory names as the output directory: | |
35 | # | |
36 | ifneq ($(O),) | |
3fb66335 | 37 | FULL_O := $(shell readlink -f $(O) || echo $(O)) |
b102420b IM |
38 | endif |
39 | ||
73a725f0 | 40 | define print_msg |
65fb0992 | 41 | @printf ' BUILD: Doing '\''make \033[33m-j'$(JOBS)'\033[m'\'' parallel build\n' |
73a725f0 IM |
42 | endef |
43 | ||
44 | define make | |
b102420b | 45 | @$(MAKE) -f Makefile.perf --no-print-directory -j$(JOBS) O=$(FULL_O) $@ |
73a725f0 | 46 | endef |
d24e473e | 47 | |
de0f03fb | 48 | # |
bd69cc28 | 49 | # Needed if no target specified: |
de0f03fb | 50 | # |
bd69cc28 | 51 | all: |
73a725f0 IM |
52 | $(print_msg) |
53 | $(make) | |
54 | ||
55 | # | |
56 | # The clean target is not really parallel, don't print the jobs info: | |
57 | # | |
58 | clean: | |
59 | $(make) | |
c72e3f04 | 60 | |
73a725f0 IM |
61 | # |
62 | # All other targets get passed through: | |
63 | # | |
bd69cc28 | 64 | %: |
73a725f0 IM |
65 | $(print_msg) |
66 | $(make) |