summaryrefslogtreecommitdiff
path: root/ocaml-binary-annot/otherlibs/labltk/lib/Makefile
blob: b82bcddfafc8b570d8407d5d59635f337328da1b (plain)
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
include ../support/Makefile.common

all: $(LIBNAME).cma $(LIBNAME)top$(EXE) $(LIBNAME)

opt: $(LIBNAME).cmxa

clean:
	rm -f $(LIBNAME)top$(EXE) $(LIBNAME) *.cm* *.$(A)

superclean:
	- if test -f tk.cmo; then \
	  echo We have changes... Now lib directory has no .cmo files; \
	  rm -f *.cm* *.$(O); \
	fi

include ../labltk/modules
LABLTKOBJS=tk.cmo $(WIDGETOBJS)

include ../camltk/modules
CAMLTKOBJS=cTk.cmo $(CWIDGETOBJS) labltk.cmo camltk.cmo

SUPPORT=../support/support.cmo ../support/rawwidget.cmo \
	../support/widget.cmo ../support/protocol.cmo \
	../support/textvariable.cmo ../support/timer.cmo \
	../support/fileevent.cmo ../support/camltkwrap.cmo

TKOBJS=$(SUPPORT) $(LABLTKOBJS) $(CAMLTKOBJS)

TOPDEPS = $(TOPDIR)/toplevel/toplevellib.cma $(TOPDIR)/toplevel/topmain.cmo

$(LIBNAME).cma: $(SUPPORT) ../Widgets.src
	$(MAKE) superclean
	cd ../labltk; $(MAKE)
	cd ../camltk; $(MAKE)
	$(MKLIB) -ocamlc '$(CAMLCB)' -o $(LIBNAME) \
	  -I ../labltk -I ../camltk $(TKOBJS) \
	  -ccopt "\"$(TK_LINK)\""

$(LIBNAME).cmxa: $(SUPPORT:.cmo=.cmx) ../Widgets.src
	$(MAKE) superclean
	cd ../labltk; $(MAKE) opt
	cd ../camltk; $(MAKE) opt
	$(MKLIB) -ocamlopt '$(CAMLOPTB)' -o $(LIBNAME) -oc $(LIBNAME) \
	  -I ../labltk -I ../camltk $(TKOBJS:.cmo=.cmx) \
	  -ccopt "\"$(TK_LINK)\""

$(LIBNAME)top$(EXE) : $(TOPDEPS) $(LIBNAME).cma ../support/lib$(LIBNAME).$(A)
	$(CAMLC) -verbose -linkall -o $(LIBNAME)top$(EXE) -I ../support \
	       -I $(TOPDIR)/toplevel toplevellib.cma \
	       -I $(OTHERS)/unix -I $(OTHERS)/win32unix unix.cma \
	       -I ../labltk -I ../camltk $(LIBNAME).cma \
	       -I $(OTHERS)/str str.cma \
	       topstart.cmo

$(LIBNAME): Makefile $(TOPDIR)/config/Makefile
	@echo Generate $@
	@echo "#!/bin/sh" > $@
	@echo 'exec $(INSTALLDIR)/$(LIBNAME)top$(EXE) -I $(INSTALLDIR) $$*' >> $@

install-script: $(LIBNAME)
	cp $(LIBNAME) $(BINDIR)
	chmod 755 $(BINDIR)/$(LIBNAME)

install-batch:
	cp labltk.bat $(BINDIR)

install:
	if test -d $(INSTALLDIR); then : ; else mkdir $(INSTALLDIR); fi
	cp $(LIBNAME).cma $(LIBNAME)top$(EXE) $(INSTALLDIR)
	chmod 644 $(INSTALLDIR)/$(LIBNAME).cma
	chmod 755 $(INSTALLDIR)/$(LIBNAME)top$(EXE)
	@if test -d $(BINDIR); then : ; else mkdir $(BINDIR); fi
	@case x$(TOOLCHAIN) in \
	  xmingw|xmsvc) $(MAKE) install-batch ;; \
	  *) 		$(MAKE) install-script ;; \
	esac

installopt:
	@if test -d $(INSTALLDIR); then : ; else mkdir $(INSTALLDIR); fi
	cp $(LIBNAME).cmxa $(LIBNAME).$(A) $(INSTALLDIR)
	cd $(INSTALLDIR); $(RANLIB) $(LIBNAME).$(A)
	chmod 644 $(INSTALLDIR)/$(LIBNAME).cmxa
	chmod 644 $(INSTALLDIR)/$(LIBNAME).$(A)