RSS

(root)/ocaml-lpd/trunk : 1 : Makefile

« back to all changes in this revision

Viewing changes to Makefile

Christophe Troestler
2009-03-12 15:31:33
Revision ID: christophe.troestler@umons.ac.be-20090312153133-r0kx3k76480xumg3
Initial import.  This project was started on Thu Feb 24 14:12:50 2005
UTC and kept in sourceforge CVS.  There was a problem accessing CVS
after this time (!) however so I ditched the history (not so important
anyway).

Show diffs side-by-side

added added

removed removed

 
1
#       $Id: Makefile,v 1.7 2007/02/15 23:38:51 chris_77 Exp $  
 
2
 
 
3
PKGNAME    = $(shell grep "name" META | sed -e "s/.*\"\([^\"]*\)\".*/\1/")
 
4
PKGVERSION = $(shell grep "version" META | sed -e "s/.*\"\([^\"]*\)\".*/\1/")
 
5
 
 
6
SRC_WEB    = web
 
7
SF_WEB     = /home/groups/o/oc/ocaml-lpd/htdocs
 
8
 
 
9
CAMLPATH        = 
 
10
OCAMLC          = $(CAMLPATH)ocamlc
 
11
OCAMLP4         = $(CAMLPATH)camlp4o
 
12
OCAMLOPT        = $(CAMLPATH)ocamlopt
 
13
OCAMLDEP        = $(CAMLPATH)ocamldep
 
14
OCAMLDOC        = $(CAMLPATH)ocamldoc
 
15
 
 
16
OCAMLCFLAGS     = -dtypes
 
17
OCAMLOPTFLAGS   = -dtypes -inline 3
 
18
OCAMLDOCFLAGS   = -html -stars -colorize-code #-css-style $(OCAMLDOCCSS)
 
19
 
 
20
DISTFILES       = INSTALL LICENSE META Make.bat Makefile hosts.lpd \
 
21
                  $(wildcard *.ml) $(wildcard *.mli)
 
22
 
 
23
MLI_FILES       = $(wildcard *.mli)
 
24
DOCFILES        = lpd.mli socket.mli
 
25
 
 
26
PKG_TARBALL     = $(PKGNAME)-$(PKGVERSION).tar.gz
 
27
ARCHIVE         = $(shell grep "archive(byte)" META | \
 
28
                        sed -e "s/.*\"\([^\"]*\)\".*/\1/")
 
29
XARCHIVE        = $(shell grep "archive(native)" META | \
 
30
                        sed -e "s/.*\"\([^\"]*\)\".*/\1/")
 
31
 
 
32
default: all
 
33
 
 
34
######################################################################
 
35
 
 
36
PKGS = $(shell grep "requires" META | sed -e "s/.*\"\([^\"]*\)\".*/\1/")
 
37
PKGS_CMA        = $(addsuffix .cma, $(PKGS))
 
38
PKGS_CMXA       = $(addsuffix .cmxa, $(PKGS))
 
39
 
 
40
CMI_FILES       = $(MLI_FILES:.mli=.cmi)
 
41
 
 
42
.PHONY: all byte opt install install-byte install-opt doc dist
 
43
all: byte opt
 
44
byte: socket.cma lpd.cma
 
45
opt: socket.cmxa lpd.cmxa
 
46
 
 
47
 
 
48
# Make the examples
 
49
.PHONY: ex examples
 
50
ex: lpd_to_win.exe page_counter.exe
 
51
 
 
52
%.exe: socket.cma lpd.cma %.ml
 
53
        $(OCAMLC) $(OCAMLCFLAGS) -o $@  -I +threads $(PKGS_CMA) threads.cma $^
 
54
%.opt: socket.cmxa lpd.cmxa %.ml
 
55
        $(OCAMLOPT) $(OCAMLOPTFLAGS) -o $@ -I +threads \
 
56
          $(PKGS_CMXA) threads.cmxa $^
 
57
 
 
58
# (Un)installation
 
59
.PHONY: install uninstall
 
60
install: all
 
61
        ocamlfind remove $(PKGNAME); \
 
