File: Makefile.in

package info (click to toggle)
calendar 2.04-1
  • links: PTS, VCS
  • area: main
  • in suites: buster, stretch
  • size: 2,564 kB
  • sloc: ml: 2,643; makefile: 200
file content (296 lines) | stat: -rw-r--r-- 7,999 bytes parent folder | download | duplicates (2)
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
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
##########################################################################
#                                                                        #
#  This file is part of Calendar.                                        #
#                                                                        #
#  Copyright (C) 2003-2011 Julien Signoles                               #
#                                                                        #
#  you can redistribute it and/or modify it under the terms of the GNU   #
#  Lesser General Public License version 2.1 as published by the         #
#  Free Software Foundation, with a special linking exception (usual     #
#  for Objective Caml libraries).                                        #
#                                                                        #
#  It is distributed in the hope that it will be useful,                 #
#  but WITHOUT ANY WARRANTY; without even the implied warranty of        #
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR                           #
#                                                                        #
#  See the GNU Lesser General Public Licence version 2.1 for more        #
#  details (enclosed in the file LGPL).                                  #
#                                                                        #
#  The special linking exception is detailled in the enclosed file       #
#  LICENSE.                                                              #
##########################################################################

# Used programs
###############

CAMLC	= @OCAMLC@
CAMLOPT	= @OCAMLOPT@
CAMLDEP	= @OCAMLDEP@
CAMLDOC	= @OCAMLDOC@
CAMLWEB	= @OCAMLWEB@
CAMLWC	= @OCAMLWC@
CAMLDOT	= @OCAMLDOT@
CAMLLIB	= @OCAMLLIB@
CAMLFIND= @OCAMLFIND@
CAMLMAJORVERSION= @OCAMLMAJOR@

# Object/Library File Extensions
OBJ_EXT = @OBJEXT@
LIB_EXT = @LIBEXT@

HAS_NATDYNLINK=@HAS_NATDYNLINK@

# Project
#########

NAME	= calendar
NAMELIB = calendarLib
VERSION	= 2.04
BUILD_DATE = `date`

LIBDIR	= target

LIBS	= $(LIBDIR)/$(NAMELIB).cmo $(LIBDIR)/$(NAMELIB).cma
CLIBS   =
ifneq ($(CAMLOPT),no)
LIBS   := $(LIBS) $(LIBDIR)/$(NAMELIB).cmx $(LIBDIR)/$(NAMELIB).cmxa
ifeq ($(HAS_NATDYNLINK),yes)
LIBS	:= $(LIBS) $(LIBDIR)/$(NAMELIB).cmxs
endif
CLIBS   := $(CLIBS) $(LIBDIR)/$(NAMELIB)$(OBJ_EXT) \
	$(LIBDIR)/$(NAMELIB)$(LIB_EXT)
endif

DIRS	= src target tests

SRC	= utils.mli utils.ml time_Zone.mli time_Zone.ml period.mli \
	time_sig.mli time.mli time.ml ftime.mli ftime.ml \
	date_sig.mli date.mli date.ml \
	calendar_sig.mli calendar_builder.mli calendar_builder.ml \
	calendar.mli calendar.ml fcalendar.mli fcalendar.ml \
	printer.mli printer.ml \
	version.mli version.ml
SRC	:= $(addprefix src/, $(SRC))

ML	= $(filter %.ml, $(SRC))
MLI	= $(filter %.mli, $(SRC))

CMO	= $(ML:.ml=.cmo)
CMX	= $(CMO:.cmo=.cmx)
CMI	= $(MLI:.mli=.cmi)
CMI_ONLY= src/period.cmi src/date_sig.cmi src/time_sig.cmi src/calendar_sig.cmi

GENERATED= src/version.ml

# Libs and flags
################

CAMLIBS	= $(addprefix -I , $(DIRS))

CAMLFLAGS= $(CAMLIBS)
BYTEFLAGS= $(CAMLFLAGS)
LINK_OPTFLAGS = $(CAMLFLAGS) -noassert
OPTFLAGS = $(LINK_OPTFLAGS) -for-pack CalendarLib

