-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
88 lines (66 loc) · 3.32 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
77
78
79
80
81
82
83
84
85
86
87
88
#!/usr/bin/make
SHELL = /bin/bash
DIR_SOURCES="$(PWD)/sources"
FILE_SOURCE="kw_sitemapgenerator.php"
DIR_PRODUCTION=$(PWD)/production
FILE_PRODUCTION="$(DIR_PRODUCTION)/sitemapgenerator"
PROJECT=kwsitemapgenerator
VAR_ROOT=$(DESTDIR)/usr/local/bin
help:
@perl -e '$(HELP_ACTION)' $(MAKEFILE_LIST)
update: ##@build Update project from GIT
@echo Updating project from GIT
git pull
build_local: ##@build Cook v2 version
@mkdir -p $(DIR_PRODUCTION)
@echo 'Generating all-in-one php-file'
@echo '#!/usr/bin/php' > $(FILE_PRODUCTION)
@cat $(DIR_SOURCES)/$(FILE_SOURCE) >> $(FILE_PRODUCTION)
@echo 'Encapsulating class.SitemapSystem.php'
@cp $(DIR_SOURCES)/class.SitemapSystem.php __tmp__.php
@sed -i "1s/.*/\/\*\*\//" __tmp__.php
@sed -i -e "/class\.SitemapSystem\.php/{r __tmp__.php" -e 'd}' $(FILE_PRODUCTION)
@echo 'Encapsulating class.SitemapFileSaver.php'
@cp $(DIR_SOURCES)/class.SitemapFileSaver.php __tmp__.php
@sed -i "1s/.*/\/\*\*\//" __tmp__.php
@sed -i -e "/class\.SitemapFileSaver\.php/{r __tmp__.php" -e 'd}' $(FILE_PRODUCTION)
@rm -f __tmp__.php
@echo 'Ok.'
@echo "$(FILE_PRODUCTION) Generated"
@echo
install: build_local ##system Install sitemap generator to /usr/local/bin, required sudo
install -d $(VAR_ROOT)
cp $(FILE_PRODUCTION) $(VAR_ROOT)/sitemapgenerator
chmod +x $(VAR_ROOT)/sitemapgenerator
build: ##@build Build project to DEB Package
@echo 'Building project to DEB-package'
export DEBFULLNAME="Karel Wintersky" && export DEBEMAIL="[email protected]" && dpkg-buildpackage -rfakeroot --build=binary --sign-key=5B880AAEA75CA9F4AC7FB42281C5D6EECDF77864
build_unsigned: ##@build_unsigned Build unsigned DEB Package (for AJUR Repository)
@echo 'Building DEB-package for AJUR Repository'
dpkg-buildpackage -rfakeroot --build=binary --no-sign
build_seed:
@echo Building SEED SQL file for tests
# ключ `--controlmaint` (сокр `-M`) в dch позволяет использовать для релизной подписи значение пол maintainer из debian/control (это может быть удобнее, чем указывать DEBEMAIL/DEBFULLNAME
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 -v $$VERSION
dchr: ##@development Publish release
@dch --controlmaint --release --distribution stable
# ------------------------------------------------
# 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-