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@
28 enable_coverage = @enable_coverage@
31 OCAMLCPACKAGES = -package dynlink,unix,str,extlib,cil -I +camlp4 -I ..
32 OCAMLCLIBS = $(OCAMLCPACKAGES) camlp4lib.cma -linkpkg ../bitstring.cma ../bitstring_persistent.cma
34 OCAMLOPTPACKAGES = $(OCAMLCPACKAGES)
35 OCAMLOPTLIBS = $(OCAMLOPTPACKAGES) camlp4lib.cmxa -linkpkg ../bitstring.cmxa ../bitstring_persistent.cmxa
37 ifneq ($(enable_coverage),no)
38 OCAMLCLIBS := -I +bisect bisect.cma $(OCAMLCLIBS)
39 OCAMLOPTLIBS := -I +bisect bisect.cmxa $(OCAMLOPTLIBS)
42 PP = -pp "camlp4o -I .. bitstring.cma bitstring_persistent.cma pa_bitstring.cmo"
44 OCAMLDOCFLAGS = -html -sort
46 all: bitstring-import-c bitstring-import-c.opt
48 bitstring-import-c: bitstring_import_c.cmo
49 $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) $(OCAMLCLIBS) $< -o $@
51 bitstring-import-c.opt: bitstring_import_c.cmx
52 $(OCAMLFIND) ocamlopt $(OCAMLOPTFLAGS) $(OCAMLOPTLIBS) $< -o $@
58 # To compile task_struct you'll need to grab a copy of the Linux
59 # kernel original header files and set the directory below.
63 LINUX_HEADERS = linux-2.6.25.7-headers
64 LINUX_INCLUDES = -I $(LINUX_HEADERS)
66 #EXAMPLES = ext3 task_struct
72 $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) $(OCAMLCLIBS) $< -o $@
74 ext3.cmo: ext3.ml ext3.bmpp
75 $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) $(OCAMLCPACKAGES) $(PP) -c $< -o $@
77 ext3.bmpp: ext3.c bitstring-import-c
79 ./bitstring-import-c $(DEBUG) $< > $@.new
82 task_struct: task_struct.cmo
83 $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) $(OCAMLCLIBS) $< -o $@
85 task_struct.cmo: task_struct.ml task_struct.bmpp
86 $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) $(OCAMLCPACKAGES) $(PP) -c $< -o $@
88 task_struct.bmpp: task_struct.c bitstring-import-c
89 cd $(LINUX_HEADERS) && ln -sf asm-x86 asm
91 ./bitstring-import-c $(DEBUG) $(LINUX_INCLUDES) $< > $@.new
97 rm -f core *~ *.cmi *.cmo *.cmx *.cma *.cmxa *.a *.o *.bmpp
98 rm -f bitstring-import-c bitstring-import-c.opt
99 rm -f ext3 task_struct
110 $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) $(OCAMLCPACKAGES) -c $<
112 $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) $(OCAMLCPACKAGES) -c $<
114 $(OCAMLFIND) ocamlopt $(OCAMLOPTFLAGS) $(OCAMLOPTPACKAGES) -c $<
118 .depend: bitstring_import_c.ml
120 $(OCAMLFIND) ocamldep $(OCAMLCPACKAGES) $^ > $@
122 ifeq ($(wildcard .depend),.depend)
126 .PHONY: depend dist check-manifest dpkg doc \
127 print-examples print-tests examples test
129 .SUFFIXES: .cmo .cmi .cmx .ml .mli .mll