Fix / Improve with-foreign-pointer-as-string in manual
[cffi.git] / tests / GNUmakefile
blob0776a192441363f2f1ca1b046aedc9bdc2fb9e79
1 # -*- Mode: Makefile; tab-width: 3; indent-tabs-mode: t -*-
3 # Makefile --- Make targets for various tasks.
5 # Copyright (C) 2005, James Bielman <jamesjb@jamesjb.com>
7 # Permission is hereby granted, free of charge, to any person
8 # obtaining a copy of this software and associated documentation
9 # files (the "Software"), to deal in the Software without
10 # restriction, including without limitation the rights to use, copy,
11 # modify, merge, publish, distribute, sublicense, and/or sell copies
12 # of the Software, and to permit persons to whom the Software is
13 # furnished to do so, subject to the following conditions:
15 # The above copyright notice and this permission notice shall be
16 # included in all copies or substantial portions of the Software.
18 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19 # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
22 # HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
23 # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25 # DEALINGS IN THE SOFTWARE.
28 OSTYPE = $(shell uname)
29 ARCH = $(shell uname -m)
31 CC := gcc
32 CFLAGS := -Wall -std=c99 -pedantic
33 SHLIB_CFLAGS := -shared
34 SHLIB_EXT := .so
36 ifneq ($(if $(filter Linux %BSD,$(OSTYPE)),OK), OK)
37 ifeq ($(OSTYPE), Darwin)
38 SHLIB_CFLAGS := -dynamiclib
39 SHLIB_EXT := .dylib
40 ifeq ($(shell sysctl -n hw.optional.x86_64), 1)
41 ARCH := x86_64
42 CFLAGS_64 := -m64
43 endif
44 else
45 ifeq ($(OSTYPE), SunOS)
46 CFLAGS := -m64 -fPIC -c -Wall -std=c99 -pedantic
47 else
48 # Let's assume this is win32
49 SHLIB_EXT := .dll
50 endif
51 endif
52 endif
54 ifneq ($(ARCH), x86_64)
55 CFLAGS += -lm
56 endif
58 ifeq ($(ARCH), x86_64)
59 CFLAGS_64 += -fPIC
60 endif
62 # Are all G5s ppc970s?
63 ifeq ($(ARCH), ppc970)
64 CFLAGS_64 += -m64
65 endif
67 SHLIBS = libtest$(SHLIB_EXT) libtest2$(SHLIB_EXT) libfsbv$(SHLIB_EXT)
69 ifeq ($(ARCH), x86_64)
70 SHLIBS += libtest32$(SHLIB_EXT) libtest2_32$(SHLIB_EXT) libfsbv_32$(SHLIB_EXT)
71 endif
73 shlibs: $(SHLIBS)
75 libtest$(SHLIB_EXT): libtest.c
76 $(CC) -o $@ $(SHLIB_CFLAGS) $(CFLAGS) $(CFLAGS_64) $<
78 libtest2$(SHLIB_EXT): libtest2.c
79 $(CC) -o $@ $(SHLIB_CFLAGS) $(CFLAGS) $(CFLAGS_64) $<
81 libfsbv$(SHLIB_EXT): libfsbv.c
82 $(CC) -o $@ $(SHLIB_CFLAGS) $(CFLAGS) $(CFLAGS_64) $<
84 ifeq ($(ARCH), x86_64)
85 libtest32$(SHLIB_EXT): libtest.c
86 -$(CC) -m32 -o $@ $(SHLIB_CFLAGS) $(CFLAGS) $<
88 libtest2_32$(SHLIB_EXT): libtest2.c
89 -$(CC) -m32 -o $@ $(SHLIB_CFLAGS) $(CFLAGS) $<
91 libfsbv_32$(SHLIB_EXT): libfsbv.c
92 -$(CC) -m32 -o $@ $(SHLIB_CFLAGS) $(CFLAGS) $<
93 endif
95 clean:
96 rm -f *.so *.dylib *.dll *.bundle
98 # vim: ft=make ts=3 noet