-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.nt
121 lines (93 loc) · 4.47 KB
/
Makefile.nt
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
115
116
117
118
119
120
121
# ###########################################################################
# MetaStack Solutions Ltd. #
# ###########################################################################
# OCamlODBC Win32/MinGW Makefile #
# ###########################################################################
# Copyright (c) 2006 MetaStack Solutions Ltd. #
# #
# This program is free software; you can redistribute it and/or modify #
# it under the terms of the GNU Lesser General Public License as #
# published by the Free Software Foundation; either version 2.1 of the #
# License, or any later version. #
# #
# This program is distributed in the hope that it will be useful, but #
# WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU #
# Lesser General Public License for more details. #
# #
# You should have received a copy of the GNU Lesser General Public #
# License along with this program; if not, write to the Free Software #
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #
# #
# ###########################################################################
# Author: David Allsopp #
# 4-Jun-2006 #
# ###########################################################################
OCAMLC=ocamlc
OCAMLOPT=ocamlopt
OCAMLDEP=ocamldep
OCAMLDOC=ocamldoc
OCAMLFIND=ocamlfind
GCC=gcc -mno-cygwin
AR=ar
LIB=ocamlodbc
BYTE_LIB=$(LIB).cma
BYTE_LIB_DLL=dll$(LIB).dll
OPT_LIB=$(LIB).cmxa
OPT_LIB_A=lib$(LIB).a
MKDIR=mkdir -p
CP=cp -f
RM=@rm -f
include Makefile.config
all: lib lib_opt META
lib: ocamlodbc.cma dllocamlodbc.dll
lib_opt: ocamlodbc.cmxa libocamlodbc.a
$(BYTE_LIB): ocaml_odbc.cmi ocaml_odbc.cmo ocamlodbc.cmi ocamlodbc.cmo
$(OCAMLC) -a -o $@ ocaml_odbc.cmo ocamlodbc.cmo -dllib -locamlodbc
$(OPT_LIB): ocaml_odbc.cmi ocaml_odbc.cmx ocamlodbc.cmi ocamlodbc.cmx
$(OCAMLOPT) -a -o $@ ocaml_odbc.cmx ocamlodbc.cmx -cclib -locamlodbc -cclib -lodbc32
ocaml_odbc_c.o: ocaml_odbc_c.c
$(GCC) -c -DODBC3 -DWIN32 -I `cygpath $(OCAMLLIBDIR)/caml` -I /usr/include/w32api ocaml_odbc_c.c
$(BYTE_LIB_DLL): ocaml_odbc_c.o
$(GCC) -shared -L `cygpath $(OCAMLLIBDIR)` -L `which ocamlrun.dll | sed -e 's/\/ocamlrun.dll$$//'` -o $@ ocaml_odbc_c.o -lodbc32 -locamlrun
$(OPT_LIB_A): ocaml_odbc_c.o
$(GCC) -c -DODBC3 -DWIN32 -I `cygpath $(OCAMLLIBDIR)/caml` -I /usr/include/w32api ocaml_odbc_c.c
$(AR) rsc $(OPT_LIB_A) ocaml_odbc_c.o
META:
@echo 'name="$(LIB)"' > $@
@echo 'version="'`grep "let version =" ocamlodbc.ml | cut -d'"' -f 2`'"' >> $@
@echo 'requires=""' >> $@
@echo 'archive(byte)="$(BYTE_LIB)"' >> $@
@echo 'archive(native)="$(OPT_LIB)"' >> $@
doc: doc/index.html
doc/index.html: ocamlodbc.mli ocamlodbc.ml
$(MKDIR) doc
$(OCAMLDOC) -d doc -html -dump doc/ocamlodbc.odoc ocamlodbc.mli ocamlodbc.ml
@echo Documentation is in doc/index.html
install: all
@echo "Installation instructions:"
@echo ' To install OCamlODBC using findlib type: "make -f Makefile.nt findlib_install"'
@echo ' To install OCamlODBC directly type: "make -f Makefile.nt direct_install"'
direct_install: lib lib_opt
$(CP) ocamlodbc.cmi $(BYTE_LIB) $(OPT_LIB) $(OPT_LIB_A) $(LIB).a `cygpath $(OCAMLLIBDIR)`
$(CP) $(BYTE_LIB_DLL) `cygpath $(OCAMLLIBDIR)/stublibs`
findlib_install: lib lib_opt META
$(OCAMLFIND) install $(LIB) META ocamlodbc.cmi $(BYTE_LIB) $(OPT_LIB) $(LIB).a $(OPT_LIB_A) $(BYTE_LIB_DLL)
.depend: *.ml *.mli
$(OCAMLDEP) *.ml *.mli > .depend
Makefile.config:
./configure.nt
include .depend
clean:
$(RM) .depend Makefile.config $(BYTE_LIB) $(BYTE_LIB_DLL) $(OPT_LIB) $(OPT_LIB_A) $(LIB).a ocamlodbc.{o,cmi,cmx,cmo,cmi} ocaml_odbc.{o,cmi,cmx,cmo,cmi} ocaml_odbc_c.o
.PHONY: all clean install direct_install findlib_install
%.cmi: %.mli
$(OCAMLC) -c $<
%.cmo: %.ml
$(OCAMLC) -c $<
%.cmo %.cmi: %.ml
$(OCAMLC) -c $<
%.cmx: %.ml
$(OCAMLOPT) -c $<
%.cmx %.cmi: %.ml
$(OCAMLOPT) -c $<