1 # Bitstring CIL tools for processing C code.
2 # Copyright (C) 2008 Red Hat Inc., Richard W.M. Jones
4 # This library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Lesser General Public
6 # License as published by the Free Software Foundation; either
7 # version 2 of the License, or (at your option) any later version.
9 # This library is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 # Lesser General Public License for more details.
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with this library; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 PACKAGE = @PACKAGE_NAME@
21 VERSION = @PACKAGE_VERSION@
23 OCAMLFIND = @OCAMLFIND@
24 OCAMLMKLIB = @OCAMLMKLIB@
29 OCAMLCPACKAGES = -package unix,str,extlib,cil -I +camlp4 -I ..
30 OCAMLCLIBS = $(OCAMLCPACKAGES) camlp4lib.cma -linkpkg ../bitstring.cma ../bitstring_persistent.cma
32 OCAMLOPTPACKAGES = $(OCAMLCPACKAGES)
33 OCAMLOPTLIBS = $(OCAMLOPTPACKAGES) camlp4lib.cmxa -linkpkg ../bitstring.cmxa ../bitstring_persistent.cmxa
35 PP = -pp "camlp4o -I .. bitstring.cma bitstring_persistent.cma pa_bitstring.cmo"
37 OCAMLDOCFLAGS = -html -sort
39 all: bitstring-import-c bitstring-import-c.opt
41 bitstring-import-c: bitstring_import_c.cmo
42 $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) $(OCAMLCLIBS) $< -o $@
44 bitstring-import-c.opt: bitstring_import_c.cmx
45 $(OCAMLFIND) ocamlopt $(OCAMLOPTFLAGS) $(OCAMLOPTLIBS) $< -o $@
51 # To compile task_struct you'll need to grab a copy of the Linux
52 # kernel original header files and set the directory below.
56 LINUX_HEADERS = linux-2.6.25.7-headers
57 LINUX_INCLUDES = -I $(LINUX_HEADERS)
59 #EXAMPLES = ext3 task_struct
65 $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) $(OCAMLCLIBS) $< -o $@
67 ext3.cmo: ext3.ml ext3.bmpp
68 $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) $(OCAMLCPACKAGES) $(PP) -c $< -o $@
70 ext3.bmpp: ext3.c bitstring-import-c
72 ./bitstring-import-c $(DEBUG) $< > $@.new
75 task_struct: task_struct.cmo
76 $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) $(OCAMLCLIBS) $< -o $@
78 task_struct.cmo: task_struct.ml task_struct.bmpp
79 $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) $(OCAMLCPACKAGES) $(PP) -c $< -o $@
81 task_struct.bmpp: task_struct.c bitstring-import-c
82 cd $(LINUX_HEADERS) && ln -sf asm-x86 asm
84 ./bitstring-import-c $(DEBUG) $(LINUX_INCLUDES) $< > $@.new
90 rm -f core *~ *.cmi *.cmo *.cmx *.cma *.cmxa *.a *.o *.bmpp
91 rm -f bitstring-import-c bitstring-import-c.opt
102 $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) $(OCAMLCPACKAGES) -c $<
104 $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) $(OCAMLCPACKAGES) -c $<
106 $(OCAMLFIND) ocamlopt $(OCAMLOPTFLAGS) $(OCAMLOPTPACKAGES) -c $<
110 .depend: bitstring_import_c.ml
112 $(OCAMLFIND) ocamldep $(OCAMLCPACKAGES) $^ > $@
114 ifeq ($(wildcard .depend),.depend)
118 .PHONY: depend dist check-manifest dpkg doc \
119 print-examples print-tests examples test
121 .SUFFIXES: .cmo .cmi .cmx .ml .mli .mll