r11496: add dir
[clsql.git] / db-mysql / Makefile
1 #!/usr/bin/make
2 # FILE IDENTIFICATION
3 #
4 #  Name:         Makefile
5 #  Purpose:      Makefile for CLSQL MySQL interface
6 #  Programer:    Kevin M. Rosenberg
7 #  Date Started: Mar 2002
8 #
9 #  CVS Id:   $Id$
10 #
11 # This file, part of CLSQL, is Copyright (c) 2002 by Kevin M. Rosenberg
12 #
13 # CLSQL users are granted the rights to distribute and use this software
14 # as governed by the terms of the Lisp Lesser GNU Public License
15 # (http://opensource.franz.com/preamble.html), also known as the LLGPL.
16
17 SUBDIRS=
18
19 include ../Makefile.common
20
21 base=clsql_mysql
22 source=$(base).c
23 object=$(base).o
24 shared_lib=$(base).so
25
26
27 .PHONY: all
28 all: $(shared_lib)
29
30 CFLAGS=-I /usr/local/include/mysql -I /usr/include/mysql -I /sw/include/mysql -I /opt/local/include/mysql -I /usr/local/mysql/include
31 LDFLAGS=-L/usr/local/lib64/mysql -L/usr/local/lib/mysql -L/usr/lib/mysql -L/sw/lib -L/opt/local/lib/mysql -L/usr/local/mysql/lib -L/usr/lib/gcc/i686-pc-cygwin/3.4.4 -lmysqlclient -lz -lc 
32
33 ifneq ($(OS_CYGWIN),0)
34   CFLAGS=-I /cygdrive/c/Program\ Files/MySQL/MySQL\ Server\ 5.0/include
35   LDFLAGS=-L/usr/local/lib64/mysql -L/usr/local/lib/mysql -L/usr/lib/mysql -L/sw/lib -L/opt/local/lib/mysql -L/usr/lib/gcc/i686-pc-cygwin/3.4.4 -lmysqlclient -lpthread -lz -lm -lgcc -lc
36 endif
37
38 $(shared_lib): $(source) Makefile
39 ifneq ($(OS_AIX),0)
40         gcc $(CFLAGS) -c -D_BSD -D_NO_PROTO -D_NONSTD_TYPES -D_MBI=void $(source)
41         make_shared $(LDFLAGS) -o $(shared_lib) $(object)
42 else
43   ifneq ($(OS_SUNOS),0)
44         cc $(CFLAGS) -KPIC -c $(source) -o $(object)
45         cc -G $(object) $(LDFLAGS) -o $(shared_lib)
46   else
47     ifneq ($(OS_DARWIN),0)
48         cc $(CFLAGS) -dynamic -c $(source) -o $(object)
49         ld -bundle /usr/lib/bundle1.o -flat_namespace -undefined suppress -o $(base).dylib $(object)
50         ld -bundle /usr/lib/bundle1.o $(LDFLAGS) -flat_namespace -undefined suppress /usr/lib/libz.dylib -o z.dylib
51     else
52       ifneq ($(OS_CYGWIN),0)
53         gcc $(CFLAGS) -DWIN32 -c $(source) -o $(object)
54         ld -shared -soname=$(base)  $(object) $(LDFLAGS) -o $(shared_lib)
55       else
56         gcc $(CFLAGS) -fPIC -c $(source) -o $(object)
57         ld -shared -soname=$(base) $(object) $(LDFLAGS) -o $(shared_lib)
58       endif
59     endif
60   endif
61 endif
62         rm $(object)
63
64 .PHONY: distclean
65 distclean: clean
66         rm -f $(base).dylib $(base).dylib $(base).so $(base).o