3602885812ad984f045caeaf8c3b3069efa13228
[clsql.git] / uffi / Makefile
1 #!/usr/bin/make
2 # FILE IDENTIFICATION
3 #
4 #  Name:         Makefile
5 #  Purpose:      Makefile for CLSQL UFFI interface
6 #  Programer:    Kevin M. Rosenberg
7 #  Date Started: Mar 2002
8 #
9 # This file, part of CLSQL, is Copyright (c) 2002-2006 by Kevin M. Rosenberg
10 #
11 # CLSQL users are granted the rights to distribute and use this software
12 # as governed by the terms of the Lisp Lesser GNU Public License
13 # (http://opensource.franz.com/preamble.html), also known as the LLGPL.
14
15 SUBDIRS=
16
17 include ../Makefile.common
18
19 base=clsql_uffi
20 source=$(base).c
21 object=$(base).o
22 shared_lib=$(base).so
23 shared64_lib=$(base)64.so
24
25 .PHONY: all
26 all: $(shared_lib)
27
28 $(shared_lib): $(source) Makefile
29 ifneq ($(OS_AIX),0)
30         gcc -c -D_BSD -D_NO_PROTO -D_NONSTD_TYPES -D_MBI=void $(source)
31         make_shared -o $(shared_lib) $(object)
32 else
33   ifneq ($(OS_SUNOS),0)
34         cc -KPIC -c $(source) -o $(object)
35         cc -G $(object) -o $(shared_lib)
36   else
37     ifneq ($(OS_DARWIN),0)
38         cc -dynamic -c $(source) -o $(object)
39         ld -bundle /usr/lib/bundle1.o -flat_namespace -undefined suppress -o $(base).dylib $(object)
40         ld -bundle /usr/lib/bundle1.o -flat_namespace -undefined suppress /usr/lib/libz.dylib -o z.dylib
41     else
42       ifneq ($(OS_CYGWIN),0)
43         gcc -c $(source) -o $(object)
44         ld -shared -soname=$(base) $(LDFLAGS) $(object) -o $(shared_lib)
45       else
46         ifneq ($(OS_LINUX64),0)
47           gcc -fPIC -DPIC -c $(source) -o $(object)
48           ld -shared -soname=$(base) -lc $(object) -o $(shared64_lib)
49           rm -f $(object)
50           @echo "Ensure that you have multiarch i386 build tools if you want to build 32-bit library"
51           -gcc -m32 -fPIC -DPIC -c $(source) -o $(object)
52           -ld -melf_i386 -shared -soname=$(base) -lc $(object) -o $(shared_lib)
53         else
54           gcc -fPIC -DPIC -c $(source) -o $(object)
55           ld -shared -soname=$(base) -lc $(object) -o $(shared_lib)
56         endif
57       endif
58     endif
59   endif
60 endif
61         rm -f $(object)
62
63
64 .PHONY: distclean
65 distclean: clean
66         rm -f $(base).dylib $(base).dylib $(base).so $(base).o