-
Notifications
You must be signed in to change notification settings - Fork 64
/
Makefile
40 lines (32 loc) · 864 Bytes
/
Makefile
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
PHONY_TARGETS := distclean all configure
.PHONY: install $(PHONY_TARGETS)
SHELL := /bin/bash
RM := rm -rf
CONFIGURE_CMD := ./configure
# Automatically select the number of processors.
# You can override that on the command line: "make NPROC=1".
NPROC := 1
ifeq ($(OS),Windows_NT)
else
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Linux)
# Keep one proc for system tasks
NPROC := $(shell nproc --ignore=1)
endif
ifeq ($(UNAME_S),Darwin)
NPROC := $(shell sysctl -n hw.ncpu)
endif
endif
all: ./build/Makefile
$(MAKE) -C build -j$(NPROC)
build/Makefile:
@ ($(CONFIGURE_CMD))
configure:
@ ($(CONFIGURE_CMD))
distclean:
@- $(RM) ./build/
SUBTARGETS := $(filter-out $(PHONY_TARGETS), $(MAKECMDGOALS))
ifneq ($(SUBTARGETS),)
$(SUBTARGETS): ./build/Makefile
$(MAKE) -C build -j$(NPROC) $(MAKECMDGOALS)
endif