|
| 1 | + |
| 2 | +# |
| 3 | +# Startup Checks / Utils |
| 4 | +# |
| 5 | + |
| 6 | +# Check for prerequisites exist in our PATH |
| 7 | +EXECUTABLES = php thrift composer |
| 8 | +EXECUTABLES_OK := $(foreach EXEC, $(EXECUTABLES), \ |
| 9 | +$(if $(shell which $(EXEC)),some string, \ |
| 10 | +$(error Could not find '$(EXEC)') \ |
| 11 | +) \ |
| 12 | +) |
| 13 | + |
| 14 | +# Detect multithread limit |
| 15 | +PLATFORM=$(shell uname -s) |
| 16 | +ifeq ($(PLATFORM),Darwin) |
| 17 | +THREADS := $(shell sysctl -n hw.ncpu) |
| 18 | +else ifeq ($(PLATFORM),Linux) |
| 19 | +THREADS := $(shell nproc) |
| 20 | +else |
| 21 | +THREADS := 2 |
| 22 | +endif |
| 23 | + |
| 24 | +# |
| 25 | +# Make Targets |
| 26 | +# |
| 27 | + |
| 28 | +default: impala hive thrift |
| 29 | +# Lint generated files |
| 30 | +find build/gen-php/ThriftGenerated -type f -name "*.php" -print0 | \ |
| 31 | +xargs -0L1 -P ${THREADS} \ |
| 32 | +php -l |
| 33 | + |
| 34 | +impala: submodules |
| 35 | +# Build error codes thrift file |
| 36 | +src-thrift/impala/common/thrift/generate_error_codes.py |
| 37 | +mv ErrorCodes.thrift build/ |
| 38 | +# Remap some dirs to fix file inclusion |
| 39 | +@rm -f build/share |
| 40 | +ln -s ../src-thrift/thrift/contrib build/share |
| 41 | +# Build Impala |
| 42 | +thrift --gen php:nsglobal=ThriftGenerated \ |
| 43 | +-o build \ |
| 44 | +-I build \ |
| 45 | +-I src-thrift/hive/metastore/if \ |
| 46 | +-I src-thrift/hive/service/if \ |
| 47 | +src-thrift/impala/common/thrift/ImpalaService.thrift |
| 48 | +thrift --gen php:nsglobal=ThriftGenerated \ |
| 49 | +-o build \ |
| 50 | +-I build \ |
| 51 | +-I src-thrift/hive/metastore/if \ |
| 52 | +src-thrift/impala/common/thrift/beeswax.thrift |
| 53 | + |
| 54 | +hive: submodules |
| 55 | +thrift --gen php:nsglobal=ThriftGenerated \ |
| 56 | +-o build \ |
| 57 | +-I src-thrift/hive \ |
| 58 | +src-thrift/hive/service/if/TCLIService.thrift |
| 59 | + |
| 60 | +thrift: submodules |
| 61 | + |
| 62 | +submodules: |
| 63 | +git submodule update |
| 64 | +@mkdir -p build |
| 65 | + |
| 66 | +install: default |
| 67 | +@rm -rf src/Thrift |
| 68 | +cp -a src-thrift/thrift/lib/php/lib src/Thrift |
| 69 | +@rm -rf src/ThriftGenerated |
| 70 | +mv build/gen-php/ThriftGenerated src/ThriftGenerated |
| 71 | + |
| 72 | +phar: install composer.lock |
| 73 | +vendor/bin/phpab --nolower --output src/autoload.php --basedir src src |
| 74 | +php -d phar.readonly=0 build.php |
| 75 | + |
| 76 | +clean-dev: clean |
| 77 | +rm -rf vendor |
| 78 | +rm -f composer.lock |
| 79 | + |
| 80 | +clean: |
| 81 | +rm -rf build |
| 82 | +rm -rf src/Thrift |
| 83 | +rm -rf src/ThriftGenerated |
| 84 | +rm -f src/autoload.php |
| 85 | + |
| 86 | +composer.lock: composer.json |
| 87 | +composer install |
| 88 | + |
| 89 | +.PHONY: default impala hive thrift submodules install phar clean-dev clean |
0 commit comments