source: project/chicken/branches/scrutiny/Makefile.msvc @ 14827

Last change on this file since 14827 was 14827, checked in by felix winkelmann, 10 years ago

merged trunk changes until 14826 into scrutiny branch

File size: 11.6 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
187chicken-config.h.in:
188        echo #define HAVE_DIRENT_H 0 >>$@
189        echo #define HAVE_INTTYPES_H 0 >>$@
190        echo #define HAVE_LIMITS_H 1 >>$@
191        echo #define HAVE_LONG_LONG 1 >>$@
192        echo #define HAVE_MEMMOVE 1 >>$@
193        echo #define HAVE_MEMORY_H 1 >>$@
194        echo #define HAVE_STDINT_H 0 >>$@
195        echo #define HAVE_STDLIB_H 1 >>$@
196        echo #define HAVE_STRERROR 1 >>$@
197        echo #define HAVE_STRINGS_H 0 >>$@
198        echo #define HAVE_STRING_H 1 >>$@
199        echo #define HAVE_STRTOLL 0 >>$@
200        echo #define HAVE_SYS_STAT_H 1 >>$@
201        echo #define HAVE_SYS_TYPES_H 1 >>$@
202        echo #define HAVE_UNISTD_H 0 >>$@
203        echo #define HAVE_UNSIGNED_LONG_LONG 0 >>$@
204        echo #define HAVE_WINDOWS_H 1 >>$@
205        echo #define HAVE__STRTOI64 1 >>$@
206        echo #define STDC_HEADERS 1 >>$@
207        echo #define HAVE_ALLOCA_H 0 >>$@
208        echo #define HAVE_DIRECT_H 1 >>$@
209        echo #define HAVE_ERRNO_H 1 >>$@
210        echo #define HAVE_GCVT 1 >>$@
211        echo #define HAVE_LOADLIBRARY 1 >>$@
212        echo #define HAVE_GETPROCADDRESS 1 >>$@
213        echo #define HAVE_WINSOCK2_H 1 >>$@
214        echo #define HAVE_WS2TCPIP_H 1 >>$@
215        echo #define C_STACK_GROWS_DOWNWARD 1 >>$@
216ifdef GCHOOKS
217        echo #define C_GC_HOOKS >>$@
218endif
219ifdef SYMBOLGC
220        echo #define C_COLLECT_ALL_SYMBOLS >>$@
221endif
222ifdef NOAPPLYHOOK
223        echo #define C_NO_APPLY_HOOK >>$@
224endif
225        echo #define C_HACKED_APPLY >>$@
226
227chicken-config.h: chicken-config.h.in chicken-defaults.h
228        copy /Y /B chicken-config.h.in + chicken-defaults.h $@
229
230chicken-defaults.h:
231        echo /* generated */ >$@
232        echo #define C_BUILD_TAG "$(BUILD_TAG)" >>$@
233        echo #define C_CHICKEN_PROGRAM "$(CHICKEN_PROGRAM)$(EXE)" >>$@
234        echo #define C_WINDOWS_SHELL 1 >>$@
235        echo #ifndef C_INSTALL_CC >>$@
236        echo # define C_INSTALL_CC "$(C_COMPILER)" >>$@
237        echo #endif >>$@
238        echo #ifndef C_INSTALL_CXX >>$@
239        echo # define C_INSTALL_CXX "$(CXX_COMPILER)" >>$@
240        echo #endif >>$@
241        echo #ifndef C_INSTALL_CFLAGS >>$@
242        echo # define C_INSTALL_CFLAGS "$(C_COMPILER_OPTIONS) $(C_COMPILER_OPTIMIZATION_OPTIONS)" >>$@
243        echo #endif >>$@
244        echo #ifndef C_INSTALL_LDFLAGS >>$@
245        echo # define C_INSTALL_LDFLAGS "$(LINKER_OPTIONS) $(LINKER_OPTIMIZATION_OPTIONS)" >>$@
246        echo #endif >>$@
247        echo #ifndef C_INSTALL_SHARE_HOME >>$@
248        echo # define C_INSTALL_SHARE_HOME "$(DATADIR)" >>$@
249        echo #endif >>$@
250        echo #ifndef C_INSTALL_BIN_HOME >>$@
251        echo # define C_INSTALL_BIN_HOME "$(BINDIR)" >>$@
252        echo #endif >>$@
253        echo #ifndef C_INSTALL_EGG_HOME >>$@
254        echo # define C_INSTALL_EGG_HOME "$(EGGDIR)" >>$@
255        echo #endif >>$@
256        echo #ifndef C_INSTALL_LIB_HOME >>$@
257        echo # define C_INSTALL_LIB_HOME "$(LIBDIR)" >>$@
258        echo #endif >>$@
259        echo #ifndef C_INSTALL_STATIC_LIB_HOME >>$@
260        echo # define C_INSTALL_STATIC_LIB_HOME "$(LIBDIR)" >>$@
261        echo #endif >>$@
262        echo #ifndef C_INSTALL_INCLUDE_HOME >>$@
263        echo # define C_INSTALL_INCLUDE_HOME "$(INCDIR)" >>$@
264        echo #endif >>$@
265        echo #ifndef C_INSTALL_MORE_LIBS >>$@
266        echo # define C_INSTALL_MORE_LIBS "$(LIBRARIES)" >>$@
267        echo #endif >>$@
268        echo #ifndef C_INSTALL_MORE_STATIC_LIBS >>$@
269        echo # define C_INSTALL_MORE_STATIC_LIBS "$(LIBRARIES)" >>$@
270        echo #endif >>$@
271        echo #ifndef C_DEFAULT_TARGET_STACK_SIZE >>$@
272        echo # define C_DEFAULT_TARGET_STACK_SIZE $(NURSERY) >>$@
273        echo #endif >>$@
274        echo #ifndef C_DEFAULT_TARGET_HEAP_SIZE >>$@
275        echo # define C_DEFAULT_TARGET_HEAP_SIZE 0 >>$@
276        echo #endif >>$@
277        echo #ifndef C_STACK_GROWS_DOWNWARD >>$@
278        echo # define C_STACK_GROWS_DOWNWARD $(STACKDIRECTION) >>$@
279        echo #endif >>$@
280        echo #ifndef C_TARGET_MORE_LIBS >>$@
281        echo # define C_TARGET_MORE_LIBS "$(TARGET_LIBRARIES)" >>$@
282        echo #endif >>$@
283        echo #ifndef C_TARGET_MORE_STATIC_LIBS >>$@
284        echo # define C_TARGET_MORE_STATIC_LIBS "$(TARGET_LIBRARIES)" >>$@
285        echo #endif >>$@
286        echo #ifndef C_TARGET_CC >>$@
287        echo # define C_TARGET_CC "$(TARGET_C_COMPILER)" >>$@
288        echo #endif >>$@
289        echo #ifndef C_TARGET_CXX >>$@
290        echo # define C_TARGET_CXX "$(TARGET_CXX_COMPILER)" >>$@
291        echo #endif >>$@
292        echo #ifndef C_TARGET_CFLAGS >>$@
293        echo # define C_TARGET_CFLAGS "$(TARGET_C_COMPILER_OPTIONS) $(TARGET_C_COMPILER_OPTIMIZATION_OPTIONS)" >>$@
294        echo #endif >>$@
295        echo #ifndef C_TARGET_LDFLAGS >>$@
296        echo # define C_TARGET_LDFLAGS "$(TARGET_LINKER_OPTIONS) $(TARGET_LINKER_OPTIMIZATION_OPTIONS)" >>$@
297        echo #endif >>$@
298        echo #ifndef C_CROSS_CHICKEN >>$@
299        echo # define C_CROSS_CHICKEN $(CROSS_CHICKEN) >>$@
300        echo #endif >>$@
301        echo #ifndef C_TARGET_BIN_HOME >>$@
302        echo # define C_TARGET_BIN_HOME "$(TARGET_PREFIX)/bin" >>$@
303        echo #endif >>$@
304        echo #ifndef C_TARGET_LIB_HOME >>$@
305        echo # define C_TARGET_LIB_HOME "$(TARGET_PREFIX)/lib" >>$@
306        echo #endif >>$@
307        echo #ifndef C_TARGET_RUN_LIB_HOME >>$@
308        echo # define C_TARGET_RUN_LIB_HOME "$(TARGET_PREFIX)/lib" >>$@
309        echo #endif >>$@
310        echo #ifndef C_TARGET_SHARE_HOME >>$@
311        echo # define C_TARGET_SHARE_HOME "$(TARGET_PREFIX)/share" >>$@
312        echo #endif >>$@
313        echo #ifndef C_TARGET_INCLUDE_HOME >>$@
314        echo # define C_TARGET_INCLUDE_HOME "$(TARGET_PREFIX)/include" >>$@
315        echo #endif >>$@
316        echo #ifndef C_TARGET_STATIC_LIB_HOME >>$@
317        echo # define C_TARGET_STATIC_LIB_HOME "$(TARGET_PREFIX)/lib" >>$@
318        echo #endif >>$@
319        echo #ifndef C_CSC_PROGRAM" >>$@
320        echo # define C_CSC_PROGRAM "$(CSC_PROGRAM)" >>$@
321        echo #endif" >>$@
322        echo #ifndef C_CSI_PROGRAM" >>$@
323        echo # define C_CSI_PROGRAM "$(CSI_PROGRAM)" >>$@
324        echo #endif" >>$@
325        echo #ifndef C_CHICKEN_BUG_PROGRAM" >>$@
326        echo # define C_CHICKEN_BUG_PROGRAM "$(CHICKEN_BUG_PROGRAM)" >>$@
327        echo #endif" >>$@
328        echo #ifndef C_BINARY_VERSION >>$@
329        echo # define C_BINARY_VERSION $(BINARYVERSION) >>$@
330        echo #endif >>$@
331
332include $(SRCDIR)rules.make
Note: See TracBrowser for help on using the repository browser.