ifdef TRAVIS_BUILD_DIR
curdir ?= $(TRAVIS_BUILD_DIR)
else
-curdir ?= .
+# CURDIR is a make builtin
+curdir ?= $(CURDIR)
endif
enable_maintainer_zts ?= no
PECL_SONAME ?= $(if $(shell echo $(PECL) | cut -d: -f2),$(shell echo $(PECL) | cut -d: -f2),$(PECL_EXTENSION))
PECL_VERSION ?= $(shell echo $(PECL) | cut -d: -f3 -s)
PECL_INI = $(with_config_file_scan_dir)/pecl.ini
-PECL_DIR ?= $(srcdir)/pecl-$(PECL_EXTENSION)
+PECL_DIR := $(if $(filter ext ext%, $(MAKECMDGOALS)), $(curdir), $(srcdir)/pecl-$(PECL_EXTENSION))
PHP_VERSION_MAJOR = $(firstword $(subst ., ,$(PHP)))
PHP_VERSIONS_JSON = $(srcdir)/php-versions$(PHP_VERSION_MAJOR).json
## -- PECL
-ext%: PECL_DIR:=$(curdir)
-
.PHONY: pecl-check
pecl-check:
@if test -z "$(PECL)"; then echo "No pecl extension specified, e.g. PECL=pecl_http:http"; exit 1; fi