-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathMakefile
92 lines (71 loc) · 2.22 KB
/
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
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
# Makefile to build gn bootstrap and release
ifdef system
# Export `system` if defined since it is used by BUILDCONFIG.gn
# Use system=i686-linux to build 32-bit binaries
export system
endif
ifdef DEPLOY
# Export `DEPLOY` if defined since it is used to indicate that we want
# to build for deployment. Use DEPLOY=1 to build binaries for deployment.
export DEPLOY
endif
# Export `CC` and `CXX` variables since they are used by gn files
# GN will be built using clang if CC=clang
export CC CXX
EMPTY :=
SPACE := $(EMPTY) $(EMPTY)
COMMA := ,
# Define the version of GN here with an optional commit hash appended
COMMIT_HASH := $Format:%h$
REF_NAMES := $Format:%D$
REF_NAMES := $(filter-out ->,$(subst $(COMMA),$(SPACE),$(subst :$(SPACE),:,$(REF_NAMES))))
VERSION_SUFFIX = $(if $(filter tag:v$(GN_VERSION),$(REF_NAMES)),,-$(COMMIT_HASH))
GN_VERSION := 0.4.1
export GN_VERSION := $(if $(filter-out %:%h %:%h$$,$(COMMIT_HASH)),$(GN_VERSION)$(VERSION_SUFFIX))
OUTDIR=out
.PHONY: all
all: gn_all gn_test $(OUTDIR)/.envvars
@true
.PHONY: clean
clean:
@rm -rf out
.PHONY: gn_all
gn_all: gn gn_unittests
@true
$(OUTDIR)/bootstrap/build.ninja: build/gen.py
@env -u CC -u CXX $< --out-path $(@D)
$(OUTDIR)/bootstrap/gn: $(OUTDIR)/bootstrap/build.ninja
@ninja -C $(@D)
@touch $@
.PHONY: bootstrap
bootstrap: $(OUTDIR)/bootstrap/gn
@true
.PHONY: envvars
$(OUTDIR)/.envvars: envvars
@echo "system=$(system)" >> [email protected]
@echo "CC=$(CC)" >> [email protected]
@echo "CXX=$(CXX)" >> [email protected]
@echo "DEPLOY=$(DEPLOY)" >> [email protected]
$(OUTDIR)/Release/build.ninja: $(OUTDIR)/bootstrap/gn Makefile $(wildcard .git/HEAD) $(OUTDIR)/.envvars
@$< gen --args='is_debug=false is_official_build=true' //$(@D)
.PHONY: build.ninja
build.ninja: $(OUTDIR)/Release/build.ninja
@true
$(OUTDIR)/Release/gn $(OUTDIR)/Release/gn_unittests: build.ninja
@ninja -C $(@D) $(@F)
.PHONY: gn
gn: $(OUTDIR)/Release/gn
@true
.PHONY: gn_unittests
gn_unittests: $(OUTDIR)/Release/gn_unittests
@true
$(OUTDIR)/boostrap/gn_unittests.pass: $(OUTDIR)/boostrap/gn_unittests
@$<
@touch $@
$(OUTDIR)/Release/gn_unittests.pass: $(OUTDIR)/Release/gn_unittests
@$<
@touch $@
.PHONY: gn_test
gn_test: $(OUTDIR)/Release/gn_unittests.pass
@true