File: Makefile

package info (click to toggle)
wajig 4.0.3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 408 kB
  • sloc: python: 2,462; makefile: 145; sh: 111
file content (206 lines) | stat: -rw-r--r-- 4,961 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
########################################################################
#
# Makefile for wajig command line. 
#
# Time-stamp: <Tuesday 2021-10-26 09:04:50 AEDT 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.0.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    = $(HOME)/.local/share/make
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	Install the current source version of $(APP) into ~/.local
  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.

  azup          Fire up the Azure server for Debian
  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
  azdown	Shutdown the Azure server

  azlist        List VM status

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.

install: version $(APP).sh
	install -d  $(LIBDIR)/wajig $(BINDIR) $(MANDIR)
	install -D $(APP)/*.py  $(LIBDIR)/wajig/
	mv $(LIBDIR)/wajig/__init__.py $(LIBDIR)
	install -D $(APP).1  $(MANDIR)/
	install -D $(APP).sh $(BINDIR)/$(APP)
	rm $(APP).sh

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)

# 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

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

azlist:
	az vm list --output table --show-details

# 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)*