source: project/chicken/branches/prerelease/Makefile.msvc @ 13240

Last change on this file since 13240 was 13240, checked in by felix winkelmann, 11 years ago

merged trunk svn rev. 13239 into prerelease

File size: 11.5 KB
Line 
1# Makefile.msvc - configuration for MSVC -*- Makefile -*-
2#
3# Copyright (c) 2007, Felix L. Winkelmann
4# Copyright (c) 2008-2009 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# Send bugs, suggestions and ideas to:
28#
29# felix@call-with-current-continuation.org
30#
31# Felix L. Winkelmann
32# Unter den Gleichen 1
33# 37130 Gleichen
34# Germany
35
36SEP = \\
37SRCDIR = .$(SEP)
38
39# platform configuration
40
41DLLSINPATH = 1
42ARCH = x86
43HACKED_APPLY =
44WINDOWS = 1
45WINDOWS_SHELL = 1
46UNAME_SYS = win32
47
48# file extensions
49
50O = .obj
51A = -static.lib
52SO = .dll
53EXE = .exe
54ASM = .c
55MANIFEST = .manifest
56
57# commands
58
59C_COMPILER = cl
60CXX_COMPILER = cl
61LINKER = link
62LIBRARIAN = lib
63
64# options
65
66C_COMPILER_OPTIONS = -nologo -wd4142 -DHAVE_CHICKEN_CONFIG_H
67C_COMPILER_STATIC_OPTIONS = -MT
68C_COMPILER_SHARED_OPTIONS = -MD -DPIC
69LINKER_OPTIONS = -nologo
70C_COMPILER_GUI_RUNTIME_OPTIONS = -DC_WINDOWS_GUI
71INCLUDES = -I.
72LIBRARIES = ws2_32.lib advapi32.lib
73
74# debug
75
76ifdef DEBUGBUILD
77C_COMPILER_OPTIONS = -nologo -DHAVE_CHICKEN_CONFIG_H
78#C_COMPILER_OPTIMIZATION_OPTIONS = -Zi
79C_COMPILER_SHARED_OPTIONS = -MDd -DPIC
80LINKER_OPTIONS += -debug
81endif
82
83# compiler-dependent output options used by rules
84
85C_COMPILER_COMPILE_OPTION = -c
86C_COMPILER_OUTPUT_OPTION = -Fo
87C_COMPILER_OUTPUT = $(C_COMPILER_OUTPUT_OPTION)$@
88C_COMPILER_BUILD_UNSAFE_RUNTIME_OPTIONS = $(C_COMPILER_BUILD_RUNTIME_OPTIONS) -DC_UNSAFE_RUNTIME
89
90# linker-dependent output options
91
92LINKER_EXECUTABLE_OPTIONS = 
93LINKER_STATIC_OPTIONS = $(LINKER_EXECUTABLE_OPTIONS)
94LINKER_OUTPUT_OPTION = -out:
95LINKER_OUTPUT = $(LINKER_OUTPUT_OPTION)$@
96LINKER_LIBRARY_OPTION =
97LINKER_LIBRARY_PREFIX = lib
98LINKER_LIBRARY_SUFFIX = .lib
99LINKER_LINK_SHARED_LIBRARY_OPTIONS = -dll
100LINKER_LINK_SHARED_DLOADABLE_OPTIONS = -dll
101
102PROGRAM_IMPORT_LIBRARIES = chicken.lib csi.lib csc.lib chicken-setup.lib chicken-profile.lib chicken-bug.lib
103LIBCHICKEN_IMPORT_LIBRARY = libchicken.lib
104LIBUCHICKEN_IMPORT_LIBRARY = libuchicken.lib
105LIBCHICKENGUI_IMPORT_LIBRARY = libchickengui.lib
106MSVC_CHICKEN_IMPORT_LIBRARIES = $(PROGRAM_IMPORT_LIBRARIES) $(LIBCHICKEN_IMPORT_LIBRARY) \
107                                $(LIBUCHICKEN_IMPORT_LIBRARY) $(LIBCHICKENGUI_IMPORT_LIBRARY)
108MSVC_CHICKEN_EXPORT_FILES = $(MSVC_CHICKEN_IMPORT_LIBRARIES:.lib=.exp)
109LIBCHICKEN_SO_LINKER_OPTIONS = -implib:$(LIBCHICKEN_IMPORT_LIBRARY)
110LIBUCHICKEN_SO_LINKER_OPTIONS = -implib:$(LIBUCHICKEN_IMPORT_LIBRARY)
111LIBCHICKENGUI_SO_LINKER_OPTIONS = -implib:$(LIBCHICKENGUI_IMPORT_LIBRARY)
112
113# librarian-dependent output options
114
115LIBRARIAN_OPTIONS = -nologo
116LIBRARIAN_OUTPUT_OPTION = -out:
117LIBRARIAN_OUTPUT = $(LIBRARIAN_OUTPUT_OPTION)$@
118
119# assembler-dependent (here we are configured for compiling C w/ inline assembly)
120
121ASSEMBLER_OPTIONS = $(C_COMPILER_OPTIONS)
122ASSEMBLER_OUTPUT_OPTION = -Fo
123ASSEMBLER_OUTPUT = $(ASSEMBLER_OUTPUT_OPTION)$@
124ASSEMBLER_COMPILE_OPTION = -c
125
126# stuff for static-only builds
127ifdef STATICBUILD
128PRIMARY_LIBCHICKEN = libchicken$(A)
129else
130PRIMARY_LIBCHICKEN = libchicken$(SO)
131LIBCHICKEN_SO_FILE = libchicken$(SO)
132LIBUCHICKEN_SO_FILE = libuchicken$(SO)
133LIBCHICKENGUI_SO_FILE = libchickengui$(SO)
134endif
135
136# import libraries, needed in windows
137
138LIBCHICKEN_SO_LIBRARIES = $(LIBRARIES)
139LIBUCHICKEN_SO_LIBRARIES = $(LIBRARIES)
140LIBCHICKENGUI_SO_LIBRARIES = $(LIBRARIES) kernel32.lib user32.lib gdi32.lib
141
142# manifest files, yet more windows crap (VC2005+)
143
144INSTALL_MANIFEST_OPTIONS = -m755
145
146CHICKEN_MANIFEST = $(CHICKEN_PROGRAM)$(EXE)$(MANIFEST)
147CSI_MANIFEST = $(CSI_PROGRAM)$(EXE)$(MANIFEST)
148CHICKEN_PROFILE_MANIFEST = $(CHICKEN_PROFILE_PROGRAM)$(EXE)$(MANIFEST)
149CSC_MANIFEST = $(CSC_PROGRAM)$(EXE)$(MANIFEST)
150CHICKEN_BUG_MANIFEST = $(CHICKEN_BUG_PROGRAM)$(EXE)$(MANIFEST)
151ifndef BUILD_SETUP_TOOLS
152CHICKEN_SETUP_MANIFEST = $(CHICKEN_SETUP_PROGRAM)$(EXE)$(MANIFEST)
153CLEAN_MANIFESTS = $(CHICKEN_MANIFEST) $(CSI_MANIFEST) $(CHICKEN_PROFILE_MANIFEST) \
154                  $(CSC_MANIFEST) $(CHICKEN_BUG_MANIFEST) $(CHICKEN_SETUP_MANIFEST) \
155                  $(LIBCHICKEN_SO_FILE)$(MANIFEST) $(LIBUCHICKEN_SO_FILE)$(MANIFEST) \
156                  $(LIBCHICKENGUI_SO_FILE)$(MANIFEST)
157else
158CHICKEN_INSTALL_MANIFEST = $(CHICKEN_INSTALL_PROGRAM)$(EXE)$(MANIFEST)
159CHICKEN_UNINSTALL_MANIFEST = $(CHICKEN_UNINSTALL_PROGRAM)$(EXE)$(MANIFEST)
160CHICKEN_STATUS_MANIFEST = $(CHICKEN_STATUS_PROGRAM)$(EXE)$(MANIFEST)
161CLEAN_MANIFESTS = $(CHICKEN_MANIFEST) $(CSI_MANIFEST) $(CHICKEN_PROFILE_MANIFEST) \
162                  $(CSC_MANIFEST) $(CHICKEN_BUG_MANIFEST) $(CHICKEN_INSTALL_MANIFEST) \
163                  $(CHICKEN_UNINSTALL_MANIFEST) $(CHICKEN_STATUS_MANIFEST) \
164                  $(LIBCHICKEN_SO_FILE)$(MANIFEST) $(LIBUCHICKEN_SO_FILE)$(MANIFEST) \
165                  $(LIBCHICKENGUI_SO_FILE)$(MANIFEST)
166endif
167
168# special files
169
170CHICKEN_CONFIG_H = chicken-config.h
171APPLY_HACK_SRC = 
172APPLY_HACK_OBJECT = 
173POSIXFILE = posixwin
174
175CUSTOM_CHICKEN_DEFAULTS=1
176
177# default settings
178
179include defaults.make
180
181# main target
182
183all: libchicken$(A) libuchicken$(A) chicken$(EXE) csi$(EXE) chicken-profile$(EXE) \
184        csc$(EXE) libchicken$(SO) \
185        libuchicken$(SO) libchickengui$(SO) libchickengui$(A) chicken-setup$(EXE) \
186        chicken.info
187
188chicken-config.h: chicken-defaults.h
189        echo #define HAVE_DIRENT_H 0 >>$@
190        echo #define HAVE_INTTYPES_H 0 >>$@
191        echo #define HAVE_LIMITS_H 1 >>$@
192        echo #define HAVE_LONG_LONG 1 >>$@
193        echo #define HAVE_MEMMOVE 1 >>$@
194        echo #define HAVE_MEMORY_H 1 >>$@
195        echo #define HAVE_STDINT_H 0 >>$@
196        echo #define HAVE_STDLIB_H 1 >>$@
197        echo #define HAVE_STRERROR 1 >>$@
198        echo #define HAVE_STRINGS_H 0 >>$@
199        echo #define HAVE_STRING_H 1 >>$@
200        echo #define HAVE_STRTOLL 0 >>$@
201        echo #define HAVE_SYS_STAT_H 1 >>$@
202        echo #define HAVE_SYS_TYPES_H 1 >>$@
203        echo #define HAVE_UNISTD_H 0 >>$@
204        echo #define HAVE_UNSIGNED_LONG_LONG 0 >>$@
205        echo #define HAVE_WINDOWS_H 1 >>$@
206        echo #define HAVE__STRTOI64 1 >>$@
207        echo #define STDC_HEADERS 1 >>$@
208        echo #define HAVE_ALLOCA_H 0 >>$@
209        echo #define HAVE_DIRECT_H 1 >>$@
210        echo #define HAVE_ERRNO_H 1 >>$@
211        echo #define HAVE_GCVT 1 >>$@
212        echo #define HAVE_LOADLIBRARY 1 >>$@
213        echo #define HAVE_GETPROCADDRESS 1 >>$@
214        echo #define HAVE_WINSOCK2_H 1 >>$@
215        echo #define HAVE_WS2TCPIP_H 1 >>$@
216        echo #define C_STACK_GROWS_DOWNWARD 1 >>$@
217ifdef GCHOOKS
218        echo #define C_GC_HOOKS >>$@
219endif
220ifdef SYMBOLGC
221        echo #define C_COLLECT_ALL_SYMBOLS >>$@
222endif
223ifdef NOAPPLYHOOK
224        echo #define C_NO_APPLY_HOOK >>$@
225endif
226        echo #define C_HACKED_APPLY >>$@
227        cat chicken-defaults.h >>$@
228
229chicken-defaults.h:
230        echo /* generated */ >$@
231        echo #define C_BUILD_TAG "$(BUILD_TAG)" >>$@
232        echo #define C_CHICKEN_PROGRAM "$(CHICKEN_PROGRAM)$(EXE)" >>$@
233        echo #define C_WINDOWS_SHELL 1 >>$@
234        echo #ifndef C_INSTALL_CC >>$@
235        echo # define C_INSTALL_CC "$(C_COMPILER)" >>$@
236        echo #endif >>$@
237        echo #ifndef C_INSTALL_CXX >>$@
238        echo # define C_INSTALL_CXX "$(CXX_COMPILER)" >>$@
239        echo #endif >>$@
240        echo #ifndef C_INSTALL_CFLAGS >>$@
241        echo # define C_INSTALL_CFLAGS "$(C_COMPILER_OPTIONS) $(C_COMPILER_OPTIMIZATION_OPTIONS)" >>$@
242        echo #endif >>$@
243        echo #ifndef C_INSTALL_LDFLAGS >>$@
244        echo # define C_INSTALL_LDFLAGS "$(LINKER_OPTIONS) $(LINKER_OPTIMIZATION_OPTIONS)" >>$@
245        echo #endif >>$@
246        echo #ifndef C_INSTALL_SHARE_HOME >>$@
247        echo # define C_INSTALL_SHARE_HOME "$(DATADIR)" >>$@
248        echo #endif >>$@
249        echo #ifndef C_INSTALL_BIN_HOME >>$@
250        echo # define C_INSTALL_BIN_HOME "$(BINDIR)" >>$@
251        echo #endif >>$@
252        echo #ifndef C_INSTALL_EGG_HOME >>$@
253        echo # define C_INSTALL_EGG_HOME "$(EGGDIR)" >>$@
254        echo #endif >>$@
255        echo #ifndef C_INSTALL_LIB_HOME >>$@
256        echo # define C_INSTALL_LIB_HOME "$(LIBDIR)" >>$@
257        echo #endif >>$@
258        echo #ifndef C_INSTALL_STATIC_LIB_HOME >>$@
259        echo # define C_INSTALL_STATIC_LIB_HOME "$(LIBDIR)" >>$@
260        echo #endif >>$@
261        echo #ifndef C_INSTALL_INCLUDE_HOME >>$@
262        echo # define C_INSTALL_INCLUDE_HOME "$(INCDIR)" >>$@
263        echo #endif >>$@
264        echo #ifndef C_INSTALL_MORE_LIBS >>$@
265        echo # define C_INSTALL_MORE_LIBS "$(LIBRARIES)" >>$@
266        echo #endif >>$@
267        echo #ifndef C_INSTALL_MORE_STATIC_LIBS >>$@
268        echo # define C_INSTALL_MORE_STATIC_LIBS "$(LIBRARIES)" >>$@
269        echo #endif >>$@
270        echo #ifndef C_DEFAULT_TARGET_STACK_SIZE >>$@
271        echo # define C_DEFAULT_TARGET_STACK_SIZE $(NURSERY) >>$@
272        echo #endif >>$@
273        echo #ifndef C_DEFAULT_TARGET_HEAP_SIZE >>$@
274        echo # define C_DEFAULT_TARGET_HEAP_SIZE 0 >>$@
275        echo #endif >>$@
276        echo #ifndef C_STACK_GROWS_DOWNWARD >>$@
277        echo # define C_STACK_GROWS_DOWNWARD $(STACKDIRECTION) >>$@
278        echo #endif >>$@
279        echo #ifndef C_TARGET_MORE_LIBS >>$@
280        echo # define C_TARGET_MORE_LIBS "$(TARGET_LIBRARIES)" >>$@
281        echo #endif >>$@
282        echo #ifndef C_TARGET_MORE_STATIC_LIBS >>$@
283        echo # define C_TARGET_MORE_STATIC_LIBS "$(TARGET_LIBRARIES)" >>$@
284        echo #endif >>$@
285        echo #ifndef C_TARGET_CC >>$@
286        echo # define C_TARGET_CC "$(TARGET_C_COMPILER)" >>$@
287        echo #endif >>$@
288        echo #ifndef C_TARGET_CXX >>$@
289        echo # define C_TARGET_CXX "$(TARGET_CXX_COMPILER)" >>$@
290        echo #endif >>$@
291        echo #ifndef C_TARGET_CFLAGS >>$@
292        echo # define C_TARGET_CFLAGS "$(TARGET_C_COMPILER_OPTIONS) $(TARGET_C_COMPILER_OPTIMIZATION_OPTIONS)" >>$@
293        echo #endif >>$@
294        echo #ifndef C_TARGET_LDFLAGS >>$@
295        echo # define C_TARGET_LDFLAGS "$(TARGET_LINKER_OPTIONS) $(TARGET_LINKER_OPTIMIZATION_OPTIONS)" >>$@
296        echo #endif >>$@
297        echo #ifndef C_CROSS_CHICKEN >>$@
298        echo # define C_CROSS_CHICKEN $(CROSS_CHICKEN) >>$@
299        echo #endif >>$@
300        echo #ifndef C_TARGET_BIN_HOME >>$@
301        echo # define C_TARGET_BIN_HOME "$(TARGET_PREFIX)/bin" >>$@
302        echo #endif >>$@
303        echo #ifndef C_TARGET_LIB_HOME >>$@
304        echo # define C_TARGET_LIB_HOME "$(TARGET_PREFIX)/lib" >>$@
305        echo #endif >>$@
306        echo #ifndef C_TARGET_RUN_LIB_HOME >>$@
307        echo # define C_TARGET_RUN_LIB_HOME "$(TARGET_PREFIX)/lib" >>$@
308        echo #endif >>$@
309        echo #ifndef C_TARGET_SHARE_HOME >>$@
310        echo # define C_TARGET_SHARE_HOME "$(TARGET_PREFIX)/share" >>$@
311        echo #endif >>$@
312        echo #ifndef C_TARGET_INCLUDE_HOME >>$@
313        echo # define C_TARGET_INCLUDE_HOME "$(TARGET_PREFIX)/include" >>$@
314        echo #endif >>$@
315        echo #ifndef C_TARGET_STATIC_LIB_HOME >>$@
316        echo # define C_TARGET_STATIC_LIB_HOME "$(TARGET_PREFIX)/lib" >>$@
317        echo #endif >>$@
318        echo #ifndef C_CSC_PROGRAM" >>$@
319        echo # define C_CSC_PROGRAM "$(CSC_PROGRAM)" >>$@
320        echo #endif" >>$@
321        echo #ifndef C_CSI_PROGRAM" >>$@
322        echo # define C_CSI_PROGRAM "$(CSI_PROGRAM)" >>$@
323        echo #endif" >>$@
324        echo #ifndef C_CHICKEN_BUG_PROGRAM" >>$@
325        echo # define C_CHICKEN_BUG_PROGRAM "$(CHICKEN_BUG_PROGRAM)" >>$@
326        echo #endif" >>$@
327        echo #ifndef C_BINARY_VERSION >>$@
328        echo # define C_BINARY_VERSION $(BINARYVERSION) >>$@
329        echo #endif >>$@
330
331include $(SRCDIR)rules.make
Note: See TracBrowser for help on using the repository browser.