-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
117 lines (96 loc) · 3.76 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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
# KeyParaStocX Makefile
#
# Copyright (C) 2023-2024 Bogdan 'bogdro' Drozdowski, bogdro (at) users . sourceforge . net
#
# This file is part of KeyParaStocX (Keyword-based Paragraph Styling and
# Table of Contents eXtension), an OpenOffice / LibreOffice extension that
# searches for the configured keywords in a text, changes their style and
# builds a Table of Contents for them.
#
# Project homepage: https://keyparastocx.sourceforge.io/
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 3
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
NAME = KeyParaStocX
IDENTIFIER = vnd.bogdandrozdowski.keyparastocx
VER = 1.0.1
RMDIR = /bin/rm -fr
# when using '-p', no error is generated when the directory exists
MKDIR = /bin/mkdir -p
COPY = /bin/cp -pRf
SED = /bin/sed
SED_OPTS = -i
GREP = /bin/grep
AWK = /usr/bin/awk
PYTHON = /usr/bin/python
PYTEST = /usr/bin/pytest
# Use the GNU tar format
# ifneq ($(shell tar --version | grep -i bsd),)
# PACK1_GNUOPTS = --format gnutar
# endif
PACK1 = /bin/tar $(PACK1_GNUOPTS) -vcf
PACK1_EXT = .tar
PACK2 = /usr/bin/gzip -9 -f
PACK2_EXT = .gz
OFFICE_PACK = zip -r -9
OFFICE_PACK_EXT = .oxt
ifeq ($(OFFICEDIR),)
OFFICEDIR = /opt/openoffice
endif
UNOPKG = $(OFFICEDIR)/program/unopkg
EXTENSION_FILES = $(NAME) Addons.xcu components description.xml icons \
KeyParaStocX-dialog META-INF Office pkg-desc registration COPYING
DIST_FILES = $(EXTENSION_FILES) AUTHORS ChangeLog INSTALL Makefile NEWS \
README test
TESTS = test/test_load.py
TMP_CFG_FILE = KeyParaStocX-dialog/config-data-tmp.xcu
SUBST_VERSION = $(SED) $(SED_OPTS) "s/@@VERSION@@/$(VER)/g"
SUBST_ID = $(SED) $(SED_OPTS) "s/@@IDENTIFIER@@/$(IDENTIFIER)/g"
all: dist
dist: dist-bin dist-src
dist-bin: $(NAME)-$(VER)$(OFFICE_PACK_EXT)
$(NAME)-$(VER)$(OFFICE_PACK_EXT): $(shell find $(EXTENSION_FILES) -type f) \
Makefile
$(RMDIR) $(NAME)-$(VER) $(NAME)-$(VER)$(OFFICE_PACK_EXT)
$(MKDIR) $(NAME)-$(VER)
$(COPY) $(EXTENSION_FILES) $(NAME)-$(VER)
find $(NAME)-$(VER) -name .gitignore -exec $(RMDIR) '{}' \;
find $(NAME)-$(VER) -type f -exec $(SUBST_VERSION) '{}' \;
find $(NAME)-$(VER) -type f -exec $(SUBST_ID) '{}' \;
$(COPY) KeyParaStocX-dialog/config-data.xcu $(TMP_CFG_FILE)
$(SED) $(SED_OPTS) 's/$$/\\/' $(TMP_CFG_FILE)
$(SED) $(SED_OPTS) '/p.Parse(/ r $(TMP_CFG_FILE)' $(NAME)-$(VER)/components/Config.py
$(RMDIR) $(TMP_CFG_FILE)
cd $(NAME)-$(VER) && $(OFFICE_PACK) ../$(NAME)-$(VER)$(OFFICE_PACK_EXT) .
$(RMDIR) $(NAME)-$(VER)
dist-src: $(NAME)-$(VER)$(PACK1_EXT)$(PACK2_EXT)
$(NAME)-$(VER)$(PACK1_EXT)$(PACK2_EXT): $(shell find $(DIST_FILES) -type f) \
Makefile
$(RMDIR) $(NAME)-$(VER) $(NAME)-$(VER)$(PACK1_EXT)$(PACK2_EXT)
$(MKDIR) $(NAME)-$(VER)
$(COPY) $(DIST_FILES) $(NAME)-$(VER)
find $(NAME)-$(VER) -name .gitignore -exec $(RMDIR) '{}' \;
$(PACK1) $(NAME)-$(VER)$(PACK1_EXT) $(NAME)-$(VER)
$(PACK2) $(NAME)-$(VER)$(PACK1_EXT)
$(RMDIR) $(NAME)-$(VER)
install: $(NAME)-$(VER)$(OFFICE_PACK_EXT)
$(UNOPKG) add $(NAME)-$(VER)$(OFFICE_PACK_EXT)
check:
PYTHONPATH=`$(PYTHON) -m sysconfig | $(GREP) purelib | $(AWK) '{print $$3}' | $(SED) 's/"//g'`:. \
$(OFFICEDIR)/program/python $(PYTEST) $(TESTS)
uninstall:
$(UNOPKG) remove $(IDENTIFIER)
verify-install:
$(UNOPKG) list $(IDENTIFIER)
.PHONY: all check dist dist-bin dist-src install uninstall verify-install