fix permissions, remove dylib libs
[clsql/s11.git] / uffi / Makefile.32+64bits
blobb781aca76ce43048f7dd55a3ccb328eff166b537
1 #!/usr/bin/make
2 # FILE IDENTIFICATION
4 # Name: Makefile
5 # Purpose: Makefile for CLSQL UFFI interface
6 # Programer: Kevin M. Rosenberg
7 # Date Started: Mar 2002
9 # CVS Id: $Id: Makefile 11058 2006-08-30 08:05:21Z kevin $
11 # This file, part of CLSQL, is Copyright (c) 2002-2006 by Kevin M. Rosenberg
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.
17 SUBDIRS=
19 include ../Makefile.common
21 PTRBITS:=$(shell gcc -o ptrbits ptrbits.c && ./ptrbits)
23 base:=clsql_uffi
24 basebits:=$(base)
25 ifeq ($(PTRBITS),64)
26 basebits:=$(base)64
27 endif
29 source=$(base).c
30 object=$(basebits).o
31 shared_lib=$(basebits).so
32 shared_lib32=$(base)32.so
33 object32=$(base)32.o
35 .PHONY: all
36 ifeq ($(PTRBITS),64)
37 all: $(shared_lib) $(shared_lib32)
38 else
39 all: $(shared_lib)
40 endif
42 $(shared_lib): $(source) Makefile
43 ifneq ($(OS_AIX),0)
44 gcc -c -D_BSD -D_NO_PROTO -D_NONSTD_TYPES -D_MBI=void $(source)
45 make_shared -o $(shared_lib) $(object)
46 else
47 ifneq ($(OS_SUNOS),0)
48 cc -KPIC -c $(source) -o $(object)
49 cc -G $(object) -o $(shared_lib)
50 else
51 ifneq ($(OS_DARWIN),0)
52 cc -dynamic -c $(source) -o $(object)
53 ld -bundle /usr/lib/bundle1.o -flat_namespace -undefined suppress -o $(base).dylib $(object)
54 ld -bundle /usr/lib/bundle1.o -flat_namespace -undefined suppress /usr/lib/libz.dylib -o z.dylib
55 else
56 ifneq ($(OS_CYGWIN),0)
57 gcc -c $(source) -o $(object)
58 ld -shared -soname=$(base) $(LDFLAGS) $(object) -o $(shared_lib)
59 else
60 gcc -fPIC -DPIC -c $(source) -o $(object)
61 ld -shared -soname=$(base) -lc $(object) -o $(shared_lib)
62 endif
63 endif
64 endif
65 endif
66 rm $(object)
68 ifeq ($(PTRBITS),64)
69 $(shared_lib32): $(source) Makefile
70 ifneq ($(OS_AIX),0)
71 gcc -m32 -c -D_BSD -D_NO_PROTO -D_NONSTD_TYPES -D_MBI=void $(source) -o ($object32)
72 make_shared -o $(shared_lib32) $(object32)
73 else
74 ifneq ($(OS_SUNOS),0)
75 cc -m32 -KPIC -c $(source) -o $(object32)
76 cc -G $(object32) -o $(shared_lib32)
77 else
78 ifneq ($(OS_DARWIN),0)
79 cc -m32 -dynamic -c $(source) -o $(object32)
80 ld -bundle /usr/lib/bundle1.o -flat_namespace -undefined suppress -o $(base)32.dylib $(object32)
81 ld -bundle /usr/lib/bundle1.o -flat_namespace -undefined suppress /usr/lib/libz32.dylib -o z.dylib
82 else
83 ifneq ($(OS_CYGWIN),0)
84 gcc -m32 -c $(source) -o $(object32)
85 ld -shared -soname=$(base) $(LDFLAGS) $(object32) -o $(shared_lib32)
86 else
87 gcc -m32 -fPIC -DPIC -c $(source) -o $(object32)
88 ld -shared -soname=$(base) -L /lib32 -L /usr/lib32 -lc $(object32) -o $(shared_lib32)
89 endif
90 endif
91 endif
92 endif
93 endif
94 rm $(object32)
96 .PHONY: distclean
97 distclean: clean
98 rm -f $(base).dylib $(base).dylib $(basebits).so $(base).o ptrbits