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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
|
# Bitstring CIL tools for processing C code.
# Copyright (C) 2008 Red Hat Inc., Richard W.M. Jones
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# 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
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#
# $Id: Makefile.in 158 2008-08-26 14:18:50Z richard.wm.jones $
PACKAGE = @PACKAGE_NAME@
VERSION = @PACKAGE_VERSION@
OCAMLFIND = @OCAMLFIND@
OCAMLMKLIB = @OCAMLMKLIB@
OCAMLDOC = @OCAMLDOC@
INSTALL = @INSTALL@
enable_coverage = @enable_coverage@
OCAMLCFLAGS = -g
OCAMLCPACKAGES = -package unix,str,extlib,cil -I +camlp4 -I ..
OCAMLCLIBS = $(OCAMLCPACKAGES) camlp4lib.cma -linkpkg ../bitstring.cma ../bitstring_persistent.cma
OCAMLOPTFLAGS =
OCAMLOPTPACKAGES = $(OCAMLCPACKAGES)
OCAMLOPTLIBS = $(OCAMLOPTPACKAGES) camlp4lib.cmxa -linkpkg ../bitstring.cmxa ../bitstring_persistent.cmxa
ifneq ($(enable_coverage),no)
OCAMLCLIBS := -I +bisect bisect.cma $(OCAMLCLIBS)
OCAMLOPTLIBS := -I +bisect bisect.cmxa $(OCAMLOPTLIBS)
endif
PP = -pp "camlp4o -I .. bitstring.cma bitstring_persistent.cma pa_bitstring.cmo"
OCAMLDOCFLAGS = -html -sort
all: bitstring-import-c bitstring-import-c.opt
bitstring-import-c: bitstring_import_c.cmo
$(OCAMLFIND) ocamlc $(OCAMLCFLAGS) $(OCAMLCLIBS) $< -o $@
bitstring-import-c.opt: bitstring_import_c.cmx
$(OCAMLFIND) ocamlopt $(OCAMLOPTFLAGS) $(OCAMLOPTLIBS) $< -o $@
test:
# Examples.
#
# To compile task_struct you'll need to grab a copy of the Linux
# kernel original header files and set the directory below.
#DEBUG =
DEBUG = --debug
LINUX_HEADERS = linux-2.6.25.7-headers
LINUX_INCLUDES = -I $(LINUX_HEADERS)
#EXAMPLES = ext3 task_struct
EXAMPLES = ext3
examples: $(EXAMPLES)
ext3: ext3.cmo
$(OCAMLFIND) ocamlc $(OCAMLCFLAGS) $(OCAMLCLIBS) $< -o $@
ext3.cmo: ext3.ml ext3.bmpp
$(OCAMLFIND) ocamlc $(OCAMLCFLAGS) $(OCAMLCPACKAGES) $(PP) -c $< -o $@
ext3.bmpp: ext3.c bitstring-import-c
rm -f $@.new
./bitstring-import-c $(DEBUG) $< > $@.new
mv $@.new $@
task_struct: task_struct.cmo
$(OCAMLFIND) ocamlc $(OCAMLCFLAGS) $(OCAMLCLIBS) $< -o $@
task_struct.cmo: task_struct.ml task_struct.bmpp
$(OCAMLFIND) ocamlc $(OCAMLCFLAGS) $(OCAMLCPACKAGES) $(PP) -c $< -o $@
task_struct.bmpp: task_struct.c bitstring-import-c
cd $(LINUX_HEADERS) && ln -sf asm-x86 asm
rm -f $@.new
./bitstring-import-c $(DEBUG) $(LINUX_INCLUDES) $< > $@.new
mv $@.new $@
# Clean.
clean:
rm -f core *~ *.cmi *.cmo *.cmx *.cma *.cmxa *.a *.o *.bmpp
rm -f bitstring-import-c bitstring-import-c.opt
rm -f ext3 task_struct
distclean: clean
# Install.
install:
# Standard rules.
.mli.cmi:
$(OCAMLFIND) ocamlc $(OCAMLCFLAGS) $(OCAMLCPACKAGES) -c $<
.ml.cmo:
$(OCAMLFIND) ocamlc $(OCAMLCFLAGS) $(OCAMLCPACKAGES) -c $<
.ml.cmx:
$(OCAMLFIND) ocamlopt $(OCAMLOPTFLAGS) $(OCAMLOPTPACKAGES) -c $<
depend: .depend
.depend: bitstring_import_c.ml
rm -f .depend
$(OCAMLFIND) ocamldep $(OCAMLCPACKAGES) $^ > $@
ifeq ($(wildcard .depend),.depend)
include .depend
endif
.PHONY: depend dist check-manifest dpkg doc \
print-examples print-tests examples test
.SUFFIXES: .cmo .cmi .cmx .ml .mli .mll
|