forked from ponylang/ponyc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile-lib-llvm
146 lines (131 loc) · 5.65 KB
/
Makefile-lib-llvm
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
# This makefile invokes lib/llvm/Makefile before invoking Makefile-ponyc.
# The reason for doing this is that Makefile-ponyc requires llvm-config to
# be present before it is invoked, thus the need to build lib/llvm/Makefile
# first.
#
# The default target of this makefile builds llvm defined by the submodule,
# which is currently llvm-3.9.1. You may also build lvm-7.x by using
# llvm_target=llvm-7.x. In addition, if you specify llvm_target=llvm-current
# then lib/llvm/src will not be altered but will be built.
#
# In the future compiling lib/llvm will be incorporated into Makefile
# and Makefile-lib-llvm will be removed.
config ?= release
root_dir := $(shell pwd)
llvm_dir := $(root_dir)/lib/llvm
llvm_target :=
ifneq ($(llvm_proj),)
$(error "llvm_proj is not named llvm_target")
endif
pony_lib_llvm := $(llvm_dir)
llvm_config := $(pony_lib_llvm)/dist/bin/llvm-config
llvm_build_type := Release
new_path := $(pony_lib_llvm)/dist/bin:$(PATH)
llvm_project_list :=
pony_targets := libponyc libponyrt libponyrt-pic libponyc.tests libponyrt.tests libponyc.benchmarks
pony_targets += libponyrt.benchmarks ponyc benchmark install uninstall stats test all
pony_targets += stdlib test-stdlib stdlib-debug test-stdlib-debug test-examples test-ci docs-online
.PHONY: $(pony_targets)
$(pony_targets): $(llvm_config)
@PATH=$(new_path) $(MAKE) -f Makefile-ponyc config=$(config) $(MAKECMDGOALS) $(MAKEFLAGS)
.PHONY: $(llvm_config)
$(llvm_config):
@$(MAKE) -C $(pony_lib_llvm) LLVM_BUILD_TYPE=$(llvm_build_type) $(llvm_target) LLVM_PROJECT_LIST="$(llvm_project_list)"
# Clean is needed otherwise the rebuild of llvm won't be linked
.PHONY: rebuild
rebuild: clean
@$(MAKE) -C $(pony_lib_llvm) $(llvm_build_type) rebuild
@PATH=$(new_path) $(MAKE) -f Makefile-ponyc config=$(config) $(MAKEFLAGS)
# Clean is needed otherwise the rebuild of llvm won't be linked
.PHONY: rebuild-test
rebuild-test: clean
@$(MAKE) -C $(pony_lib_llvm) $(llvm_build_type) rebuild
@PATH=$(new_path) $(MAKE) -f Makefile-ponyc config=$(config) test $(MAKEFLAGS)
# Rebuild and then run some tests as passed in the command line parameter gtest_filter.
# Note, the clean is needed otherwise the rebuild of llvm won't be linked.
#
# For example:
# $ time CC=clang CXX=clang++ make -j10 -f Makefile-lib-llvm \
# verbose=1 config=debug default_pic=true default_ssl=openssl_1.1.0 llvm_target=llvm-current rebuild-some-tests \
# gtest_filter=--gtest_filter=CodegenOptimisationTest.MergeSendMessageReordering 2>&1 | tee clang-rebuild-some-tests.txt
.PHONY: rebuild-some-tests
rebuild-some-tests: clean
@$(MAKE) -C $(pony_lib_llvm) LLVM_BUILD_TYPE=$(llvm_build_type) rebuild
@PATH=$(new_path) $(MAKE) -f Makefile-ponyc config=$(config) $(MAKEFLAGS)
@$(MAKE) -f Makefile-lib-llvm some-tests
# Run the some passing gtest_filter on command line, for example:
# make -f Makefile-lib-llvm some-tests gtest_filter=--gtest_filter=CodegenOptimisationTest.MergeSendMessageReordering
.PHONY: some-tests
some-tests:
@PATH=$(new_path) ./build/debug/libponyc.tests $(gtest_filter)
# Clean just ponyc
.PHONY: clean
clean:
@PATH=$(new_path) $(MAKE) -f Makefile-ponyc config=$(config) clean
# Clean ponyc and lib/llvm
.PHONY: clean-all
clean-all: clean
@$(MAKE) -C lib/llvm clean
# Clean ponyc and distclean llvm
.PHONY: distclean
distclean: clean
@$(MAKE) -C lib/llvm distclean
.PHONY: help
help:
@echo 'Usage: make [config=name] [arch=name] [use=opt,...] [target]'
@echo
@echo 'CONFIGURATIONS:'
@echo ' debug'
@echo ' release (default)'
@echo
@echo 'ARCHITECTURE:'
@echo ' native (default)'
@echo ' [any compiler supported architecture]'
@echo
@echo 'Compile time default options:'
@echo ' default_pic=true Make --pic the default'
@echo ' default_ssl=Name Make Name the default ssl version'
@echo ' where Name is one of:'
@echo ' openssl_0.9.0 (default)'
@echo ' openssl_1.1.0'
@echo ' llvm_target=Target Make llvm where Target is one of:'
@echo ' llvm-3.9.1 (default if not specified)'
@echo ' llvm-6.x'
@echo ' llvm-7.x'
@echo ' llvm-current'
@echo ' llvm-default'
@echo ' LLVM_BUILD_TYPE=x Build type with x='
@echo ' Release (default)'
@echo ' Debug'
@echo ' RelWithDebInfo'
@echo ' MinSizeRel'
@echo
@echo 'USE OPTIONS:'
@echo ' valgrind'
@echo ' pooltrack'
@echo ' dtrace'
@echo ' actor_continuations'
@echo ' coverage'
@echo ' scheduler_scaling_pthreads'
@echo ' llvm_link_static'
@echo
@echo 'TARGETS:'
@echo ' libponyc Pony compiler library'
@echo ' libponyrt Pony runtime'
@echo ' libponyrt-pic Pony runtime -fpic'
@echo ' libponyc.tests Test suite for libponyc'
@echo ' libponyrt.tests Test suite for libponyrt'
@echo ' libponyc.benchmarks Benchmark suite for libponyc'
@echo ' libponyrt.benchmarks Benchmark suite for libponyrt'
@echo ' ponyc Pony compiler executable'
@echo
@echo ' all Build all of the above (default)'
@echo ' test Run test suite'
@echo ' benchmark Build and run benchmark suite'
@echo ' install Install ponyc'
@echo ' uninstall Remove all versions of ponyc'
@echo ' stats Print Pony cloc statistics'
@echo ' clean Delete all build files but nothing in $(llvm_dir)'
@echo ' clean-all clean plus clean $(llvm_dir)'
@echo ' distclean clean plus distclean $(llvm_dir)'
@echo