File: Makefile

package info (click to toggle)
mlgtk 2.0.0-13
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 596 kB
  • ctags: 1,197
  • sloc: ml: 3,638; ansic: 2,522; makefile: 248; sh: 85
file content (114 lines) | stat: -rw-r--r-- 2,574 bytes parent folder | download
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
CC = gcc
CAMLC = ocamlc
CAMLO = ocamlopt
OCAMLMKLIB=ocamlmklib

#CDEBUGFLAGS = -g -Wall -DGTKTHR -DDEBUG
CDEBUGFLAGS = -g -Wall -DGTKTHR 
ZFLAGS = -g -thread
ZFLAGSOPT = 

# Be sure of what you are doing if you want to change this:
#OCAMLDIR = $(shell $(CAMLC) -v | grep Standard | sed -e "s/^.*: //") 
OCAMLDIR = `$(CAMLC) -where`

# On the other hand you may want to adapt this:

DESTDIR =
INSTALL = install -m644
INSTDIR = $(DESTDIR)$(OCAMLDIR)/mlgtk


# path for Ocaml C header files
OC_CFLAGS = -I $(OCAMLDIR)
# OC_CFLAGS = -I/usr/lib/ocaml -I/usr/local/lib/ocaml

##############################################################
###  You should not need to customize anything below this  ###
##############################################################

.PHONY : all all_opt clean distclean install install_opt depend examples examples_opt

include detect_gtk

ifneq (,$(OK))

CFLAGS = $(CDEBUGFLAGS) $(OC_CFLAGS) $(GLIB_CFLAGS) \
         $(shell gtk-config --cflags) $(GTKDEFINES)
LDFLAGS = $(shell gtk-config --libs)

CMOFILES = glib.cmo gdk.cmo gtk.cmo gtkThr.cmo gtkObj.cmo gtkEasy.cmo gtkDrawing.cmo
CMXFILES = glib.cmx gdk.cmx gtk.cmx gtkThr.cmx gtkObj.cmx gtkEasy.cmx gtkDrawing.cmx
OFILES = mlgdk_stub.o mlglib_stub.o mlgtk_stub.o

all: print_message libs examples 
all_opt: libs_opt examples_opt

libs: gtk.cma libmlgtk.a 
libs_opt: gtk.cmxa libmlgtk.a 

examples: 
	make -C examples all

examples_opt: 
	make -C examples all_opt

print_message:
	@echo $(OK)

gtk.cma: $(CMOFILES) $(OFILES)
	$(OCAMLMKLIB) -o gtk -oc mlgtk $(CMOFILES) $(OFILES) $(LDFLAGS)

gtk.cmxa: $(CMXFILES)
	$(OCAMLMKLIB) -o gtk -oc mlgtk $(CMXFILES) $(OFILES) $(LDFLAGS)

#libmlgtk.a: $(OFILES)
#	$(OCAMLMKLIB) -o gtk -oc mlgtk $(OFILES) $(LDFLAGS)

gtkThr.cmx: gtkThr.ml
	$(CAMLO) -thread $(ZFLAGSOPT) -c $<

mli.docs:
	if [ -x mli ]; then rm -rf mli; fi && mkdir mli
	-for i in `ls --color=never *.ml`; do	\
		ocamlc -i -c -o /dev/null $$i >mli/"$$i"i;	\
	done
	cp -f *.mli mli

clean:
	-rm -f *.cm* *.o *.a 
	make -C examples clean
	-rm -rf mli
	-rm -f dllmlgtk.so

distclean: 
	-rm -f .depend *.cm* *.o *.a 
	make -C examples distclean

install: libs
	$(INSTALL) gtk.cma $(INSTDIR)
	$(INSTALL) dllmlgtk.so $(INSTDIR)
	$(INSTALL) *.cmi $(INSTDIR)

install_opt: libs_opt
	$(INSTALL) gtk.cmxa gtk.a $(INSTDIR)
	$(INSTALL) libmlgtk.a $(INSTDIR)

depend: 
	ocamldep *.ml* >.depend

.depend:
	ocamldep *.ml* >.depend

.ml.cmo:
	$(CAMLC) $(ZFLAGS) -c $<
.ml.cmx:
	$(CAMLO) $(ZFLAGSOPT) -c $<
.mli.cmi:
	$(CAMLC) $(ZFLAGS) -c $<

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

include .depend

endif