# Calendar library
# Copyright (C) 2003 Julien SIGNOLES
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License version 2, as published by the Free Sofware Foundation.
#
# This library 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 PURPOSE.
#
# See the GNU Library General Public License version 2 for more details
#
# $Id: Makefile.in,v 1.50 2006-07-07 13:48:10 signoles Exp $
# Used programs
###############
CAMLC = @OCAMLC@
CAMLOPT = @OCAMLOPT@
CAMLDEP = @OCAMLDEP@
CAMLDOC = @OCAMLDOC@
CAMLWEB = @OCAMLWEB@
CAMLWC = @OCAMLWC@
CAMLDOT = @OCAMLDOT@
CAMLLIB = @OCAMLLIB@
CAMLFIND= @OCAMLFIND@
# Project
#########
NAME = calendar
VERSION = 1.09.6
ifeq ($(CAMLOPT),no)
LIBS = src/$(NAME).cma
CLIBS =
else
LIBS = src/$(NAME).cma src/$(NAME).cmxa
CLIBS = src/$(NAME).a
endif
DIRS = src
SRC = time_Zone.mli time_Zone.ml period.mli \
time.mli time.ml date.mli date.ml calendar.mli calendar.ml \
printer.mli printer.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)
GENERATED=
# Libs and flags
################
CAMLIBS = -I $(DIRS)
CAMLFLAGS= $(CAMLIBS)
BYTEFLAGS= $(CAMLFLAGS)
OPTFLAGS = $(CAMLFLAGS) -noassert
# Main rules
############
all: $(LIBS) META
src/$(NAME).cma: $(CMO)
$(CAMLFIND) ocamlc $(BYTEFLAGS) -a -o $@ $^
src/$(NAME).a src/$(NAME).cmxa: $(CMX)
$(CAMLFIND) ocamlopt $(OPTFLAGS) -a -o $@ $^
META: Makefile
echo "description = \"$(NAME) library\"" > $@
echo "version = \"$(VERSION)\"" >> $@
echo "archive(byte) = \"$(NAME).cma\"" >> $@
echo "archive(native) = \"$(NAME).cmxa\"" >> $@
echo "requires = \"unix\"" >> $@
# Generic rules
###############
%.gz: %
gzip -f --best $<
.SUFFIXES: .ml .mli .cmo .cmi .cmx .o
.mli.cmi:
$(CAMLC) $(BYTEFLAGS) -c $<
.ml.cmo:
$(CAMLC) $(BYTEFLAGS) -c $<
.ml.o:
$(CAMLOPT) $(OPTFLAGS) -c $<
.ml.cmx:
$(CAMLOPT) $(OPTFLAGS) -c $<
# Tests
#######
TESTS = test_timezone test_time test_date test_calendar test_printer
TESTS := $(addprefix tests/, $(TESTS))
TESTS_CMO= $(addsuffix .cmo, $(TESTS))
$(TESTS_CMO): tests/gen_test.cmo
tests/test.cmo: $(TESTS_CMO)
tests/test: src/$(NAME).cma tests/test.cmo
$(CAMLC) -o $@ $(BYTEFLAGS) unix.cma src/$(NAME).cma \
tests/gen_test.cmo $(TESTS_CMO) tests/test.cmo
.PHONY: tests
tests: BYTEFLAGS := $(BYTEFLAGS) -I tests
tests: tests/test
./$<
# Documentation
###############
wc: $(SRC)
$(CAMLWC) -p $^
$(NAME).ps: $(SRC)
$(CAMLWEB) --ps -o $@ $^
.PHONY: doc
doc: $(CMO)
mkdir -p doc
rm -f doc/*
$(CAMLDOC) -I src -d doc -html $(MLI) $(ML)
# Install
#########
install: $(LIBS) $(CLIBS) META
@if [ "`sed -n -e 's/version = "\([0-9.]*\)"/\1/p' META`" = "$(VERSION)" ]; then \
(if test -d $(CAMLLIB)/site-lib/$(NAME); then $(MAKE) uninstall; fi;\
$(CAMLFIND) install $(NAME) $(LIBS) $(CLIBS) $(MLI) $(CMI) 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/WWW/prog/calendar
export: doc #$(NAME).ps.gz
cvs export -d /tmp/$(NAME)-$(VERSION) -D now $(NAME)
rm -rf $(EXPORT_DIR)/doc
cp -rf .depend configure doc /tmp/$(NAME)-$(VERSION)
cp -rf CHANGES doc $(EXPORT_DIR)
cd /tmp; \
(rm -f $(NAME)-$(VERSION)/html/touch-html \
$(NAME)-$(VERSION)/.cvsignore; \
tar cvf $(NAME)-$(VERSION).tar $(NAME)-$(VERSION); \
gzip -f --best $(NAME)-$(VERSION).tar; \
rm -rf $(NAME)-$(VERSION); \
mv $(NAME)-$(VERSION).tar.gz $(EXPORT_DIR))
cd $(EXPORT_DIR)/../..; \
(rm -f calendar.*.tex; \
$(MAKE) CALVERS=$(VERSION))
# Rebuilding Makefile
#####################
Makefile: Makefile.in config.status
./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; do \
rm -f $$i/*~ $$i/\#* $$i/*.cm[iox] $$i/*.*a $$i/*.o $$i/a.out; \
done
dist-clean distclean: clean
rm -rf $(NAME).ps.gz doc
clean-configure cleanconfig: dist-clean
rm -f Makefile configure config.*
# Depend
########
depend:
rm -f .depend
for i in src tests; do \
$(CAMLDEP) $(CAMLIBS) $$i/*.ml $$i/*.mli; \
done > .depend
view-depend:
$(CAMLDOT) .depend | dot -Tps | gv -
include .depend
syntax highlighted by Code2HTML, v. 0.9.1