summaryrefslogtreecommitdiff
path: root/cparser/Makefile
blob: 1479992ff6feea72ea68a4db60d7fd4a418b16dc (plain)
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
OCAMLC=ocamlc -g
OCAMLOPT=ocamlopt -g
OCAMLLEX=ocamllex
OCAMLYACC=ocamlyacc -v
OCAMLDEP=ocamldep
OCAMLMKLIB=ocamlmklib

LIBDIR=`$(OCAMLC) -where`/cparser

INTFS=C.mli

SRCS=Cerrors.ml Cabs.ml Cabshelper.ml Parse_aux.ml Parser.ml Lexer.ml \
  Machine.ml \
  Env.ml Cprint.ml Cutil.ml Ceval.ml \
  Builtins.ml GCC.ml \
  Cleanup.ml Elab.ml Rename.ml \
  Transform.ml \
  Unblock.ml StructReturn.ml \
  Bitfields.ml PackedStructs.ml \
  Parse.ml

BOBJS=$(SRCS:.ml=.cmo)
NOBJS=$(SRCS:.ml=.cmx)
IOBJS=$(INTFS:.mli=.cmi)

all: cparser.cma cparser.cmxa cparser cparser.byte

install:
	mkdir -p $(LIBDIR)
	cp -p Cparser.cmi cparser.cma cparser.cmxa cparser.a $(LIBDIR)

cparser: $(NOBJS) Main.cmx
	$(OCAMLOPT) -o cparser str.cmxa $(COBJS) $(NOBJS) Main.cmx

clean::
	rm -f cparser

cparser.byte: $(COBJS) $(BOBJS) Main.cmo
	$(OCAMLC) -custom -o cparser.byte str.cma $(COBJS) $(BOBJS) Main.cmo

clean::
	rm -f cparser.byte

cparser.cma: Cparser.cmo 
	$(OCAMLC) -a -o cparser.cma Cparser.cmo

cparser.cmxa: Cparser.cmx
	$(OCAMLOPT) -a -o cparser.cmxa Cparser.cmx

Cparser.cmo Cparser.cmi: $(IOBJS) $(BOBJS)
	$(OCAMLC) -pack -o Cparser.cmo $(IOBJS) $(BOBJS)

Cparser.cmx: $(IOBJS) $(NOBJS)
	$(OCAMLOPT) -pack -o Cparser.cmx $(IOBJS) $(NOBJS)

Parser.ml Parser.mli: Parser.mly
	$(OCAMLYACC) Parser.mly

clean::
	rm -f Parser.ml Parser.mli Parser.output

beforedepend:: Parser.ml Parser.mli

Lexer.ml: Lexer.mll
	$(OCAMLLEX) Lexer.mll

clean::
	rm -f Lexer.ml

beforedepend:: Lexer.ml

.SUFFIXES: .ml .mli .cmi .cmo .cmx

.mli.cmi:
	$(OCAMLC) -c $*.mli
.ml.cmo:
	$(OCAMLC) -c $*.ml
.ml.cmx:
	$(OCAMLOPT) -c -for-pack Cparser $*.ml
.c.o:
	$(OCAMLC) -c $*.c

clean::
	rm -f *.cm? *.cmxa *.o *.so *.a

depend: beforedepend
	$(OCAMLDEP) *.mli *.ml > .depend

include .depend