source: project/chicken/trunk/Makefile.msvc @ 9078

Last change on this file since 9078 was 9078, checked in by Ivan Raikov, 12 years ago

Included Ashley Bone's patch to the MSVC build system.

File size: 6.9 KB
Line 
1# Makefile.msvc - configuration for MSVC -*- Makefile -*-
2#
3# Copyright (c) 2007, Felix L. Winkelmann
4# All rights reserved.
5#
6# Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following
7# conditions are met:
8#
9#   Redistributions of source code must retain the above copyright notice, this list of conditions and the following
10#     disclaimer.
11#   Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following
12#     disclaimer in the documentation and/or other materials provided with the distribution.
13#   Neither the name of the author nor the names of its contributors may be used to endorse or promote
14#     products derived from this software without specific prior written permission.
15#
16# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
17# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
18# AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
19# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
21# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
23# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
24# POSSIBILITY OF SUCH DAMAGE.
25#
26# Send bugs, suggestions and ideas to:
27#
28# felix@call-with-current-continuation.org
29#
30# Felix L. Winkelmann
31# Unter den Gleichen 1
32# 37130 Gleichen
33# Germany
34
35PREFIX = c:/msvc-devtools
36
37# platform configuration
38
39DLLSINPATH = 1
40ARCH = x86
41HACKED_APPLY =
42WINDOWS = 1
43
44# file extensions
45
46O = .obj
47A = -static.lib
48SO = .dll
49EXE = .exe
50ASM = .c
51MANIFEST = .manifest
52
53# commands
54
55C_COMPILER = cl
56CXX_COMPILER = cl
57LINKER = link
58LIBRARIAN = lib
59
60# options
61
62C_COMPILER_OPTIONS = -nologo -MD -wd4142 -DHAVE_CHICKEN_CONFIG_H
63LINKER_OPTIONS = -nologo
64C_COMPILER_GUI_RUNTIME_OPTIONS = -DC_WINDOWS_GUI
65INCLUDES = -I.
66LIBRARIES = ws2_32.lib advapi32.lib
67
68# debug
69
70ifdef DEBUGBUILD
71C_COMPILER_OPTIONS = -nologo -MDd -DHAVE_CHICKEN_CONFIG_H
72C_COMPILER_OPTIMIZATION_OPTIONS = -Zi
73LINKER_OPTIONS += -debug
74endif
75
76# compiler-dependent output options used by rules
77
78C_COMPILER_COMPILE_OPTION = -c
79C_COMPILER_OUTPUT_OPTION = -Fo
80C_COMPILER_OUTPUT = $(C_COMPILER_OUTPUT_OPTION)$@
81
82C_COMPILER_BUILD_UNSAFE_RUNTIME_OPTIONS = $(C_COMPILER_BUILD_RUNTIME_OPTIONS) -DC_UNSAFE_RUNTIME
83C_COMPILER_SHARED_OPTIONS = -DPIC
84
85# linker-dependent output options
86
87LINKER_EXECUTABLE_OPTIONS = 
88LINKER_STATIC_OPTIONS = $(LINKER_EXECUTABLE_OPTIONS)
89LINKER_OUTPUT_OPTION = -out:
90LINKER_OUTPUT = $(LINKER_OUTPUT_OPTION)$@
91LINKER_LIBRARY_OPTION =
92LINKER_LIBRARY_PREFIX = lib
93LINKER_LIBRARY_SUFFIX = .lib
94LINKER_LINK_SHARED_LIBRARY_OPTIONS = -dll
95
96PROGRAM_IMPORT_LIBRARIES = chicken.lib csi.lib csc.lib chicken-setup.lib chicken-profile.lib chicken-bug.lib
97LIBCHICKEN_IMPORT_LIBRARY = libchicken.lib
98LIBUCHICKEN_IMPORT_LIBRARY = libuchicken.lib
99LIBCHICKENGUI_IMPORT_LIBRARY = libchickengui.lib
100MSVC_CHICKEN_IMPORT_LIBRARIES = $(PROGRAM_IMPORT_LIBRARIES) $(LIBCHICKEN_IMPORT_LIBRARY) \
101                                $(LIBUCHICKEN_IMPORT_LIBRARY) $(LIBCHICKENGUI_IMPORT_LIBRARY)
102MSVC_CHICKEN_EXPORT_FILES = $(MSVC_CHICKEN_IMPORT_LIBRARIES:.lib=.exp)
103LIBCHICKEN_SO_LINKER_OPTIONS = -implib:$(LIBCHICKEN_IMPORT_LIBRARY)
104LIBUCHICKEN_SO_LINKER_OPTIONS = -implib:$(LIBUCHICKEN_IMPORT_LIBRARY)
105LIBCHICKENGUI_SO_LINKER_OPTIONS = -implib:$(LIBCHICKENGUI_IMPORT_LIBRARY)
106
107# librarian-dependent output options
108
109LIBRARIAN_OPTIONS = -nologo
110LIBRARIAN_OUTPUT_OPTION = -out:
111LIBRARIAN_OUTPUT = $(LIBRARIAN_OUTPUT_OPTION)$@
112
113# assembler-dependent (here we are configured for compiling C w/ inline assembly)
114
115ASSEMBLER_OPTIONS = $(C_COMPILER_OPTIONS)
116ASSEMBLER_OUTPUT_OPTION = -Fo
117ASSEMBLER_OUTPUT = $(ASSEMBLER_OUTPUT_OPTION)$@
118ASSEMBLER_COMPILE_OPTION = -c
119
120# stuff for static-only builds
121ifdef STATICBUILD
122PRIMARY_LIBCHICKEN = libchicken$(A)
123else
124PRIMARY_LIBCHICKEN = libchicken$(SO)
125LIBCHICKEN_SO_FILE = libchicken$(SO)
126LIBUCHICKEN_SO_FILE = libuchicken$(SO)
127LIBCHICKENGUI_SO_FILE = libchickengui$(SO)
128endif
129
130# import libraries, needed in windows
131
132LIBCHICKEN_SO_LIBRARIES = $(LIBRARIES)
133LIBUCHICKEN_SO_LIBRARIES = $(LIBRARIES)
134LIBCHICKENGUI_SO_LIBRARIES = $(LIBRARIES) kernel32.lib user32.lib gdi32.lib
135
136# manifest files, yet more windows crap (VC2005+)
137
138INSTALL_MANIFEST_OPTIONS = -m755
139
140CHICKEN_MANIFEST = $(CHICKEN_PROGRAM)$(EXE)$(MANIFEST)
141CSI_MANIFEST = $(CSI_PROGRAM)$(EXE)$(MANIFEST)
142CHICKEN_PROFILE_MANIFEST = $(CHICKEN_PROFILE_PROGRAM)$(EXE)$(MANIFEST)
143CSC_MANIFEST = $(CSC_PROGRAM)$(EXE)$(MANIFEST)
144CHICKEN_BUG_MANIFEST = $(CHICKEN_BUG_PROGRAM)$(EXE)$(MANIFEST)
145CHICKEN_SETUP_MANIFEST = $(CHICKEN_SETUP_PROGRAM)$(EXE)$(MANIFEST)
146
147CLEAN_MANIFESTS = $(CHICKEN_MANIFEST) $(CSI_MANIFEST) $(CHICKEN_PROFILE_MANIFEST) \
148                  $(CSC_MANIFEST) $(CHICKEN_BUG_MANIFEST) $(CHICKEN_SETUP_MANIFEST) \
149                  $(LIBCHICKEN_SO_FILE)$(MANIFEST) $(LIBUCHICKEN_SO_FILE)$(MANIFEST) \
150                  $(LIBCHICKENGUI_SO_FILE)$(MANIFEST)
151
152# special files
153
154CHICKEN_CONFIG_H = chicken-config.h
155APPLY_HACK_SRC = 
156APPLY_HACK_OBJECT = 
157POSIXFILE = posixwin
158
159# default settings (the default chicken-defaults.h seems to be fine)
160
161include defaults.make
162
163# main target
164
165all: libchicken$(A) libuchicken$(A) chicken$(EXE) csi$(EXE) chicken-profile$(EXE) \
166        csc$(EXE) libchicken$(SO) \
167        libuchicken$(SO) libchickengui$(SO) libchickengui$(A) chicken-setup$(EXE) \
168        chicken.info
169
170chicken-config.h: chicken-defaults.h
171        echo "#define HAVE_DIRENT_H 0" >>$@
172        echo "#define HAVE_INTTYPES_H 0" >>$@
173        echo "#define HAVE_LIMITS_H 1" >>$@
174        echo "#define HAVE_LONG_LONG 1" >>$@
175        echo "#define HAVE_MEMMOVE 1" >>$@
176        echo "#define HAVE_MEMORY_H 1" >>$@
177        echo "#define HAVE_STDINT_H 0" >>$@
178        echo "#define HAVE_STDLIB_H 1" >>$@
179        echo "#define HAVE_STRERROR 1" >>$@
180        echo "#define HAVE_STRINGS_H 0" >>$@
181        echo "#define HAVE_STRING_H 1" >>$@
182        echo "#define HAVE_STRTOLL 0" >>$@
183        echo "#define HAVE_SYS_STAT_H 1" >>$@
184        echo "#define HAVE_SYS_TYPES_H 1" >>$@
185        echo "#define HAVE_UNISTD_H 0" >>$@
186        echo "#define HAVE_UNSIGNED_LONG_LONG 0" >>$@
187        echo "#define HAVE_WINDOWS_H 1" >>$@
188        echo "#define HAVE__STRTOI64 1" >>$@
189        echo "#define STDC_HEADERS 1" >>$@
190        echo "#define HAVE_ALLOCA_H 0" >>$@
191        echo "#define HAVE_DIRECT_H 1" >>$@
192        echo "#define HAVE_ERRNO_H 1" >>$@
193        echo "#define HAVE_GCVT 1" >>$@
194        echo "#define HAVE_LOADLIBRARY 1" >>$@
195        echo "#define HAVE_GETPROCADDRESS 1" >>$@
196        echo "#define HAVE_WINSOCK2_H 1" >>$@
197        echo "#define HAVE_WS2TCPIP_H 1" >>$@
198        echo "#define C_STACK_GROWS_DOWNWARD 1" >>$@
199ifdef GCHOOKS
200        echo "#define C_GC_HOOKS" >>$@
201endif
202ifdef SYMBOLGC
203        echo "#define C_COLLECT_ALL_SYMBOLS" >>$@
204endif
205ifdef NOAPPLYHOOK
206        echo "#define C_NO_APPLY_HOOK" >>$@
207endif
208        echo "#define C_HACKED_APPLY" >>$@
209        cat chicken-defaults.h >>$@
210
211include rules.make
Note: See TracBrowser for help on using the repository browser.