-
Notifications
You must be signed in to change notification settings - Fork 42
/
Makefile
89 lines (74 loc) · 1.99 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
#
# Startup Checks / Utils
#
# Check for prerequisites exist in our PATH
EXECUTABLES = php thrift composer
EXECUTABLES_OK := $(foreach EXEC, $(EXECUTABLES), \
$(if $(shell which $(EXEC)),some string, \
$(error Could not find '$(EXEC)') \
) \
)
# Detect multithread limit
PLATFORM=$(shell uname -s)
ifeq ($(PLATFORM),Darwin)
THREADS := $(shell sysctl -n hw.ncpu)
else ifeq ($(PLATFORM),Linux)
THREADS := $(shell nproc)
else
THREADS := 2
endif
#
# Make Targets
#
default: impala hive thrift
# Lint generated files
find build/gen-php/ThriftGenerated -type f -name "*.php" -print0 | \
xargs -0L1 -P ${THREADS} \
php -l
impala: submodules
# Build error codes thrift file
src-thrift/impala/common/thrift/generate_error_codes.py
mv ErrorCodes.thrift build/
# Remap some dirs to fix file inclusion
@rm -f build/share
ln -s ../src-thrift/thrift/contrib build/share
# Build Impala
thrift --gen php:nsglobal=ThriftGenerated \
-o build \
-I build \
-I src-thrift/hive/metastore/if \
-I src-thrift/hive/service/if \
src-thrift/impala/common/thrift/ImpalaService.thrift
thrift --gen php:nsglobal=ThriftGenerated \
-o build \
-I build \
-I src-thrift/hive/metastore/if \
src-thrift/impala/common/thrift/beeswax.thrift
hive: submodules
thrift --gen php:nsglobal=ThriftGenerated \
-o build \
-I src-thrift/hive \
src-thrift/hive/service/if/TCLIService.thrift
thrift: submodules
submodules:
git submodule update
@mkdir -p build
install: default
@rm -rf src/Thrift
cp -a src-thrift/thrift/lib/php/lib src/Thrift
@rm -rf src/ThriftGenerated
mv build/gen-php/ThriftGenerated src/ThriftGenerated
phar: install composer.lock
vendor/bin/phpab --nolower --output src/autoload.php --basedir src src
php -d phar.readonly=0 build.php
clean-dev: clean
rm -rf vendor
rm -f composer.lock
clean:
rm -rf build
rm -rf src/Thrift
rm -rf src/ThriftGenerated
rm -f src/autoload.php
composer.lock: composer.json
composer install
.PHONY: default impala hive thrift submodules install phar clean-dev clean