File: Makefile

package info (click to toggle)
wajig 4.1.3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 408 kB
  • sloc: python: 2,553; makefile: 146; sh: 117
file content (213 lines) | stat: -rw-r--r-- 5,228 bytes parent folder | download
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
########################################################################
#
# Makefile for wajig command line. 
#
# Time-stamp: <Thursday 2024-12-05 08:38:27 +1100 Graham Williams>
#
# Copyright (c) Graham.Williams@togaware.com
#
# License: Creative Commons Attribution-ShareAlike 4.0 International.
#
########################################################################

# App version numbers
#   Major release
#   Minor update
#   Trivial update or bug fix

APP=wajig
VER=4.1.3
DATE=$(shell date +%Y-%m-%d)

TAR_GZ = dist/$(APP)-$(VER).tar.gz

BASH_COMPLETION = $(APP)/bash_completion.d/$(APP).bash

SOURCE = setup.py			\
	 docs/README.md			\
	 setup.cfg			\
	 MANIFEST.in			\
	 LICENSE			\
	 $(APP)/constants.py		\
	 $(APP)/commands.py		\
	 $(APP)/debfile-deps.py		\
	 $(APP)/debfile.py			\
	 $(APP)/perform.py			\
	 $(APP)/shell.py			\
	 $(APP)/util.py			\
	 $(APP)/__init__.py		\
	 $(APP)/bash_completion.d/wajig.bash \

# Required modules.

INC_BASE    = support
INC_CLEAN   = $(INC_BASE)/clean.mk
INC_PANDOC  = $(INC_BASE)/pandoc.mk
INC_GIT     = $(INC_BASE)/git.mk
INC_LATEX   = $(INC_BASE)/latex.mk

ifneq ("$(wildcard $(INC_CLEAN))","")
  include $(INC_CLEAN)
endif
ifneq ("$(wildcard $(INC_R))","")
  include $(INC_R)
endif
ifneq ("$(wildcard $(INC_KNITR))","")
  include $(INC_KNITR)
endif
ifneq ("$(wildcard $(INC_PANDOC))","")
  include $(INC_PANDOC)
endif
ifneq ("$(wildcard $(INC_GIT))","")
  include $(INC_GIT)
endif
ifneq ("$(wildcard $(INC_AZURE))","")
  include $(INC_AZURE)
endif
ifneq ("$(wildcard $(INC_LATEX))","")
  include $(INC_LATEX)
endif
ifneq ("$(wildcard $(INC_PDF))","")
  include $(INC_PDF)
endif
ifneq ("$(wildcard $(INC_DOCKER))","")
  include $(INC_DOCKER)
endif
ifneq ("$(wildcard $(INC_MLHUB))","")
  include $(INC_MLHUB)
endif

define HELP
$(APP):

  install	NOT REQUIRED - already installed as 'pip install -e .'
  uninstall	Remove the local source installed version from ~/.local
  version	Update version from Makefile version number.

  pypi          Install onto PyPI for pip3 installation.
  deb           Build the debian package.

  snap		Build a snap.
  snapsh	Start a shell within multipass with the snap package.
  clean		Also performs snapcraft clean.

  access	Buld and copy deb to access.togaware.com
    azsync	Sync to deb@azure for building natively on Debian
    azbuild	Build the deb pacakge on the remote Debian server
    azget	Retrieve the built pacakge

  azstatus      VM status
  azup          Fire up the Azure server for Debian
  azdown	Shut down the Azure server.

endef
export HELP

help::
	@echo "$$HELP"

# modified from a version found at:
# savetheions.com/2010/01/20/packaging-python-applicationsmodules-for-debian/

DESTDIR ?= /home/$(USER)
PREFIX ?= /.local

LIBDIR = $(DESTDIR)$(PREFIX)/share/$(APP)
BINDIR = $(DESTDIR)$(PREFIX)/bin
MANDIR = $(DESTDIR)$(PREFIX)/share/man/man1

$(APP).sh: $(APP).sh.in
	sed -e 's|PREFIX|$(DESTDIR)$(PREFIX)|g' < $^ > $@

.PHONY: .version
version:
	sed -i -e "s|^    version='.*'|    version='$(VER)'|" setup.py 
	sed -i -e 's|^VERSION = ".*"|VERSION = "$(VER)"|' $(APP)/constants.py
	sed -i -e 's|^APP = ".*"|APP = "$(APP)"|' $(APP)/constants.py

# For testing a local install, install into
# ~/.local/share/wajig/wajig, with the __initi__.py in
# ~/.local/share/wajig, so it can call wajig.utils.

# 20230202 Use pip -e for local install now.

install: version $(APP).sh
	@echo "NOT REQUIRED. USE 'pip install -e .'"

uninstall:
	rm -rf $(LIBDIR)
	rm -f $(MANDIR)/$(APP).1
	rm -f $(BINDIR)/$(APP)

$(TAR_GZ): $(SOURCE)
	python3 setup.py sdist

.PHONY: tgz
tgz: $(TAR_GZ)

.PHONY: pypi
pypi: docs/README.md version tgz
	twine upload $(TAR_GZ)
	git tag v${VER} && git push --tags

# dch -v 3.0.0 will update version in changelog and allow entry.
# Might be some way to do this purely command line.

deb: version $(APP).sh
	sed -e 's|PREFIX|/usr|g' < $(APP).sh.in > $(APP).sh
	PREFIX=/usr dpkg-buildpackage -us -uc
	mv ../$(APP)_$(VER)_all.deb .
	mv ../$(APP)_$(VER)_amd64.buildinfo .
	mv ../$(APP)_$(VER)_amd64.changes .
	mv ../$(APP)_$(VER).dsc .
	mv ../$(APP)_$(VER).tar.xz .
	rm -f $(APP).sh

# 20230708 gjw az support has been removed.

azup:
	az vm start --resource-group deb --name deb

azdeb:
	rsync -avzh --delete ./ deb.australiacentral.cloudapp.azure.com:$(APP)/

azbuild: azdeb
	ssh deb.australiacentral.cloudapp.azure.com 'cd $(APP); make deb'

azget: azbuild
	scp deb.australiacentral.cloudapp.azure.com:$(APP)/$(APP)_$(VER)* .

azdown:
	az vm deallocate --resource-group deb --name deb

azstatus:
	az vm list --output table --show-details | egrep '(Name|----|deb)'

access: azget
	rsync --perms --chmod=u+rw,g+r,o+r $(APP)_$(VER)_all.deb togaware.com:apps/access/

# https://thecustomizewindows.com/2014/12/create-ubuntu-repository-ppa/

ppa: azget
	cd ppa
	dpkg-source -x ../$(APP)_$(VER).dsc
	cd $(APP)_$(VER)
	debuild -S -sa
	dput ppa:gjwkayon/ppa ../$(APP)_$(VER)_source.changes
.PHONY: snap
snap:
	snapcraft

snapsh:
	snapcraft prime --shell

clean::
	rm -rf $(APP)/__pycache__
	rm -f snap/*~
	snapcraft clean

realclean::
	rm -f $(APP)_$(VER)*

README.pdf: README.rst
	pandoc -V urlcolor=cyan -V geometry=a4paper -V lang=en-AU -V babel-lang=british --standalone --listings README.rst -o README.pdf