Plasma GitLab Archive
Projects Blog Knowledge

static. =
	EXTRAFLAGS =
	ConfMsgChecking(for -safe-string)
	if $(equal $(shell-code ocamlc -safe-string >& /dev/null), 0)
	    EXTRAFLAGS += -safe-string
	    ConfMsgResult(yes)
	    export
	else
	    ConfMsgResult(no)

VERSION = 1.1.2

trunk = https://godirepo.camlcity.org/svn/lib-cache/trunk
tag = https://godirepo.camlcity.org/svn/lib-cache/tags/cache-$(VERSION)

USE_OCAMLFIND = true
OCAMLFLAGS += -dtypes

FILES_COMMON = cache_aux cache_util
FILES_CLIENT = cache_clnt cache_client
FILES_SERVER = cache_srv cache_server cache_plex 
FILES_DOC =  cache_client cache_server cache_plex cache_util
OCAMLPACKS = rpc,netplex,bytes
OCAMLFLAGS += $(EXTRAFLAGS)

BYTE_ENABLED = true
if $(not $(defined NATIVE_ENABLED))
    NATIVE_ENABLED = true
    export


OCamlLibrary( cache_common, $(FILES_COMMON) )
OCamlLibrary( cache_client, $(FILES_CLIENT) )
OCamlLibrary( cache_server, $(FILES_SERVER) )

section
  OCAML_LIBS = cache_common cache_server
  OCamlProgram( cached, cached )

%_aux.ml %_aux.mli: %.x 
	ocamlrpcgen -aux -int unboxed -hyper int64 -D OCAMLRPCGEN $<

%_clnt.ml %_clnt.mli: %.x 
	ocamlrpcgen -clnt -int unboxed -hyper int64 -D OCAMLRPCGEN $<

%_srv.ml %_srv.mli: %.x 
	ocamlrpcgen -srv2 -int unboxed -hyper int64 -D OCAMLRPCGEN $<

LocalOCamlGeneratedFiles(cache_clnt.mli cache_srv.mli cache_aux.mli)

.DEFAULT: cache_common.cma cache_client.cma cache_server.cma META

if $(NATIVE_ENABLED)
    .DEFAULT: cache_common.cmxa cache_client.cmxa cache_server.cmxa
    export

META: META.in
	sed -e 's:@VERSION@:$(VERSION):' META.in >META

.PHONY: install
install:
	ocamlfind install cache \
		META *.mli *.cmi *.cma cache.x \
		-optional *.cmxa *.a

.PHONY: uninstall
uninstall:
	ocamlfind remove cache

.PHONY: doc
doc:
	rm -rf doc/html
	mkdir -p doc/html
	cp doc/style.css doc/html/
	ocamlfind ocamldoc \
		-package rpc,netplex \
		-stars -t "Cache Reference Manual" -intro doc/index.txt \
		-d doc/html -html -css-style style.css \
		$(addsuffix .mli, $(FILES_DOC)) \
		doc/sample_server.txt

RFILES = cache_client.ml cache_client.mli \
	 cache_plex.ml cache_plex.mli \
	 cache_server.ml cache_server.mli \
	 cache_util.ml cache_util.mli \
	 cached.ml cached.conf \
	 cache.x LICENSE Makefile META.in OMakefile OMakeroot README \
	 configure _oasis setup.ml ChangeLog

.PHONY: release
release: _oasis
	if $(not $(test -d doc/html))
	    echo 'No documentation!'; exit 1
	rm -rf release/cache-$(VERSION)
	mkdir -p release/cache-$(VERSION)
	mkdir -p release/cache-$(VERSION)/doc
	mkdir -p release/cache-$(VERSION)/doc/html
	cp $(RFILES) release/cache-$(VERSION)
	cp doc/html/* release/cache-$(VERSION)/doc/html/
	cd release && tar czf cache-$(VERSION).tar.gz cache-$(VERSION)
	echo "*** use 'make tag' to tag release"

.PHONY: tag
tag:
	section
	    master=$(shell git branch | grep '* master')
	    if $(equal X$(master),X)
		println("Error: not on master branch")
		exit(1)
	    status=$(shell git status -uno -s || true)
	    if $(equal X$(status),X)
                git tag -a cache-$(VERSION)
	        git push origin master
		println("New tag: cache-$(VERSION)")
	    else
		println("Error: git status not clean")
		exit(1)

_oasis: _oasis.in :value: $(VERSION)
	sed -e 's/@VERSION@/$(VERSION)/' _oasis.in >_oasis
	oasis setup

.PHONY: postconf
postconf:
	echo 'pkg_version="$(VERSION)"' >>setup.data

.PHONY: clean

clean:
        rm -f *.opt *.run *.o *.a *.cm* *~ *.annot
	rm -f *_aux.ml *_aux.mli
	rm -f *_clnt.ml *_clnt.mli
	rm -f *_srv.ml *_srv.mli
	rm -f *.omc
	rm -f cached

This web site is published by Informatikbüro Gerd Stolpmann
Powered by Caml