-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
50 lines (38 loc) · 1.26 KB
/
Copy pathMakefile
File metadata and controls
50 lines (38 loc) · 1.26 KB
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
EXTENSION_DIR = ext/mariadb_profiler
PHP_CONFIG ?= php-config
.PHONY: all build install clean test composer ext-configure ext-build ext-install cli-install
all: composer ext-build
## Composer dependencies
composer:
composer install
## PHP Extension build
ext-configure:
cd $(EXTENSION_DIR) && phpize && ./configure --enable-mariadb_profiler
ext-build: ext-configure
cd $(EXTENSION_DIR) && make -j$$(nproc)
ext-install:
cd $(EXTENSION_DIR) && make install
@echo ""
@echo "Add the following to your php.ini:"
@echo " extension=mariadb_profiler.so"
@echo " mariadb_profiler.enabled = 1"
@echo " mariadb_profiler.log_dir = /tmp/mariadb_profiler"
@echo " mariadb_profiler.raw_log = 1"
@echo " mariadb_profiler.job_check_interval = 1"
install: ext-install cli-install
cli-install:
@echo "CLI tool available at: cli/mariadb_profiler.php"
@echo ""
@echo "Optional: create a symlink:"
@echo " ln -sf $$(pwd)/cli/mariadb_profiler.php /usr/local/bin/mariadb-profiler"
## Testing
test: composer
php tests/test_sql_analyzer.php
test-extension:
cd $(EXTENSION_DIR) && make test
## Clean
clean:
cd $(EXTENSION_DIR) && [ -f Makefile ] && make clean || true
cd $(EXTENSION_DIR) && [ -f configure ] && phpize --clean || true
distclean: clean
rm -rf vendor composer.lock