forked from rethinkdb/rethinkdb
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
109 lines (83 loc) · 3.03 KB
/
Makefile
File metadata and controls
109 lines (83 loc) · 3.03 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# Copyright 2010-2013 RethinkDB, all rights reserved.
# Build instructions for rethinkdb are available on the rethinkdb website:
# http://www.rethinkdb.com/docs/build/
# There is additional information about the build system on the wiki:
# https://github.com/rethinkdb/rethinkdb/wiki/Build-System
# This Makefile sets up the environment before delegating to mk/main.mk
# To be able to make from a subdirectory, a Makefile with
# two lines is required:
# TOP := <relative path to the top of the rethinkdb source tree>
# include $(TOP)/Makefile
# local.mk includes a rule to build such a Makefile
ifeq (,$(filter else-if,$(.FEATURES)))
$(error GNU Make >= 3.8.1 is required)
endif
# $(TOP) is the root of the rethinkdb source tree
TOP ?= .
ifeq (/,$(firstword $(subst /,/ ,$(TOP))))
# if $(TOP) is absolute, make $(CWD) absolute
CWD := $(shell pwd)
else
# if $(TOP) is relative, $(CWD) is $(TOP) followed by the relative path from $(TOP) to the working directory
CWD_ABSPATH := $(shell pwd)
ROOT_ABSPATH := $(abspath $(CWD_ABSPATH)/$(TOP))
CWD := $(patsubst $(ROOT_ABSPATH)%,$(patsubst %/,%,$(TOP))%,$(CWD_ABSPATH))
endif
# Prefix $(CWD) to $1 and collapse unecessary ../'s
fixpath = $(patsubst ./%,%,$(shell echo $(CWD)/$1 | sed 's|[^/]\+/\.\./||'))
MAKECMDGOALS ?=
# Build the make command line
MAKE_CMD_LINE = $(MAKE) -f $(TOP)/mk/main.mk
MAKE_CMD_LINE += --no-print-directory
MAKE_CMD_LINE += --warn-undefined-variables
MAKE_CMD_LINE += --no-builtin-rules
MAKE_CMD_LINE += --no-builtin-variables
MAKE_CMD_LINE += TOP=$(TOP) CWD=$(CWD) NO_CONFIGURE=1
# Call fixpath on all goals that aren't phony
MAKE_GOALS = $(foreach goal,$(filter-out $(PHONY_LIST),$(MAKECMDGOALS)),$(call fixpath,$(goal))) $(filter $(PHONY_LIST),$(MAKECMDGOALS))
default: make
# Delegate the build to mk/main.mk
.PHONY: make
make:
@$(CHECK_ARG_VARIABLES)
+@$(MAKE_CMD_LINE) COUNTDOWN_TOTAL=$(COUNTDOWN_TOTAL) $(MAKE_GOALS)
%: make
@true
# List all rules
.PHONY: dump-db
dump-db:
+@$(CHECK_ARG_VARIABLES)
+@$(MAKE_CMD_LINE) --print-data-base --question JUST_SCAN_MAKEFILES=1 || true
# Load the configuration
include $(TOP)/mk/configure.mk
# Require CHECK_ARG_VARIABLES
include $(TOP)/mk/check-env.mk
# Require pipe-stderr
include $(TOP)/mk/pipe-stderr.mk
# The cached list of phony targets
-include $(TOP)/mk/gen/phony-list.mk
ifeq (1,$(SHOW_COUNTDOWN))
# See mk/lib.mk for JUST_SCAN_MAKEFILES
COUNTDOWN_TOTAL = $(firstword $(shell MAKEFLAGS='$(MAKEFLAGS)' $(MAKE_CMD_LINE) $(MAKE_GOALS) --dry-run JUST_SCAN_MAKEFILES=1 -j1 2>&1 | grep "[!!!]" | wc -l 2>/dev/null))
else
COUNTDOWN_TOTAL :=
endif
# Build the list of phony targets
# TODO: depend on inner $(MAKEFILES) instead of *.mk
$(TOP)/mk/gen/phony-list.mk: $(wildcard $(TOP)/mk/*.mk)
+@MAKEFLAGS= $(MAKE_CMD_LINE) --print-data-base --question JUST_SCAN_MAKEFILES=1 \
| grep '^.PHONY: ' \
| sed 's/^.PHONY:/PHONY_LIST :=/' \
2>/dev/null > $@
# Don't try to rebuild any of the Makefiles
$(TOP)/%.mk:
@true
$(TOP)/Makefile:
@true
##### Cancel builtin rules
.SUFFIXES:
%: %,v
%: RCS/%,v
%: RCS/%
%: s.%
%: SCCS/s.%