2015-11-04 21:01:09 -08:00
|
|
|
#
|
|
|
|
# Copyright (c) 2015-present, Facebook, Inc.
|
|
|
|
# All rights reserved.
|
|
|
|
#
|
|
|
|
# This source code is licensed under the BSD-style license found in the
|
|
|
|
# LICENSE file in the root directory of this source tree. An additional grant
|
|
|
|
# of patent rights can be found in the PATENTS file in the same directory.
|
|
|
|
#
|
2015-08-13 22:43:58 -07:00
|
|
|
|
|
|
|
build := build
|
2016-05-20 14:51:56 -05:00
|
|
|
project := project
|
2015-08-13 22:43:58 -07:00
|
|
|
|
|
|
|
cmake := cmake
|
2016-06-10 14:10:10 -07:00
|
|
|
cmake_flags := -DCMAKE_INSTALL_PREFIX=
|
2015-08-13 22:43:58 -07:00
|
|
|
|
2015-12-25 21:53:35 -08:00
|
|
|
ninja := $(if $(shell which llbuild),llbuild ninja build,ninja)
|
2016-02-16 19:36:16 -08:00
|
|
|
ninja_flags := $(if $(shell echo "$$NINJA_JOBS"),-j$(shell echo "$$NINJA_JOBS"),)
|
2015-08-13 22:43:58 -07:00
|
|
|
|
|
|
|
all:
|
|
|
|
mkdir -p $(build)
|
2016-05-20 14:51:56 -05:00
|
|
|
$(cmake) -B$(build) -H. -G Ninja $(cmake_flags)
|
2016-03-04 00:34:15 -08:00
|
|
|
$(ninja) -C $(build) $(ninja_flags)
|
2015-08-13 22:43:58 -07:00
|
|
|
|
2016-06-10 14:10:10 -07:00
|
|
|
install: all
|
|
|
|
@DESTDIR=$(realpath $(PREFIX)) \
|
|
|
|
$(ninja) -C $(build) $(ninja_flags) install
|
|
|
|
|
2016-05-20 14:51:56 -05:00
|
|
|
project:
|
|
|
|
mkdir -p $(project)
|
|
|
|
$(cmake) -B$(project) -H. -G Xcode $(cmake_flags)
|
|
|
|
|
2015-08-16 14:08:49 -07:00
|
|
|
test: all
|
2015-12-23 18:46:34 -08:00
|
|
|
set -e; for test in build/test_*; do echo; echo "$$test"; ./$$test; done
|
2015-08-16 14:08:49 -07:00
|
|
|
|
2015-08-13 22:43:58 -07:00
|
|
|
clean:
|
|
|
|
rm -rf $(build)
|
|
|
|
|
2016-05-20 14:51:56 -05:00
|
|
|
.PHONY: project
|