-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.cygwin
267 lines (248 loc) · 9.89 KB
/
Makefile.cygwin
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
# Makefile.cygwin - configuration for Linux -*- Makefile -*-
#
# Copyright (c) 2008-2011, The Chicken Team
# Copyright (c) 2007, Felix L. Winkelmann
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following
# conditions are met:
#
# Redistributions of source code must retain the above copyright notice, this list of conditions and the following
# disclaimer.
# Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following
# disclaimer in the documentation and/or other materials provided with the distribution.
# Neither the name of the author nor the names of its contributors may be used to endorse or promote
# products derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
# AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
ifneq ($(CONFIG),)
include $(CONFIG)
endif
SRCDIR = ./
# platform configuration
ARCH ?= x86
HACKED_APPLY ?= 1
DLLSINPATH = 1
# options
SO = .dll
EXE = .exe
C_COMPILER = gcc
CXX_COMPILER = g++
RC_COMPILER = windres
LINKER = gcc
TARGET_RC_COMPILER ?= $(RC_COMPILER)
C_COMPILER_OPTIONS ?= -fno-strict-aliasing -fwrapv -DHAVE_CHICKEN_CONFIG_H
ifdef DEBUGBUILD
C_COMPILER_OPTIMIZATION_OPTIONS ?= -g -Wall -Wno-unused
else
ifdef OPTIMIZE_FOR_SPEED
C_COMPILER_OPTIMIZATION_OPTIONS ?= -O3 -fomit-frame-pointer
else
C_COMPILER_OPTIMIZATION_OPTIONS ?= -Os -fomit-frame-pointer
endif
endif
C_COMPILER_SHARED_OPTIONS = -DPIC
LINKER_LINK_SHARED_LIBRARY_OPTIONS = -shared
LINKER_LINK_SHARED_PROGRAM_OPTIONS = -Wl,--dll-search-prefix=cyg
LIBCHICKEN_SO_LINKER_OPTIONS = -Wl,--out-implib,lib$(PROGRAM_PREFIX)chicken$(PROGRAM_SUFFIX).dll.a \
-Wl,--export-all-symbols \
-Wl,--enable-auto-import \
-Wl,--image-base=0x10000000 \
-Wl,--dll \
-Wl,--add-stdcall-alias \
-Wl,--no-whole-archive
LIBRARIES = -lm
LIBCHICKEN_IMPORT_LIBRARY = lib$(PROGRAM_PREFIX)chicken$(PROGRAM_SUFFIX).dll.a
# special files
CHICKEN_CONFIG_H = chicken-config.h
APPLY_HACK_OBJECT = apply-hack.$(ARCH)$(O)
# select default and internal settings
CUSTOM_CHICKEN_DEFAULTS=1
include $(SRCDIR)/defaults.make
LIBCHICKEN_SO_LIBRARIES = $(LIBRARIES)
chicken-config.h: chicken-defaults.h
echo "/* GENERATED */" >$@
echo "#define C_INSTALL_RC_COMPILER \"$(RC_COMPILER)\"" >>$@
echo "#define C_TARGET_RC_COMPILER \"$(TARGET_RC_COMPILER)\"" >>$@
echo "#define HAVE_DIRENT_H 1" >>$@
echo "#define HAVE_INTTYPES_H 1" >>$@
echo "#define HAVE_LIMITS_H 1" >>$@
echo "#define HAVE_LONG_LONG 1" >>$@
echo "#define HAVE_MEMMOVE 1" >>$@
echo "#define HAVE_MEMORY_H 1" >>$@
echo "#define HAVE_STDINT_H 1" >>$@
echo "#define HAVE_STDLIB_H 1" >>$@
echo "#define HAVE_STRERROR 1" >>$@
echo "#define HAVE_STRINGS_H 1" >>$@
echo "#define HAVE_STRING_H 1" >>$@
echo "#define HAVE_STRTOLL 1" >>$@
echo "#define HAVE_STRTOQ 1" >>$@
echo "#define HAVE_SYS_STAT_H 1" >>$@
echo "#define HAVE_SYS_TYPES_H 1" >>$@
echo "#define HAVE_UNISTD_H 1" >>$@
echo "#define HAVE_UNSIGNED_LONG_LONG 1" >>$@
echo "#define STDC_HEADERS 1" >>$@
echo "#define HAVE_ALLOCA 1" >>$@
echo "#define HAVE_ALLOCA_H 1" >>$@
echo "#define HAVE_GRP_H 1" >>$@
echo "#define HAVE_ERRNO_H 1" >>$@
echo "#define HAVE_GCVT 1" >>$@
echo "#define HAVE_SYSEXITS_H 1" >>$@
echo "#define HAVE_DLFCN_H 1" >>$@
echo "#define C_STACK_GROWS_DOWNWARD 1" >>$@
ifdef GCHOOKS
echo "#define C_GC_HOOKS" >>$@
endif
ifdef SYMBOLGC
echo "#define C_COLLECT_ALL_SYMBOLS" >>$@
endif
ifdef HACKED_APPLY
echo "#define C_HACKED_APPLY" >>$@
endif
cat chicken-defaults.h >>$@
chicken-defaults.h:
echo "/* generated */" >$@
echo "#define C_BUILD_TAG \"$(BUILD_TAG)\"" >>$@
echo "#define C_CHICKEN_PROGRAM \"$(CHICKEN_PROGRAM)$(EXE)\"" >>$@
echo "#ifndef C_INSTALL_CC" >>$@
echo "# define C_INSTALL_CC \"$(C_COMPILER)\"" >>$@
echo "#endif" >>$@
echo "#ifndef C_INSTALL_CXX" >>$@
echo "# define C_INSTALL_CXX \"$(CXX_COMPILER)\"" >>$@
echo "#endif" >>$@
echo "#ifndef C_INSTALL_CFLAGS" >>$@
echo "# define C_INSTALL_CFLAGS \"$(C_COMPILER_OPTIONS) $(C_COMPILER_OPTIMIZATION_OPTIONS)\"" >>$@
echo "#endif" >>$@
echo "#ifndef C_INSTALL_LDFLAGS" >>$@
echo "# define C_INSTALL_LDFLAGS \"$(LINKER_OPTIONS) $(LINKER_OPTIMIZATION_OPTIONS)\"" >>$@
echo "#endif" >>$@
echo "#ifndef C_INSTALL_PREFIX" >>$@
echo "# define C_INSTALL_PREFIX \"$(PREFIX)\"" >>$@
echo "#endif" >>$@
echo "#ifndef C_INSTALL_SHARE_HOME" >>$@
echo "# define C_INSTALL_SHARE_HOME \"$(DATADIR)\"" >>$@
echo "#endif" >>$@
echo "#ifndef C_INSTALL_BIN_HOME" >>$@
echo "# define C_INSTALL_BIN_HOME \"$(BINDIR)\"" >>$@
echo "#endif" >>$@
echo "#ifndef C_INSTALL_EGG_HOME" >>$@
echo "# define C_INSTALL_EGG_HOME \"$(EGGDIR)\"" >>$@
echo "#endif" >>$@
echo "#ifndef C_INSTALL_LIB_HOME" >>$@
echo "# define C_INSTALL_LIB_HOME \"$(LIBDIR)\"" >>$@
echo "#endif" >>$@
echo "#ifndef C_INSTALL_LIB_NAME" >>$@
echo "# define C_INSTALL_LIB_NAME \"$(INSTALL_LIB_NAME)\"" >>$@
echo "#endif" >>$@
echo "#ifndef C_INSTALL_STATIC_LIB_HOME" >>$@
echo "# define C_INSTALL_STATIC_LIB_HOME \"$(LIBDIR)\"" >>$@
echo "#endif" >>$@
echo "#ifndef C_INSTALL_INCLUDE_HOME" >>$@
echo "# define C_INSTALL_INCLUDE_HOME \"$(INCDIR)\"" >>$@
echo "#endif" >>$@
echo "#ifndef C_INSTALL_MORE_LIBS" >>$@
echo "# define C_INSTALL_MORE_LIBS \"$(LIBRARIES)\"" >>$@
echo "#endif" >>$@
echo "#ifndef C_INSTALL_MORE_STATIC_LIBS" >>$@
echo "# define C_INSTALL_MORE_STATIC_LIBS \"$(LIBRARIES)\"" >>$@
echo "#endif" >>$@
echo "#ifndef C_DEFAULT_TARGET_STACK_SIZE" >>$@
echo "# define C_DEFAULT_TARGET_STACK_SIZE $(NURSERY)" >>$@
echo "#endif" >>$@
echo "#ifndef C_DEFAULT_TARGET_HEAP_SIZE" >>$@
echo "# define C_DEFAULT_TARGET_HEAP_SIZE 0" >>$@
echo "#endif" >>$@
echo "#ifndef C_STACK_GROWS_DOWNWARD" >>$@
echo "# define C_STACK_GROWS_DOWNWARD $(STACKDIRECTION)" >>$@
echo "#endif" >>$@
echo "#ifndef C_TARGET_MORE_LIBS" >>$@
echo "# define C_TARGET_MORE_LIBS \"$(TARGET_LIBRARIES)\"" >>$@
echo "#endif" >>$@
echo "#ifndef C_TARGET_MORE_LIBS" >>$@
echo "# define C_TARGET_MORE_LIBS \"$(TARGET_LIBRARIES)\"" >>$@
echo "#endif" >>$@
echo "#ifndef C_TARGET_MORE_STATIC_LIBS" >>$@
echo "# define C_TARGET_MORE_STATIC_LIBS \"$(TARGET_LIBRARIES)\"" >>$@
echo "#endif" >>$@
echo "#ifndef C_TARGET_CC" >>$@
echo "# define C_TARGET_CC \"$(TARGET_C_COMPILER)\"" >>$@
echo "#endif" >>$@
echo "#ifndef C_TARGET_CXX" >>$@
echo "# define C_TARGET_CXX \"$(TARGET_CXX_COMPILER)\"" >>$@
echo "#endif" >>$@
echo "#ifndef C_TARGET_CFLAGS" >>$@
echo "# define C_TARGET_CFLAGS \"$(TARGET_C_COMPILER_OPTIONS) $(TARGET_C_COMPILER_OPTIMIZATION_OPTIONS)\"" >>$@
echo "#endif" >>$@
echo "#ifndef C_TARGET_LDFLAGS" >>$@
echo "# define C_TARGET_LDFLAGS \"$(TARGET_LINKER_OPTIONS) $(TARGET_LINKER_OPTIMIZATION_OPTIONS)\"" >>$@
echo "#endif" >>$@
echo "#ifndef C_TARGET_FEATURES" >>$@
echo "# define C_TARGET_FEATURES \"$(TARGET_FEATURES)\"" >>$@
echo "#endif" >>$@
echo "#ifndef C_CROSS_CHICKEN" >>$@
echo "# define C_CROSS_CHICKEN $(CROSS_CHICKEN)" >>$@
echo "#endif" >>$@
echo "#ifndef C_TARGET_PREFIX" >>$@
echo "# define C_TARGET_PREFIX \"$(TARGET_PREFIX)\"" >>$@
echo "#endif" >>$@
echo "#ifndef C_TARGET_BIN_HOME" >>$@
echo "# define C_TARGET_BIN_HOME \"$(TARGET_PREFIX)/bin\"" >>$@
echo "#endif" >>$@
echo "#ifndef C_TARGET_LIB_HOME" >>$@
echo "# define C_TARGET_LIB_HOME \"$(TARGET_PREFIX)/lib\"" >>$@
echo "#endif" >>$@
echo "#ifndef C_TARGET_LIB_NAME" >>$@
echo "# define C_TARGET_LIB_NAME \"$(TARGET_LIB_NAME)\"" >>$@
echo "#endif" >>$@
echo "#ifndef C_TARGET_RUN_LIB_HOME" >>$@
echo "# define C_TARGET_RUN_LIB_HOME \"$(TARGET_RUN_PREFIX)/bin\"" >>$@
echo "#endif" >>$@
echo "#ifndef C_TARGET_SHARE_HOME" >>$@
echo "# define C_TARGET_SHARE_HOME \"$(TARGET_PREFIX)/share\"" >>$@
echo "#endif" >>$@
echo "#ifndef C_TARGET_INCLUDE_HOME" >>$@
echo "# define C_TARGET_INCLUDE_HOME \"$(TARGET_PREFIX)/include/chicken\"" >>$@
echo "#endif" >>$@
echo "#ifndef C_TARGET_STATIC_LIB_HOME" >>$@
echo "# define C_TARGET_STATIC_LIB_HOME \"$(TARGET_PREFIX)/lib\"" >>$@
echo "#endif" >>$@
echo "#ifndef C_CHICKEN_PROGRAM" >>$@
echo "# define C_CHICKEN_PROGRAM \"$(CHICKEN_PROGRAM)\"" >>$@
echo "#endif" >>$@
echo "#ifndef C_CSC_PROGRAM" >>$@
echo "# define C_CSC_PROGRAM \"$(CSC_PROGRAM)\"" >>$@
echo "#endif" >>$@
echo "#ifndef C_CSI_PROGRAM" >>$@
echo "# define C_CSI_PROGRAM \"$(CSI_PROGRAM)\"" >>$@
echo "#endif" >>$@
echo "#ifndef C_CHICKEN_BUG_PROGRAM" >>$@
echo "# define C_CHICKEN_BUG_PROGRAM \"$(CHICKEN_BUG_PROGRAM)\"" >>$@
echo "#endif" >>$@
echo "#ifndef C_CHICKEN_INSTALL_PROGRAM" >>$@
echo "# define C_CHICKEN_INSTALL_PROGRAM \"$(CHICKEN_INSTALL_PROGRAM)\"" >>$@
echo "#endif" >>$@
echo "#ifndef C_CHICKEN_UNINSTALL_PROGRAM" >>$@
echo "# define C_CHICKEN_UNINSTALL_PROGRAM \"$(CHICKEN_UNINSTALL_PROGRAM)\"" >>$@
echo "#endif" >>$@
echo "#ifndef C_CHICKEN_STATUS_PROGRAM" >>$@
echo "# define C_CHICKEN_STATUS_PROGRAM \"$(CHICKEN_STATUS_PROGRAM)\"" >>$@
echo "#endif" >>$@
echo "#ifndef C_WINDOWS_SHELL" >>$@
echo "# define C_WINDOWS_SHELL 0" >>$@
echo "#endif" >>$@
echo "#ifndef C_BINARY_VERSION" >>$@
echo "# define C_BINARY_VERSION $(BINARYVERSION)" >>$@
echo "#endif" >>$@
echo "#ifndef C_BRANCH_NAME" >>$@
echo "# define C_BRANCH_NAME \"$(BRANCHNAME)\"" >>$@
echo "#endif" >>$@
echo "/* END OF FILE */" >>$@
include $(SRCDIR)/rules.make