-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile.local
101 lines (81 loc) · 2.82 KB
/
Makefile.local
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
# Copyright (c) 2015 Richard Mortier <[email protected]>
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.PHONY: setup-clean setup clean uninstall tftpd \
gh-pages opam test-opam pr release update-release publish
## Oasis targets
setup-clean: clean distclean
oasis setup-clean
$(RM) setup.* _tags configure myocamlbuild.ml
$(RM) lib/META lib/*.ml*lib lib/*.mlpack
setup.ml: _oasis
oasis setup
setup: setup.ml setup.data
## Mirage targets
clean:
$(SETUP) -clean $(CLEANFLAGS)
[ -r bin/Makefile ] && mirage clean bin/config.ml || true
$(RM) log bin/tftpd
uninstall:
ocaml setup.ml -uninstall $(UNINSTALLFLAGS)
ocamlfind remove tftp
tftpd: bin/tftpd
bin/tftpd: bin/Makefile bin/tftpd.ml \
$(wildcard lib/*.ml) $(wildcard mirage/*.ml)
mirage build bin/config.ml
cp bin/_build/main.native bin/tftpd
bin/Makefile: bin/config.ml
mirage configure --unix bin/config.ml $(MIRFLAGS)
## Documentation
doc/html/.git:
mkdir -p doc/html
cd doc/html && ( \
git init && \
git remote add origin [email protected]:mor1/ocaml-tftp.git && \
git checkout -B gh-pages \
)
gh-pages: doc/html/.git
cd doc/html && git checkout -B gh-pages
rm -f doc/html/*
$(MAKE) doc && cp tftp.docdir/* doc/html/
cd doc/html && ( \
git add * && \
git commit -a -m "Documentation updates" && \
git push origin gh-pages \
)
## Release targets
VERSION = $(shell grep '^Version:' _oasis | sed 's/Version: *//')
NAME = $(shell grep '^Name:' _oasis | sed 's/Name: *//')
ARCHIVE = https://github.com/mor1/ocaml-tftp/archive/$(VERSION).tar.gz
opam: release publish pr
release:
git tag -a $(VERSION) -m "Version $(VERSION)."
git push upstream $(VERSION)
update-release:
git push upstream master
git tag -f $(VERSION) -m "Version $(VERSION)."
git push --force upstream $(VERSION)
publish:
OPAMYES=1 opam pin add -n .
opam publish prepare $(NAME).$(VERSION) $(ARCHIVE)
pr:
OPAMYES=1 opam pin add -n $(NAME) $(NAME).$(VERSION)
opam publish submit $(NAME).$(VERSION) && $(RM) -r $(NAME).$(VERSION)
test-opam:
opam switch system
opam switch remove test-opam -y
opam switch test-opam -A system -y
eval $$(opam config env)
opam pin add tftp . -k git -y
opam switch system
eval $$(opam config env)