# Main rules
############

all: $(LIBS) META

$(LIBDIR)/$(NAMELIB).cmo: $(CMI_ONLY) $(CMO)
	mkdir -p $(LIBDIR)
	$(CAMLFIND) ocamlc $(BYTEFLAGS) -pack -o $@ \
		$(filter-out $(LIBDIR), $^)

$(LIBDIR)/$(NAMELIB).cma: $(LIBDIR)/$(NAMELIB).cmo
	$(CAMLFIND) ocamlc $(BYTEFLAGS) -a -o $@ $<

$(LIBDIR)/$(NAMELIB).cmx: $(CMI_ONLY) $(CMX)
	mkdir -p $(LIBDIR)
	$(CAMLFIND) ocamlopt $(LINK_OPTFLAGS) -pack -o $@ \
		$(filter-out $(LIBDIR), $^)

$(LIBDIR)/$(NAMELIB).a $(LIBDIR)/$(NAMELIB).cmxa: $(LIBDIR)/$(NAMELIB).cmx
	$(CAMLFIND) ocamlopt $(LINK_OPTFLAGS) -a -o $@ $<

$(LIBDIR)/$(NAMELIB).cmxs: $(LIBDIR)/$(NAMELIB).cmxa
	$(CAMLFIND) ocamlopt -I $(LIBDIR) -shared -linkall -o $@ $<

src/version.ml: Makefile
	echo "let version = \"$(VERSION)\"" > $@
	echo "let date = \"$(BUILD_DATE)\"" >> $@

META: Makefile
	echo "name = \"$(NAME)\"" > $@
	echo "description = \"$(NAME) library\"" >> $@
	echo "version = \"$(VERSION)\"" >> $@
	echo "archive(byte) = \"$(NAMELIB).cma\"" >> $@
	echo "archive(native) = \"$(NAMELIB).cmxa\"" >> $@
	echo "requires = \"unix str\"" >> $@

# Generic rules
###############

%.gz: %
	gzip -f --best $<

.SUFFIXES: .ml .mli .cmo .cmi .cmx $(OBJ_EXT)

.mli.cmi:
	$(CAMLC) $(BYTEFLAGS) -c $<

.ml.cmo:
	$(CAMLC) $(BYTEFLAGS) -c $<

.ml$(OBJ_EXT):
	$(CAMLOPT) $(OPTFLAGS) -c $<

.ml.cmx:
	$(CAMLOPT) $(OPTFLAGS) -c $<

# Tests
#######

TESTS_SRC= gen_test.mli gen_test.ml test_timezone.ml test_time.ml \
	test_ftime.ml test_date.ml test_calendar.ml test_fcalendar.ml \
	test_pcalendar.ml test_fpcalendar.ml test_printer.ml test.ml
TESTS_SRC:= $(addprefix tests/, $(TESTS_SRC))

TESTS_ML= $(filter %.ml, $(TESTS_SRC))
TESTS_CMO= $(TESTS_ML:.ml=.cmo)

$(TESTS_CMO) $(TESTS_CMI): $(LIBDIR)/$(NAMELIB).cmo $(LIBDIR)/$(NAMELIB).cmi

tests/test: $(LIBDIR)/$(NAMELIB).cmo $(TESTS_CMO)
	$(CAMLC) -o $@ $(BYTEFLAGS) unix.cma str.cma $(LIBDIR)/$(NAMELIB).cmo \
		$(TESTS_CMO)

.PHONY: tests
tests: tests/test
	./$<

# Documentation
###############

wc: $(SRC)
	$(CAMLWC) -p $^

$(NAMELIB).ps: $(SRC)
	$(CAMLWEB) --ps -o $@ $^

ifeq ($(CAMLMAJORVERSION),3)
utils/example.ml: utils/example.ml.3 Makefile
	cp $< $@
else
utils/example.ml: utils/example.ml.4 Makefile
	cp $< $@
endif

