]> matita.cs.unibo.it Git - pkg-cerco/acc.git/blob - cparser/Makefile
Package description and copyright added.
[pkg-cerco/acc.git] / cparser / Makefile
1 OCAMLC=ocamlc -g
2 OCAMLOPT=ocamlopt -g
3 OCAMLLEX=ocamllex
4 OCAMLYACC=ocamlyacc -v
5 OCAMLDEP=ocamldep
6 OCAMLMKLIB=ocamlmklib
7
8 LIBDIR=../lib
9
10 INTFS=C.mli
11
12 SRCS=Errors.ml Cabs.ml Cabshelper.ml Parse_aux.ml Parser.ml Lexer.ml \
13   Machine.ml \
14   Env.ml Cprint.ml Cutil.ml Ceval.ml \
15   Builtins.ml GCC.ml CBuiltins.ml \
16   Cleanup.ml Elab.ml Rename.ml \
17   Transform.ml \
18   Unblock.ml SimplExpr.ml AddCasts.ml StructByValue.ml StructAssign.ml \
19   Bitfields.ml \
20   Parse.ml 
21
22 COBJS=uint64.o
23 BOBJS=$(SRCS:.ml=.cmo)
24 NOBJS=$(SRCS:.ml=.cmx)
25 IOBJS=$(INTFS:.mli=.cmi)
26 NATIVETARGETS=$(shell if `which ocamlopt`; \
27                 then echo "cparser.cmxa cparser cparser.a libcparser.a dllcparser.so"; fi)
28
29 all: $(NATIVETARGETS) cparser.cma cparser.byte
30
31 install:
32         mkdir -p $(LIBDIR)
33         cp -p Cparser.cmi cparser.cma $(NATIVETARGETS) $(LIBDIR)
34
35 cparser: $(COBJS) $(NOBJS) Main.cmx
36         $(OCAMLOPT) -o cparser $(COBJS) $(NOBJS) Main.cmx
37
38 cparser.byte: $(COBJS) $(BOBJS) Main.cmo
39         $(OCAMLC) -custom -o cparser.byte $(COBJS) $(BOBJS) Main.cmo
40
41 cparser.cma libcparser.a: uint64.o Cparser.cmo 
42         $(OCAMLMKLIB) -o cparser uint64.o Cparser.cmo
43
44 cparser.cmxa: uint64.o Cparser.cmx
45         $(OCAMLMKLIB) -o cparser uint64.o Cparser.cmx
46
47 Cparser.cmo Cparser.cmi: $(IOBJS) $(BOBJS)
48         $(OCAMLC) -pack -o Cparser.cmo $(IOBJS) $(BOBJS)
49
50 Cparser.cmx: $(IOBJS) $(NOBJS)
51         $(OCAMLOPT) -pack -o Cparser.cmx $(IOBJS) $(NOBJS)
52
53 Parser.ml Parser.mli: Parser.mly
54         $(OCAMLYACC) Parser.mly
55
56 clean::
57         rm -f Parser.ml Parser.mli Parser.output
58
59 beforedepend:: Parser.ml Parser.mli
60
61 Lexer.ml: Lexer.mll
62         $(OCAMLLEX) Lexer.mll
63
64 clean::
65         rm -f Lexer.ml
66
67 beforedepend:: Lexer.ml
68
69 .SUFFIXES: .ml .mli .cmi .cmo .cmx
70
71 .mli.cmi:
72         $(OCAMLC) -c $*.mli
73 .ml.cmo:
74         $(OCAMLC) -c $*.ml
75 .ml.cmx:
76         $(OCAMLOPT) -c -for-pack Cparser $*.ml
77 .c.o:
78         $(OCAMLC) -c $*.c
79
80 clean::
81         rm -f *.cm? *.o *.so *.a *.cmxa *.byte cparser
82
83 depend: beforedepend
84         $(OCAMLDEP) *.mli *.ml > .depend
85
86 include .depend