-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
22 lines (18 loc) · 952 Bytes
/
Copy pathMakefile
File metadata and controls
22 lines (18 loc) · 952 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# Makefile for installing cmdlineapp.php - https://github.com/rorabr/cmdlineapp.php
# Must be run as root to install in PHP's library directory
f=cmdlineapp.php
php=$(shell which php)
src=src/${f}
all: check install
# perform some checks on the source, php and destination
check:
$(if ${php},,$(error php executable not found))
$(if $(wildcard ${src}),,$(error source file ${src} not found, make sould be run in the project\'s main directory))
$(eval dst := $(shell php -r '$$a=explode(":",get_include_path());while(($$p=array_shift($$a))=="."){}print $$p;'))
$(if ${dst},,$(error instalation directory could not be determined by PHP\'s include paths))
$(eval owner := $(shell ls -lad ${dst} | awk '{print $$3}'))
$(eval group := $(shell ls -lad ${dst} | awk '{print $$4}'))
@echo "Instalation checks ok"
install: check
install -D --mode=0644 --owner=${owner} --group=${group} ${src} ${dst}/rora/${f}
@echo "File ${f} installed on ${dst}"