-
Notifications
You must be signed in to change notification settings - Fork 1
/
makefile
76 lines (65 loc) · 3.1 KB
/
makefile
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/usr/bin/make
PROJECT = livemap
PATH_PROJECT = $(DESTDIR)/var/www/$(PROJECT)
PATH_PUBLIC = $(PATH_PROJECT)/public
SEARCH_ENGINE_DIR = manticoresearch
SEARCH_ENGINE_PROJECT = livemap
help:
@perl -e '$(HELP_ACTION)' $(MAKEFILE_LIST)
dchr: ##@development Publish release
@dch --controlmaint --release --distribution unstable
dchv: ##@development Append release
@export DEBEMAIL="[email protected]" && \
export DEBFULLNAME="Karel Wintersky" && \
echo "$(YELLOW)------------------ Previous version header: ------------------$(GREEN)" && \
head -n 3 debian/changelog && \
echo "$(YELLOW)--------------------------------------------------------------$(RESET)" && \
read -p "Next version: " VERSION && \
dch --controlmaint -v $$VERSION
update: ##@build Update project from GIT
@echo Updating project from GIT
git pull
build: ##@build Build project to DEB Package
@echo Building project to DEB-package
export COMPOSER_HOME=/tmp/ && dpkg-buildpackage -rfakeroot --no-sign #--compression=xz
@rm ./configure-stamp ./build-stamp
make_deb: update build ##@build Update project and build
rebuild_rt: ##@localhost Rebuild RT indexes only
@php $(PATH_PROJECT)/admin.tools/tool.rebuild_rt_indexes.php
setup_env: ##@localhost Setup environment at localhost
@echo Setting up local environment
@mkdir -p $(PATH_PROJECT)/cache
@mkdir -p $(PATH_PROJECT)/config
@mkdir -p $(PATH_PROJECT)/logs
install: ##@system Install package. Don't run it manually!!!
@echo Installing...
install -d $(PATH_PROJECT)
cp -r admin.cron $(PATH_PROJECT)
cp -r admin.tools $(PATH_PROJECT)
cp -r engine $(PATH_PROJECT)
cp -r public $(PATH_PROJECT)
cp -r templates $(PATH_PROJECT)
cp -r composer.json $(PATH_PROJECT)
cp debian/makefile.production $(PATH_PROJECT)/makefile
git rev-parse --short HEAD > $(PATH_PROJECT)/_version
git log --oneline --format=%B -n 1 HEAD | head -n 1 >> $(PATH_PROJECT)/_version
git log --oneline --format="%at" -n 1 HEAD | xargs -I{} date -d @{} +%Y-%m-%d >> $(PATH_PROJECT)/_version
cd $(PATH_PROJECT)/ && composer install && rm composer.json
mkdir -p $(DESTDIR)/etc/$(SEARCH_ENGINE_DIR)/conf.d/$(SEARCH_ENGINE_PROJECT)
# cp -r config.searchd/* $(DESTDIR)/etc/$(SEARCH_ENGINE_DIR)/conf.d/$(SEARCH_ENGINE_PROJECT)/
# chown -R manticore:manticore $(DESTDIR)/etc/$(SEARCH_ENGINE_DIR)/conf.d/$(SEARCH_ENGINE_PROJECT)/
install -d $(PATH_PROJECT)/cache
install -d $(PATH_PROJECT)/logs
# ------------------------------------------------
# Add the following 'help' target to your makefile, add help text after each target name starting with '\#\#'
# A category can be added with @category
GREEN := $(shell tput -Txterm setaf 2)
YELLOW := $(shell tput -Txterm setaf 3)
WHITE := $(shell tput -Txterm setaf 7)
RESET := $(shell tput -Txterm sgr0)
HELP_ACTION = \
%help; while(<>) { push @{$$help{$$2 // 'options'}}, [$$1, $$3] if /^([a-zA-Z\-_]+)\s*:.*\#\#(?:@([a-zA-Z\-]+))?\s(.*)$$/ }; \
print "usage: make [target]\n\n"; for (sort keys %help) { print "${WHITE}$$_:${RESET}\n"; \
for (@{$$help{$$_}}) { $$sep = " " x (32 - length $$_->[0]); print " ${YELLOW}$$_->[0]${RESET}$$sep${GREEN}$$_->[1]${RESET}\n"; }; \
print "\n"; }
# -eof-