From acb737ef367f61ee0c0d219ea7272abb56e68e34 Mon Sep 17 00:00:00 2001 From: Ben Fuhrmannek Date: Wed, 5 Jan 2022 20:17:09 +0100 Subject: skip old php check for testing --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index b8236fb..78aefe2 100644 --- a/Makefile +++ b/Makefile @@ -19,7 +19,7 @@ compile_debug: ## compile a debug build make -C src tests: release ## compile a release build and run the testsuite - TEST_PHP_ARGS='-q' REPORT_EXIT_STATUS=1 make -C src test + TEST_PHP_ARGS='-q' REPORT_EXIT_STATUS=1 SP_SKIP_OLD_PHP_CHECK=1 make -C src test coverage: ## compile snuffleugpaus, and run the testsuite with coverage cd src; phpize -- cgit v1.3 From 1700aa6192fe874c094e8f794c6803320ce72b42 Mon Sep 17 00:00:00 2001 From: Ben Fuhrmannek Date: Fri, 7 Jan 2022 19:53:52 +0100 Subject: added docker start rule and linked-clone to makefile --- Makefile | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 78aefe2..e7b0a1c 100644 --- a/Makefile +++ b/Makefile @@ -8,15 +8,29 @@ clean: ## clean everything release: ## compile with releases flags cd src; phpize cd src; ./configure --enable-snuffleupagus - make -C src + make -C src -j4 clean all install: release ## compile and install snuffleupagus make -C src install compile_debug: ## compile a debug build - cd src; phpize - export CFLAGS="-g3 -ggdb -O1 -g"; cd src; ./configure --enable-snuffleupagus --enable-debug - make -C src + cd src; if [[ ! -f configure ]]; then phpize; fi; \ + ./configure --enable-snuffleupagus --enable-debug --enable-debug-stderr + make -C src -j4 clean all + +DOCKER_IMAGE := php:latest +docker: ## start docker container with current PHP + @echo "starting new docker container with snuffleupagus bind-mounted to /sp" + docker run -it -v "$$(pwd)":/sp $(DOCKER_IMAGE) /bin/bash + +linked-clone: + @if [[ "$(CLONE)" == "" ]]; then echo "Please provide clone name, e.g.\n make linked-clone CLONE=php8.1"; exit 1; fi + @if [[ -d "src-$(CLONE)" ]]; then echo "Clone '$(CLONE)' already exists."; exit 1; fi + @echo "creating linked clone in 'src-$(CLONE)'..." + mkdir "src-$(CLONE)"; cd "src-$(CLONE)"; \ + SRC=../src; ln -s $$SRC/*.[hc] $$SRC/config.m4 $$SRC/snuffleupagus.php $$SRC/Makefile.frag $$SRC/*.re .; \ + cp -r $$SRC/tests . + @echo "done. go ahead and do phpize/configure/make" tests: release ## compile a release build and run the testsuite TEST_PHP_ARGS='-q' REPORT_EXIT_STATUS=1 SP_SKIP_OLD_PHP_CHECK=1 make -C src test -- cgit v1.3 From f6dba50f57a5e8de6d75b8168f988104991ebaeb Mon Sep 17 00:00:00 2001 From: Ben Fuhrmannek Date: Tue, 11 Jan 2022 17:46:40 +0100 Subject: make src-dir variable in makefile and use bash as default shell --- Makefile | 69 +++++++++++++++++++++++++++++++++------------------------------- 1 file changed, 36 insertions(+), 33 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index e7b0a1c..cbe9b3b 100644 --- a/Makefile +++ b/Makefile @@ -1,58 +1,61 @@ .DEFAULT_GOAL=help .PHONY=help +SHELL = /bin/bash + +SRC := src clean: ## clean everything - make -C src clean - cd src; phpize --clean + make -C $(SRC) clean + cd $(SRC); phpize --clean release: ## compile with releases flags - cd src; phpize - cd src; ./configure --enable-snuffleupagus - make -C src -j4 clean all + cd $(SRC); phpize + cd $(SRC); ./configure --enable-snuffleupagus + make -C $(SRC) -j4 clean all install: release ## compile and install snuffleupagus - make -C src install + make -C $(SRC) install compile_debug: ## compile a debug build - cd src; if [[ ! -f configure ]]; then phpize; fi; \ - ./configure --enable-snuffleupagus --enable-debug --enable-debug-stderr - make -C src -j4 clean all + cd $(SRC); if [[ ! -f configure ]]; then phpize; fi; \ + ./configure --enable-snuffleupagus --enable-debug --enable-debug-stderr && \ + make clean ; make -j4 DOCKER_IMAGE := php:latest docker: ## start docker container with current PHP - @echo "starting new docker container with snuffleupagus bind-mounted to /sp" + @echo "Starting new docker container with snuffleupagus bind-mounted to /sp" docker run -it -v "$$(pwd)":/sp $(DOCKER_IMAGE) /bin/bash linked-clone: - @if [[ "$(CLONE)" == "" ]]; then echo "Please provide clone name, e.g.\n make linked-clone CLONE=php8.1"; exit 1; fi - @if [[ -d "src-$(CLONE)" ]]; then echo "Clone '$(CLONE)' already exists."; exit 1; fi - @echo "creating linked clone in 'src-$(CLONE)'..." + @if [[ "$(CLONE)" == "" ]]; then echo "==> Please provide clone name, e.g.\n make linked-clone CLONE=php8.1"; exit 1; fi + @if [[ -d "src-$(CLONE)" ]]; then echo "==> Clone '$(CLONE)' already exists."; exit 1; fi + @echo "==> CREATING LINKED CLONE IN 'src-$(CLONE)' <==" mkdir "src-$(CLONE)"; cd "src-$(CLONE)"; \ - SRC=../src; ln -s $$SRC/*.[hc] $$SRC/config.m4 $$SRC/snuffleupagus.php $$SRC/Makefile.frag $$SRC/*.re .; \ - cp -r $$SRC/tests . - @echo "done. go ahead and do phpize/configure/make" + SRCDIR=../src; ln -s $$SRC/*.[hc] $$SRCDIR/config.m4 $$SRCDIR/snuffleupagus.php $$SRCDIR/Makefile.frag $$SRCDIR/*.re .; \ + cp -r $$SRCDIR/tests . + @echo "==> DONE. <==\nCompile a debug build with\n make compile_debug SRC=src-$(CLONE)" tests: release ## compile a release build and run the testsuite - TEST_PHP_ARGS='-q' REPORT_EXIT_STATUS=1 SP_SKIP_OLD_PHP_CHECK=1 make -C src test + TEST_PHP_ARGS='-q' REPORT_EXIT_STATUS=1 SP_SKIP_OLD_PHP_CHECK=1 make -C $(SRC) test coverage: ## compile snuffleugpaus, and run the testsuite with coverage - cd src; phpize + cd $(SRC); phpize ifeq ($(CC),clang) - cd src; CFLAGS="-fprofile-instr-generate -fcoverage-mapping" ./configure --enable-snuffleupagus - make -C src - sed -i "s/\$$ext_params -d display_errors=0 -r/-d display_errors=0 -r/" src/run-tests.php - LLVM_PROFILE_FILE="sp_%p_%m.profraw" TEST_PHP_ARGS='-q' REPORT_EXIT_STATUS=1 make -C src test - llvm-profdata-4.0 merge ./src/*.profraw -o ./src/sp.profdata - llvm-cov report -instr-profile=./src/sp.profdata ./src/modules/snuffleupagus.so + cd $(SRC); CFLAGS="-fprofile-instr-generate -fcoverage-mapping" ./configure --enable-snuffleupagus + make -C $(SRC) + sed -i "s/\$$ext_params -d display_errors=0 -r/-d display_errors=0 -r/" $(SRC)/run-tests.php + LLVM_PROFILE_FILE="sp_%p_%m.profraw" TEST_PHP_ARGS='-q' REPORT_EXIT_STATUS=1 make -C $(SRC) test + llvm-profdata-4.0 merge ./$(SRC)/*.profraw -o ./$(SRC)/sp.profdata + llvm-cov report -instr-profile=./$(SRC)/sp.profdata ./$(SRC)/modules/snuffleupagus.so else - cd src; ./configure --enable-snuffleupagus --enable-coverage - make -C src - rm -Rf src/COV.html - sed -i "s/\$$ext_params -d display_errors=0 -r/-d display_errors=0 -r/" src/run-tests.php - TEST_PHP_ARGS='-q' REPORT_EXIT_STATUS=1 make -C src test - lcov --base-directory ./src --directory ./src -c -o ./src/COV.info --rc lcov_branch_coverage=1 - lcov --remove src/COV.info '/usr/*' --remove src/COV.info '*tweetnacl.c' -o src/COV.info --rc lcov_branch_coverage=1 - genhtml --show-details -o src/COV.html ./src/COV.info --branch-coverage + cd $(SRC); ./configure --enable-snuffleupagus --enable-coverage + make -C $(SRC) + rm -Rf $(SRC)/COV.html + sed -i "s/\$$ext_params -d display_errors=0 -r/-d display_errors=0 -r/" $(SRC)/run-tests.php + TEST_PHP_ARGS='-q' REPORT_EXIT_STATUS=1 make -C $(SRC) test + lcov --base-directory ./$(SRC) --directory ./$(SRC) -c -o ./$(SRC)/COV.info --rc lcov_branch_coverage=1 + lcov --remove $(SRC)/COV.info '/usr/*' --remove $(SRC)/COV.info '*tweetnacl.c' -o $(SRC)/COV.info --rc lcov_branch_coverage=1 + genhtml --show-details -o $(SRC)/COV.html ./$(SRC)/COV.info --branch-coverage endif bench: joomla ## run the benchmark @@ -63,7 +66,7 @@ joomla: fi cd joomla-cms; composer install >/dev/null 2>/dev/null echo "\nWith snuffleupagus:" - cd joomla-cms; time php -d "extension=../src/modules/snuffleupagus.so" -d "sp.configuration_file=../config/default.rules" libraries/vendor/phpunit/phpunit/phpunit --no-coverage >/dev/null + cd joomla-cms; time php -d "extension=../$(SRC)/modules/snuffleupagus.so" -d "sp.configuration_file=../config/default.rules" libraries/vendor/phpunit/phpunit/phpunit --no-coverage >/dev/null echo "\nWithout snuffleupagus:" cd joomla-cms; time php libraries/vendor/phpunit/phpunit/phpunit --no-coverage >/dev/null -- cgit v1.3 From 494b4e778b93a065f0dd007786f90063f8a25702 Mon Sep 17 00:00:00 2001 From: Ben Fuhrmannek Date: Wed, 12 Jan 2022 09:33:09 +0100 Subject: make release builds without -j --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index cbe9b3b..c480593 100644 --- a/Makefile +++ b/Makefile @@ -11,7 +11,7 @@ clean: ## clean everything release: ## compile with releases flags cd $(SRC); phpize cd $(SRC); ./configure --enable-snuffleupagus - make -C $(SRC) -j4 clean all + make -C $(SRC) install: release ## compile and install snuffleupagus make -C $(SRC) install -- cgit v1.3 From 81486800337074b7edf8d87e7074e8ea0e8e9f31 Mon Sep 17 00:00:00 2001 From: Ben Fuhrmannek Date: Wed, 12 Jan 2022 10:41:06 +0100 Subject: fixed newlines + typo --- Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index c480593..51c6cc9 100644 --- a/Makefile +++ b/Makefile @@ -27,13 +27,13 @@ docker: ## start docker container with current PHP docker run -it -v "$$(pwd)":/sp $(DOCKER_IMAGE) /bin/bash linked-clone: - @if [[ "$(CLONE)" == "" ]]; then echo "==> Please provide clone name, e.g.\n make linked-clone CLONE=php8.1"; exit 1; fi - @if [[ -d "src-$(CLONE)" ]]; then echo "==> Clone '$(CLONE)' already exists."; exit 1; fi + @if [[ "$(CLONE)" == "" ]]; then echo -e "==> Please provide clone name, e.g.\n make linked-clone CLONE=php8.1\n"; exit 1; fi + @if [[ -d "src-$(CLONE)" ]]; then echo -e "==> Clone '$(CLONE)' already exists.\n"; exit 1; fi @echo "==> CREATING LINKED CLONE IN 'src-$(CLONE)' <==" mkdir "src-$(CLONE)"; cd "src-$(CLONE)"; \ - SRCDIR=../src; ln -s $$SRC/*.[hc] $$SRCDIR/config.m4 $$SRCDIR/snuffleupagus.php $$SRCDIR/Makefile.frag $$SRCDIR/*.re .; \ + SRCDIR=../src; ln -s $$SRCDIR/*.[hc] $$SRCDIR/config.m4 $$SRCDIR/snuffleupagus.php $$SRCDIR/Makefile.frag $$SRCDIR/*.re .; \ cp -r $$SRCDIR/tests . - @echo "==> DONE. <==\nCompile a debug build with\n make compile_debug SRC=src-$(CLONE)" + @echo -e "==> DONE. <==\nCompile a debug build with\n make compile_debug SRC=src-$(CLONE)" tests: release ## compile a release build and run the testsuite TEST_PHP_ARGS='-q' REPORT_EXIT_STATUS=1 SP_SKIP_OLD_PHP_CHECK=1 make -C $(SRC) test -- cgit v1.3