This repository has been archived by the owner on Jul 30, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
67 lines (48 loc) · 2.41 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
# =============================================================================
# @file Makefile
# @brief Makefile for some steps in creating a Lost It! application
# @author Michael Hucka
# @date 2018-09-13
# @license Please see the file named LICENSE in the project directory
# @website https://github.com/caltechlibrary/lostit
# =============================================================================
# Variables -------------------------------------------------------------------
release := $(shell egrep 'version.*=' lostit/__version__.py | awk '{print $$3}' | tr -d "'")
platform := $(shell python3 -c 'import sys; print(sys.platform)')
distro := $(shell python3 -c 'import distro; print(distro.linux_distribution(False)[0])')
linux_vers := $(shell python3 -c 'import distro; print(distro.linux_distribution(False)[1])' | cut -f1-2 -d'.')
macos_vers := $(shell sw_vers -productVersion 2>/dev/null | cut -f1-2 -d'.' || true)
github-css := dev/github-css/github-markdown-css.html
about-file := ABOUT.html
help-file := lostit/data/help.html
# Main build targets ----------------------------------------------------------
build: | dependencies data-files build-$(platform)
# Platform-specific instructions ----------------------------------------------
build-darwin: $(about-file) $(help-file) dist/LostIt.app
packagesbuild dev/installers/macos/LostIt.pkgproj
mv dist/LostIt.pkg dist/LostIt-$(release)-macos-$(macos_vers).pkg
build-linux: dist/lostit
(cd dist; tar czf LostIt-$(release)-$(distro)-$(linux_vers).tar.gz lostit)
dist/LostIt.app:
pyinstaller --clean pyinstaller-$(platform).spec
sed -i '' -e 's/0.0.0/$(release)/' dist/LostIt.app/Contents/Info.plist
rm -f dist/LostIt.app/Contents/Info.plist.bak
rm -f dist/lostit
dependencies:;
pip3 install -r requirements.txt
data-files: $(about-file) $(help-file)
# Component files placed in the installers ------------------------------------
# Temporary link so that the generic .md -> .html rule works for ABOUT.html.
ABOUT.md: README.md
ln -s ${<F} ${@F}
%.html: %.md
pandoc --standalone --quiet -f gfm -H $(github-css) -o $@~ $<
inliner -n < $@~ > $@
rm -f $@~
# Miscellaneous directives ----------------------------------------------------
clean: clean-dist clean-html
clean-dist:;
-rm -fr dist/LostIt.app dist/LostIt.pkg dist/lostit build
clean-html:;
-rm -fr ABOUT.md ABOUT.html lostit/data/help.html tmp.html
.PHONY: html clean clean-dist clean-html