utils/example.cmo: utils/example.ml
	$(CAMLC) -I +ocamldoc -I utils -c $<

.PHONY: doc
doc: $(CMO) utils/example.cmo
	mkdir -p doc
	rm -f doc/*
	$(CAMLDOC) -g utils/example.cmo -colorize-code -I src -d doc \
		$(MLI) $(ML)

# Headers
#########

.PHONY: headers
headers:
	headache -c headache_config.txt -h HEADER $(SRC) $(TESTS_SRC) \
	  Makefile.in utils/example.ml
	headache -c headache_config.txt -h CONFIGURE_HEADER configure.in

# Install
#########

install: $(LIBS) $(CLIBS) META
	@if [ "`sed -n -e 's/version = "\([0-9.+dev]*\)"/\1/p' META`" = "$(VERSION)" ]; then \
	  (if test -d `ocamlfind install -help | grep destdir | sed -e "s/.*default: \(.*\))/\1/"`/$(NAME); then $(MAKE) uninstall; fi;\
	  $(CAMLFIND) install $(NAME) target/*.cm* $(MLI) $(CLIBS) META); \
	else \
	  (echo; echo "Not the good version. Please, do :"; \
	   echo "  make clean && make"; \
	   echo "next reinstall"; echo) \
	fi

uninstall:
	$(CAMLFIND) remove $(NAME)

# Exporting
###########

EXPORT_DIR= $$HOME/EXPORT/$(NAME)
TMP_DIR	= $$HOME/tmp

ROOT= $$HOME/DEV/calendar

export: doc
	(cd $(TMP_DIR); \
	  svn co svn+ssh://signoles@svn.forge.ocamlcore.org/svnroot/calendar/trunk)
	svn copy $(TMP_DIR)/trunk $(ROOT)/tags/v$(VERSION)
	rm -rf $(TMP_DIR)/trunk
	(cd $(ROOT)/tags; svn commit -m "v $(VERSION)")
	rm -rf $(EXPORT_DIR)/doc
	mkdir -p $(EXPORT_DIR)
	cp -rf CHANGES doc $(EXPORT_DIR)
	cp -rf $(ROOT)/tags/v$(VERSION) $(TMP_DIR)/$(NAME)-$(VERSION)
	cp -rf .depend configure config.status doc $(TMP_DIR)/$(NAME)-$(VERSION)
	cd $(TMP_DIR); \
	  (rm -rf $(NAME)-$(VERSION)/.svn $(NAME)-$(VERSION)/*/.svn; \
	   tar cvf $(NAME)-$(VERSION).tar $(NAME)-$(VERSION); \
	   gzip -f --best $(NAME)-$(VERSION).tar; \
	   rm -rf $(NAME)-$(VERSION); \
	   mv $(NAME)-$(VERSION).tar.gz $(EXPORT_DIR))
	rm -rf $(TMP_DIR)/$(NAME)-$(VERSION)

# Rebuilding Makefile
#####################

Makefile: Makefile.in
	./config.status

config.status: configure
	./config.status --recheck

configure: configure.in
	autoconf

# Emacs tags
############

TAGS: $(SRC)
	otags -o $@ $^

# Cleaning
##########

clean:
	rm -f TAGS META $(TESTS) tests/test $(GENERATED)
	for i in . src tests utils; do \
	  rm -f $$i/*~ $$i/\#* $$i/*.cm[iox] $$i/*.*a $$i/*$(OBJ_EXT) $$i/a.out; \
	done
	rm -f utils/example.ml

dist-clean distclean: clean
	rm -rf $(NAME).ps.gz doc $(LIBDIR)

clean-configure cleanconfig: dist-clean
	rm -f Makefile configure config.*

# Depend
########

.depend depend: $(GENERATED)
	rm -f .depend
	$(CAMLDEP) -I src -I tests src/*.ml src/*.mli tests/*.ml tests/*.mli \
	  > .depend

view-depend:
	$(CAMLDOT) .depend | dot -Tps | gv -

include .depend