Project

General

Profile

Statistics
| Branch: | Revision:

cool / Makefile @ 9f1d62d6

History | View | Annotate | Download (2.91 KB)

1
######################################################################
2
# Makefile (use GNU-Make)
3
# $* part of the file name that matched the % in the target pattern.
4
# $@ file name of the target of the rule
5
# $^ names of the prerequisites
6
# $< name of the first prerequisite
7
# $? names of all the prerequisites that are newer than the target
8
######################################################################
9

    
10

    
11
.DEFAULT:
12
	@echo "This target needs remaking: default = [$<]"
13
	@echo "No rule provided"
14

    
15
# If defined, the code will be compiled into native code,
16
# else it will be compiled into byte code.
17
NATIVE := true
18

    
19
# If defined, the dependencies will be updated automatically.
20
CHECKDEP := 1
21

    
22
# The projects which will be compiled if "make all" is used.
23
PROGS := coalg coalgcompare
24

    
25
LIBS := unix str
26
SOURCESMLI := $(wildcard *.mli)
27
SOURCESML := $(wildcard *.ml)
28
INCS ?= -I/usr/include -I/usr/lib/ocaml -I/usr/local/lib/ocaml -I.
29
CXXFLAGS += -Wall -Werror $(INCS)
30
LDXX ?= g++
31

    
32
OCAMLC := ocamlc.opt
33
OCAMLCFLAGS := -g
34
OCAMLOPT := ocamlopt.opt
35
OCAMLOPTFLAGS := -g -cc $(LDXX) -unsafe -inline 100
36

    
37
# No more user input beyond this point.
38

    
39
ifdef NATIVE
40
OC := $(OCAMLOPT)
41
OCAMLDEP := ocamldep -native
42
SUFFIX := .cmx
43
SUFFIXLIB := .cmxa
44
FLAGS := $(OCAMLOPTFLAGS)
45
else
46
OC := $(OCAMLC)
47
OCAMLDEP := ocamldep
48
SUFFIX := .cmo
49
SUFFIXLIB := .cma
50
FLAGS := $(OCAMLCFLAGS)
51
endif
52

    
53
LIBS := $(patsubst %,%$(SUFFIXLIB),$(LIBS))
54
LIBSMLI := $(patsubst %.mli,%.cmi,$(SOURCESMLI))
55
LIBSML := $(patsubst %.ml,%$(SUFFIX),$(SOURCESML))
56

    
57
.PHONY: all
58
all: $(PROGS)
59

    
60
minisat.cma: minisat.cmo minisat_stub.o
61
	$(OCAMLC) -a -o minisat.cma minisat.cmo minisat_stub.o -custom -cclib -lminisat
62

    
63
minisat.cmxa: minisat.cmx minisat_stub.o
64
	$(OCAMLOPT) -a -o minisat.cmxa minisat.cmx minisat_stub.o -cclib -lminisat
65

    
66
COALG_OBJS := minisat$(SUFFIXLIB) \
67
              genAndComp$(SUFFIX) miscSolver$(SUFFIX) altGenlex$(SUFFIX) hashConsing$(SUFFIX) \
68
              ALCFormula$(SUFFIX) ALCMisc$(SUFFIX) ALCGraph$(SUFFIX) \
69
              CoAlgFormula$(SUFFIX) CoAlgMisc$(SUFFIX) CoAlgLogics$(SUFFIX) CoAlgReasoner$(SUFFIX)
70

    
71
coalg: $(COALG_OBJS) coalg$(SUFFIX)
72
	$(OC) -o coalg $(FLAGS) $(LIBS) $^
73

    
74
coalgcompare: $(COALG_OBJS) coalgcompare$(SUFFIX)
75
	$(OC) -o coalgcompare $(FLAGS) $(LIBS) $^
76

    
77

    
78
ALC_OBJS := genAndComp$(SUFFIX) miscSolver$(SUFFIX) altGenlex$(SUFFIX) hashConsing$(SUFFIX) \
79
            ALCFormula$(SUFFIX) ALCMisc$(SUFFIX) \
80
            ALCTree$(SUFFIX) ALCGraph$(SUFFIX) ALCGraphStates$(SUFFIX)
81

    
82
alc: $(ALC_OBJS) alc$(SUFFIX)
83
	$(OC) -o alc $(FLAGS) $(LIBS) $^
84

    
85

    
86
%.cmi: %.mli
87
	$(OCAMLC) -c $(OCAMLCFLAGS) $<
88

    
89
%.cmo: %.ml
90
	$(OCAMLC) -c $(OCAMLCFLAGS) $<
91

    
92
%.cmx: %.ml
93
	$(OCAMLOPT) -c $(OCAMLOPTFLAGS) $<
94

    
95

    
96
.PHONY: clean
97
clean:
98
	find -regextype posix-egrep -regex ".*((\.(cmi|cmo|cma|cmx|o|cmxa))|~)$$" -delete
99
	$(RM) -f .depend
100
	$(RM) -f $(PROGS)
101
	$(RM) -f *.a
102

    
103

    
104
.PHONY: depend
105
depend: .depend
106

    
107
ifdef CHECKDEP
108
.depend: $(SOURCESMLI) $(SOURCESML)
109
	$(OCAMLDEP) $(SOURCESMLI) $(SOURCESML) > $@
110
endif
111

    
112
-include .depend