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
)
32 CFLAGS
:= -Wall
-std
=c99
-pedantic
33 SHLIB_CFLAGS
:= -shared
36 ifneq ($(if
$(filter Linux
%BSD
,$(OSTYPE
)),OK
), OK
)
37 ifeq ($(OSTYPE
), Darwin
)
38 SHLIB_CFLAGS
:= -dynamiclib
40 ifeq ($(shell sysctl
-n hw.optional.x86_64
), 1)
45 ifeq ($(OSTYPE
), SunOS
)
46 CFLAGS
:= -m64
-fPIC
-c
-Wall
-std
=c99
-pedantic
48 # Let's assume this is win32
54 ifneq ($(ARCH
), x86_64
)
58 ifeq ($(ARCH
), x86_64
)
62 # Are all G5s ppc970s?
63 ifeq ($(ARCH
), ppc970
)
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
)
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
) $<
96 rm -f
*.so
*.dylib
*.dll
*.bundle
98 # vim: ft=make ts=3 noet