6e3f02999e4a62faff58c11f8951e2f250bcae5e
[clsql.git] / db-mysql / Makefile
1 # -*- Mode: Makefile -*-
2 ###########################################################################
3 # FILE IDENTIFICATION
4
5 #  Name:         Makefile
6 #  Purpose:      Makefile for the CLSQL MySQL database interface
7 #  Programer:    Kevin M. Rosenberg
8 #  Date Started: Mar 2002
9 #
10 #  CVS Id:   $Id: Makefile,v 1.2 2002/12/09 10:34:16 kevin Exp $
11 #
12 # This file, part of CLSQL, is Copyright (c) 2002 by Kevin M. Rosenberg
13 #
14 # CLSQL users are granted the rights to distribute and use this software
15 # as governed by the terms of the Lisp Lesser GNU Public License
16 # (http://opensource.franz.com/preamble.html), also known as the LLGPL.
17 ###########################################################################
18
19 # These variables are correct for GCC
20 CC=gcc
21 SHARED_CC_OPT=-fPIC -DPIC
22 SHARED_LD_OPT=-shared
23 LD=gcc
24
25 # Use these for Sun's C compiler and Solaris (ACL)
26 #CC=cc
27 #SHARED_CC_OPT=-KPIC
28 #SHARED_LD_OPT=-G
29 #LD=ld
30
31 # May need to change to the directory where you have installed mysql's library
32 vpath %.so /usr/lib /usr/local/lib /opt/mysql/lib/mysql
33 vpath %.h /usr/include /usr/include/mysql /usr/local/include /usr/local/include/mysql /opt/mysql/include/mysql
34 INCLUDE_DIRS=-I/usr/include/mysql -I/usr/local/include/mysql -I/opt/mysql/include/mysql -I/usr/include -I/usr/local/include
35
36 # Nothing to configure beyond this point
37
38 base=clsql-mysql
39 source=$(base).c
40 object=$(base).o
41 shared_lib=$(base).so
42
43 .PHONY: all clean distclean
44
45 all: compile
46
47 compile: $(shared_lib)
48
49 $(object): $(source) mysql.h
50         $(CC) ${SHARED_CC_OPT} $(INCLUDE_DIRS) -c $< -o $@
51
52 $(shared_lib): $(object) 
53         $(LD) ${SHARED_LD_OPT} $^ -o $@
54
55 mac: $(object)
56         ld -bundle /usr/lib/bundle1.o -flat_namespace -undefined suppress $(object) -o $(base).dylib
57         ld -bundle /usr/lib/bundle1.o -flat_namespace -undefined suppress /sw/lib/libmysqlclient.dylib -o libmysqlclient.dylib
58         ld -bundle /usr/lib/bundle1.o -flat_namespace -undefined suppress /usr/lib/libz.dylib -o libz.dylib
59
60 clean:
61         @rm -f $(object) $(shared_lib) *~
62
63 distclean: clean
64