SHELL := /usr/bin/env bash

PROJECT_ROOT := $(abspath $(dir $(lastword $(MAKEFILE_LIST))))
TOOLS_DIR := $(PROJECT_ROOT)/tools

.PHONY: build build-api build-html install clear-install test test-api test-html fix-permissions

build:
	php "$(TOOLS_DIR)/build.php" all

build-api:
	php "$(TOOLS_DIR)/build.php" api

build-html:
	php "$(TOOLS_DIR)/build.php" html

install: build
	php "$(TOOLS_DIR)/install.php"

clear-install:
	cd "$(PROJECT_ROOT)/api" && composer clear-install

test:
	php "$(TOOLS_DIR)/test.php" all

test-api:
	php "$(TOOLS_DIR)/test.php" api

test-html:
	php "$(TOOLS_DIR)/test.php" html

fix-permissions:
	php "$(TOOLS_DIR)/set-permissions.php" "$(PROJECT_ROOT)"