62
        [ -f "$(XARCHIVE)" ] && \
 
63
        extra="$(XARCHIVE) $(addsuffix .a,$(basename $(XARCHIVE)))"; \
 
64
        ocamlfind install $(if $(DESTDIR),-destdir $(DESTDIR)) $(PKGNAME) \
 
65
          $(MLI_FILES) $(CMI_FILES) $(ARCHIVE) META $$extra
 
66
 
 
67
installbyte:
 
68
        ocamlfind remove $(PKGNAME); \
 
69
        ocamlfind install $(if $(DESTDIR),-destdir $(DESTDIR)) $(PKGNAME) \
 
70
        $(MLI_FILES) $(CMI_FILES) $(ARCHIVE) META
 
71
 
 
72
uninstall:
 
73
        ocamlfind remove $(PKGNAME)
 
74
 
 
75
# Compile HTML documentation
 
76
DOC_DIR=doc
 
77
doc: $(DOCFILES) $(CMI_FILES)
 
78
        @if [ -n "$(DOCFILES)" ] ; then \
 
79
            if [ ! -x $(DOC_DIR) ] ; then mkdir $(DOC_DIR) ; fi ; \
 
80
            $(OCAMLDOC) -v -d $(DOC_DIR) $(OCAMLDOCFLAGS) $(DOCFILES) ; \
 
81
        fi
 
82
 
 
83
# Make a tarball
 
84
.PHONY: dist
 
85
dist:
 
86
        mkdir $(PKGNAME)-$(PKGVERSION)
 
87
        cp -r $(DISTFILES) $(PKGNAME)-$(PKGVERSION)/
 
88
#       Create a trivial hosts.lpd
 
89
#       echo "# hosts.lpd\nmachine.network.com" \
 
90
#         > $(PKGNAME)-$(PKGVERSION)/hosts.lpd
 
91
        tar --exclude "CVS" --exclude ".cvsignore" --exclude "*~" \
 
92
          --exclude "*.cm{i,x,o,xa}" --exclude "*.o" \
 
93
          -zcvf $(PKG_TARBALL) $(PKGNAME)-$(PKGVERSION)
 
94
        rm -rf $(PKGNAME)-$(PKGVERSION)
 
95
 
 
96
# Release a tarball and publish the HTML doc 
 
97
-include Makefile.pub
 
98
 
 
99
 
 
100
# Generic compilation instructions.
 
101
 
 
102
%.cmi: %.mli
 
103
        $(OCAMLC) $(OCAMLCFLAGS) -c $<
 
104
 
 
105
%.cmo: %.ml
 
106
        $(OCAMLC) $(OCAMLCFLAGS) -c $<
 
107
 
 
108
%.cma: %.ml %.cmi
 
109
        $(OCAMLC) -a -o $@ $(OCAMLCFLAGS) $<
 
110
 
 
111
%.cmx: %.ml
 
112
        $(OCAMLOPT) $(OCAMLOPTFLAGS) -c $<
 
113
 
 
114
%.cmxa: %.ml %.cmi
 
115
        $(OCAMLOPT) -a -o $@ $(OCAMLOPTFLAGS) $<
 
116
 
 
117
.PHONY: dep depend
 
118
dep:    .depend
 
119
depend: .depend
 
120
 
 
121
.depend: $(wildcard *.mli) $(wildcard *.ml) $(wildcard */*.ml)
 
122
        ocamldep $^ > $@
 
123
 
 
124
ifeq ($(wildcard .depend),.depend)
 
125
include .depend
 
126
endif
 
127
 
 
128
 
 
129
.PHONY:clean
 
130
clean:
 
131
        rm -f *~ .*~ *.{o,a} *.cm[aiox] *.cmxa *.annot
 
132
        rm -rf $(DOC_DIR) $(PKG_TARBALL)
 
133
        find . -type f -perm -u=x -exec rm -f {} \;
 
134
 
 
135
.SUFFIXES: .ml .mli .cmi .cmo
 
 
'\\ No newline at end of file'

Loggerhead 1.17 is a web-based interface for Bazaar branches