Remove CVS $Id$ keyword
[clsql.git] / uffi / Makefile.32+64bits
1 #!/usr/bin/make
2 ##########################################################################
3 # FILE IDENTIFICATION
4 #
5 #  Name:         Makefile
6 #  Purpose:      Makefile for CLSQL UFFI interface
7 #  Programer:    Kevin M. Rosenberg
8 #  Date Started: Mar 2002
9 #
10 # This file, part of CLSQL, is Copyright (c) 2002-2010 by Kevin M. Rosenberg
11 #
12 # CLSQL users are granted the rights to distribute and use this software
13 # as governed by the terms of the Lisp Lesser GNU Public License
14 # (http://opensource.franz.com/preamble.html), also known as the LLGPL.
15 ##########################################################################
16
17
18 SUBDIRS=
19
20 include ../Makefile.common
21
22 PTRBITS:=$(shell gcc -o ptrbits ptrbits.c && ./ptrbits)
23
24 base:=clsql_uffi
25 basebits:=$(base)
26 ifeq ($(PTRBITS),64)
27     basebits:=$(base)64
28 endif
29  
30 source=$(base).c
31 object=$(basebits).o
32 shared_lib=$(basebits).so
33 shared_lib32=$(base)32.so
34 object32=$(base)32.o
35
36 .PHONY: all
37 ifeq ($(PTRBITS),64)
38   all: $(shared_lib) $(shared_lib32)
39 else
40   all: $(shared_lib)
41 endif
42
43 $(shared_lib): $(source) Makefile
44 ifneq ($(OS_AIX),0)
45         gcc -c -D_BSD -D_NO_PROTO -D_NONSTD_TYPES -D_MBI=void $(source)
46         make_shared -o $(shared_lib) $(object)
47 else
48   ifneq ($(OS_SUNOS),0)
49         cc -KPIC -c $(source) -o $(object)
50         cc -G $(object) -o $(shared_lib)
51   else
52     ifneq ($(OS_DARWIN),0)
53         cc -dynamic -c $(source) -o $(object)
54         ld -bundle /usr/lib/bundle1.o -flat_namespace -undefined suppress -o $(base).dylib $(object)
55         ld -bundle /usr/lib/bundle1.o -flat_namespace -undefined suppress /usr/lib/libz.dylib -o z.dylib
56     else
57       ifneq ($(OS_CYGWIN),0)
58         gcc -c $(source) -o $(object)
59         ld -shared -soname=$(base) $(LDFLAGS) $(object) -o $(shared_lib)
60       else
61         gcc -fPIC -DPIC -c $(source) -o $(object)
62         ld -shared -soname=$(base) -lc $(object) -o $(shared_lib)
63       endif
64     endif
65   endif
66 endif
67         rm $(object)
68
69 ifeq ($(PTRBITS),64)
70 $(shared_lib32): $(source) Makefile
71   ifneq ($(OS_AIX),0)
72           gcc -m32 -c -D_BSD -D_NO_PROTO -D_NONSTD_TYPES -D_MBI=void $(source) -o ($object32)
73           make_shared -o $(shared_lib32) $(object32)
74   else
75     ifneq ($(OS_SUNOS),0)
76           cc -m32 -KPIC -c $(source) -o $(object32)
77           cc -G $(object32) -o $(shared_lib32)
78     else
79       ifneq ($(OS_DARWIN),0)
80           cc -m32 -dynamic -c $(source) -o $(object32)
81           ld -bundle /usr/lib/bundle1.o -flat_namespace -undefined suppress -o $(base)32.dylib $(object32)
82           ld -bundle /usr/lib/bundle1.o -flat_namespace -undefined suppress /usr/lib/libz32.dylib -o z.dylib
83       else
84         ifneq ($(OS_CYGWIN),0)
85           gcc -m32 -c $(source) -o $(object32)
86           ld -shared -soname=$(base) $(LDFLAGS) $(object32) -o $(shared_lib32)
87         else
88           gcc -m32 -fPIC -DPIC -c $(source) -o $(object32)
89           ld -shared -soname=$(base) -L /lib32 -L /usr/lib32 -lc $(object32) -o $(shared_lib32)
90         endif
91       endif
92     endif
93   endif
94 endif
95         rm $(object32)
96
97 .PHONY: distclean
98 distclean: clean
99         rm -f $(base).dylib $(base).dylib $(basebits).so $(base).o ptrbits
100