Makefile.dev 3.29 KB
Newer Older
1
2
#######################################################################################
# Workflow:
erwan's avatar
erwan committed
3
4
5
6
7
8
# C=git commit ;  A=git amend ; U=update_version ; P=opam pack
# - to make sure the sha and the version are good, one should never
#   do U and then A.
# - to make sure gtit is not confused, one should never do A and the P
#
# thereforeto avoid such problems, legal trace are defined by this automata:
9
10
# 0 -C-> 1
# 1 -A-> 1
erwan's avatar
erwan committed
11
12
# 1 -P-> 2
# 2 -U-> 0
13
14
# 1 -U-> 0
# to implement such a workflow, C puts a lock (state 1) and U removes it (state 0)
erwan's avatar
erwan committed
15

16
17
18
19
20
21
22
23
24
25
26
27
28
29
###############################
# a few git shortcuts

uv:update_version
update_version:
	rm -f lutin/src/version.ml
	make lutin/src/version.ml
	cp _oasis _oasis.save
	cat _oasis.save | sed "s/^Version:.*/Version:     $(VERSION)/" > _oasis
	rm -f committed
	git add lutin/src/version.ml  _oasis
	make clean && make


30
31
cia: test cia-no-test
cia-no-test:
32
33
34
35
36
	test -f committed && \
   echo "*** I won't commit!\n*** until you 'make update_version'!" \
      || (git commit -a -F log && touch committed)


37
push: opam-test
erwan's avatar
erwan committed
38
39
40
	git push && make uv


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
amend:
	test -f committed && git commit -a -F log --amend 

dif:
	git --no-pager diff  --color-words
diff:dodiff
	echo "il y a $(shell grep "+" diff.diff | wc -l) + et $(shell grep "-" diff.diff | wc -l) -"

dodiff:
	git diff HEAD -w  > diff.diff 


# diff of the lastly commited change
cdiff:
	git diff -w "HEAD^" HEAD > diff.diff


###############################
# tags

OTAGS=otags
# otags don't manage to parse gnuplotRif.ml
NO_TAGS=gnuplotRif.ml
tags:
	$(OTAGS) -v $(shell ocamlc -where)/*.mli  $(shell ls src/*.ml | grep -v $(NO_TAGS))


###############################
# opam-ing

NAME=lutin
PACKNAME=$(NAME).$(PRE_VERSION)
WWW=/import/www/DIST-TOOLS/SYNCHRONE
HTTP=http://www-verimag.imag.fr/DIST-TOOLS/SYNCHRONE

76
77
78
79
# for testing opam packages before publishing
WWWTEST=/import/www/DIST-TOOLS/SYNCHRONE/test
HTTPTEST=http://www-verimag.imag.fr/DIST-TOOLS/SYNCHRONE/test

80
81
82
83
84
85
86
$(PACKNAME).tgz:
	git archive --prefix=$(PACKNAME)/ -o $(PACKNAME).tgz HEAD

$(WWW)/pool/$(PACKNAME).tgz: $(PACKNAME).tgz
	mv $^ $@ 


87
88
89
$(WWWTEST)/pool/$(PACKNAME).tgz: $(PACKNAME).tgz
	mv $^ $@ 

90
OPAM_FILE=`find  $(WWW)/opam-repository/packages -name opam -cmin -1 | sed -e 's/^./\U&/'`
91
92
93
opam : $(WWW)/pool/$(PACKNAME).tgz
	cd $(WWW)/opam-repository/packages && \
	oasis2opam   $(HTTP)/pool/$(PACKNAME).tgz && \
94
95
	echo "OPAM_FILE=$(OPAM_FILE)" && \
	cat $(OPAM_FILE) | ocaml $(PWD)/utils/fixopam_file.ml > $(OPAM_FILE)-fixed && \
96
	cp $(OPAM_FILE) $(OPAM_FILE).save && \
97
	cp $(OPAM_FILE)-fixed $(OPAM_FILE) && \
98
	cd .. ; opam-admin check  && opam-admin make -g
99

100
101
102
103
104
105
106
107
108
OPAM_FILE_TEST=`find  $(WWWTEST)/opam-repository/packages -name opam -cmin -1 | sed -e 's/^./\U&/'`
opam-test : $(WWWTEST)/pool/$(PACKNAME).tgz
	cd $(WWWTEST)/opam-repository/packages && \
	oasis2opam  $(HTTPTEST)/pool/$(PACKNAME).tgz && \
	echo "OPAM_FILE_TEST=$(OPAM_FILE_TEST)" && \
	cat $(OPAM_FILE_TEST) | ocaml $(PWD)/utils/fixopam_file.ml > $(OPAM_FILE_TEST)-fixed && \
	cp $(OPAM_FILE_TEST) $(OPAM_FILE_TEST).save && \
	cp $(OPAM_FILE_TEST)-fixed $(OPAM_FILE_TEST) && \
	cd .. ; opam-admin check  && opam-admin make -g
109

110
.PHONY:install $(WWW)/pool/$(PACKNAME).tgz  $(WWWTEST)/pool/$(PACKNAME).tgz
111
112
113
114
115
116
117
118
119
oi:install
or:reinstall
ob:build
oc:clean
clean:
	ocaml setup.ml -clean
	rm -f setup.data
	cd polka; make clean
	cd lutin-utils/src/ ; make clean