forked from VcDevel/Vc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
27 lines (21 loc) · 794 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
CXX ?= c++
build_dir := $(shell which $(CXX))
tmp := "case $$(readlink -f $(build_dir)) in *icecc) which $${ICECC_CXX:-g++};; *) echo $(build_dir);; esac"
build_dir := $(shell sh -c $(tmp))
build_dir := $(realpath $(build_dir))
build_dir := build-$(subst /,-,$(build_dir:/%=%)$(CXXFLAGS))
all:
%:: $(build_dir)/CMakeCache.txt
$(MAKE) --no-print-directory -C "$(build_dir)" $(MAKECMDGOALS)
$(build_dir)/CMakeCache.txt:
@test -n "$(build_dir)"
@mkdir -p "$(build_dir)"
@test -e "$(build_dir)/CMakeCache.txt" || cmake -H. -B"$(build_dir)"
print_build_dir:
@echo "$(PWD)/$(build_dir)"
clean_builddir:
rm -rf "$(build_dir)"
# the following rule works around %:: grabbing the Makefile rule and thus stops it from running every time
Makefile:
@true
.PHONY: print_build_dir clean_builddir