1 | # Makefile.macosx - configuration for Apple Macintosh OS X -*- Makefile -*- |
---|
2 | # |
---|
3 | # Copyright (c) 2007, Felix L. Winkelmann |
---|
4 | # Copyright (c) 2008, The Chicken Team |
---|
5 | # All rights reserved. |
---|
6 | # |
---|
7 | # Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following |
---|
8 | # conditions are met: |
---|
9 | # |
---|
10 | # Redistributions of source code must retain the above copyright notice, this list of conditions and the following |
---|
11 | # disclaimer. |
---|
12 | # Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following |
---|
13 | # disclaimer in the documentation and/or other materials provided with the distribution. |
---|
14 | # Neither the name of the author nor the names of its contributors may be used to endorse or promote |
---|
15 | # products derived from this software without specific prior written permission. |
---|
16 | # |
---|
17 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS |
---|
18 | # OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY |
---|
19 | # AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR |
---|
20 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
---|
21 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
---|
22 | # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
---|
23 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR |
---|
24 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
---|
25 | # POSSIBILITY OF SUCH DAMAGE. |
---|
26 | |
---|
27 | |
---|
28 | SRCDIR = . |
---|
29 | VPATH = $(SRCDIR) |
---|
30 | |
---|
31 | # platform configuration |
---|
32 | |
---|
33 | ARCH = $(shell sh $(SRCDIR)/config-arch.sh) |
---|
34 | |
---|
35 | # commands |
---|
36 | |
---|
37 | POSTINSTALL_PROGRAM = install_name_tool |
---|
38 | |
---|
39 | # options |
---|
40 | |
---|
41 | C_COMPILER_OPTIONS = -no-cpp-precomp -fno-strict-aliasing -fno-common -DHAVE_CHICKEN_CONFIG_H |
---|
42 | ifdef DEBUGBUILD |
---|
43 | C_COMPILER_OPTIMIZATION_OPTIONS ?= -g -Wall -Wno-unused |
---|
44 | else |
---|
45 | C_COMPILER_OPTIMIZATION_OPTIONS ?= -Os -fomit-frame-pointer |
---|
46 | endif |
---|
47 | LINKER_LINK_SHARED_LIBRARY_OPTIONS = -dynamiclib -compatibility_version 1 -current_version 1.0 -install_name $@ |
---|
48 | POSTINSTALL_PROGRAM_FLAGS = -change libchicken$(SO) $(LIBDIR)/libchicken$(SO) |
---|
49 | LIBRARIAN_OPTIONS = scru |
---|
50 | LINKER_LINK_DLOADABLE_OPTIONS = -bundle -L. |
---|
51 | |
---|
52 | # file extensions |
---|
53 | |
---|
54 | SO = .dylib |
---|
55 | |
---|
56 | # special files |
---|
57 | |
---|
58 | CHICKEN_CONFIG_H = chicken-config.h |
---|
59 | APPLY_HACK_OBJECT = apply-hack.$(ARCH)$(O) |
---|
60 | |
---|
61 | # select default and internal settings |
---|
62 | |
---|
63 | include $(SRCDIR)/defaults.make |
---|
64 | |
---|
65 | chicken-config.h: chicken-defaults.h |
---|
66 | echo "#define HAVE_DIRENT_H 1" >$@ |
---|
67 | echo "#define HAVE_DLFCN_H 1" >>$@ |
---|
68 | echo "#define HAVE_INTTYPES_H 1" >>$@ |
---|
69 | echo "#define HAVE_LIMITS_H 1" >>$@ |
---|
70 | echo "#define HAVE_LONG_LONG 1" >>$@ |
---|
71 | echo "#define HAVE_MEMMOVE 1" >>$@ |
---|
72 | echo "#define HAVE_MEMORY_H 1" >>$@ |
---|
73 | echo "#define HAVE_STDINT_H 1" >>$@ |
---|
74 | echo "#define HAVE_STDLIB_H 1" >>$@ |
---|
75 | echo "#define HAVE_STRERROR 1" >>$@ |
---|
76 | echo "#define HAVE_STRINGS_H 1" >>$@ |
---|
77 | echo "#define HAVE_STRING_H 1" >>$@ |
---|
78 | echo "#define HAVE_STRTOLL 1" >>$@ |
---|
79 | echo "#define HAVE_STRTOQ 1" >>$@ |
---|
80 | echo "#define HAVE_SYS_STAT_H 1" >>$@ |
---|
81 | echo "#define HAVE_SYS_TYPES_H 1" >>$@ |
---|
82 | echo "#define HAVE_UNISTD_H 1" >>$@ |
---|
83 | echo "#define HAVE_UNSIGNED_LONG_LONG 1" >>$@ |
---|
84 | echo "#define STDC_HEADERS 1" >>$@ |
---|
85 | echo "#define HAVE_ALLOCA 1" >>$@ |
---|
86 | echo "#define HAVE_ALLOCA_H 1" >>$@ |
---|
87 | echo "#define HAVE_GRP_H 1" >>$@ |
---|
88 | echo "#define HAVE_CRT_EXTERNS_H 1" >>$@ |
---|
89 | echo "#define HAVE_ERRNO_H 1" >>$@ |
---|
90 | echo "#define HAVE_SYSEXITS_H 1" >>$@ |
---|
91 | echo "#define C_STACK_GROWS_DOWNWARD 1" >>$@ |
---|
92 | ifdef GCHOOKS |
---|
93 | echo "#define C_GC_HOOKS" >>$@ |
---|
94 | endif |
---|
95 | ifdef SYMBOLGC |
---|
96 | echo "#define C_COLLECT_ALL_SYMBOLS" >>$@ |
---|
97 | endif |
---|
98 | ifdef NOAPPLYHOOK |
---|
99 | echo "#define C_NO_APPLY_HOOK" >>$@ |
---|
100 | endif |
---|
101 | ifneq ($(HACKED_APPLY),) |
---|
102 | echo "#define C_HACKED_APPLY" >>$@ |
---|
103 | endif |
---|
104 | cat chicken-defaults.h >>$@ |
---|
105 | |
---|
106 | # architectures |
---|
107 | |
---|
108 | ifeq ($(ARCH),x86-64) |
---|
109 | C_COMPILER_OPTIONS += -m64 |
---|
110 | LINKER_OPTIONS += -m64 |
---|
111 | else |
---|
112 | |
---|
113 | ifeq ($(ARCH),universal) |
---|
114 | C_COMPILER_OPTIONS += -arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk |
---|
115 | LINKER_OPTIONS += -arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk |
---|
116 | |
---|
117 | ifneq ($(HACKED_APPLY),) |
---|
118 | # We undefine HACKED_APPLY in order to override rules.make. |
---|
119 | HACKED_APPLY= |
---|
120 | apply-hack.ppc.darwin$(O): apply-hack.ppc.darwin.s |
---|
121 | as -arch ppc -o $@ $< |
---|
122 | apply-hack.x86$(O): apply-hack.x86.s |
---|
123 | as -arch i386 -o $@ $< |
---|
124 | $(APPLY_HACK_OBJECT): apply-hack.x86$(O) apply-hack.ppc.darwin$(O) |
---|
125 | lipo -create -output $(APPLY_HACK_OBJECT) $^ |
---|
126 | endif |
---|
127 | |
---|
128 | endif |
---|
129 | endif |
---|
130 | |
---|
131 | include $(SRCDIR)/rules.make |
---|