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

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

variable holding linker options was named incorrectly (problem reported by Peter Bex)

File size: 7.5 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
36SRCDIR = .\\
37
38# platform configuration
39
40DLLSINPATH = 1
41ARCH = x86
42HACKED_APPLY =
43WINDOWS = 1
44
45# file extensions
46
47O = .obj
48A = -static.lib
49SO = .dll
50EXE = .exe
51ASM = .c
52MANIFEST = .manifest
53
54# commands
55
56C_COMPILER = cl
57CXX_COMPILER = cl
58LINKER = link
59LIBRARIAN = lib
60
61# options
62
63C_COMPILER_OPTIONS = -nologo -MD -wd4142 -DHAVE_CHICKEN_CONFIG_H
64LINKER_OPTIONS = -nologo
65C_COMPILER_GUI_RUNTIME_OPTIONS = -DC_WINDOWS_GUI
66INCLUDES = -I.
67LIBRARIES = ws2_32.lib advapi32.lib
68
69# debug
70
71ifdef DEBUGBUILD
72C_COMPILER_OPTIONS = -nologo -MDd -DHAVE_CHICKEN_CONFIG_H
73C_COMPILER_OPTIMIZATION_OPTIONS = -Zi
74LINKER_OPTIONS += -debug
75endif
76
77# compiler-dependent output options used by rules
78
79C_COMPILER_COMPILE_OPTION = -c
80C_COMPILER_OUTPUT_OPTION = -Fo
81C_COMPILER_OUTPUT = $(C_COMPILER_OUTPUT_OPTION)$@
82
83C_COMPILER_BUILD_UNSAFE_RUNTIME_OPTIONS = $(C_COMPILER_BUILD_RUNTIME_OPTIONS) -DC_UNSAFE_RUNTIME
84C_COMPILER_SHARED_OPTIONS = -DPIC
85
86# linker-dependent output options
87
88LINKER_EXECUTABLE_OPTIONS = 
89LINKER_STATIC_OPTIONS = $(LINKER_EXECUTABLE_OPTIONS)
90LINKER_OUTPUT_OPTION = -out:
91LINKER_OUTPUT = $(LINKER_OUTPUT_OPTION)$@
92LINKER_LIBRARY_OPTION =
93LINKER_LIBRARY_PREFIX = lib
94LINKER_LIBRARY_SUFFIX = .lib
95LINKER_LINK_SHARED_LIBRARY_OPTIONS = -dll
96LINKER_LINK_SHARED_DLOADABLE_OPTIONS = -dll
97
98PROGRAM_IMPORT_LIBRARIES = chicken.lib csi.lib csc.lib chicken-setup.lib chicken-profile.lib chicken-bug.lib
99LIBCHICKEN_IMPORT_LIBRARY = libchicken.lib
100LIBUCHICKEN_IMPORT_LIBRARY = libuchicken.lib
101LIBCHICKENGUI_IMPORT_LIBRARY = libchickengui.lib
102MSVC_CHICKEN_IMPORT_LIBRARIES = $(PROGRAM_IMPORT_LIBRARIES) $(LIBCHICKEN_IMPORT_LIBRARY) \
103                                $(LIBUCHICKEN_IMPORT_LIBRARY) $(LIBCHICKENGUI_IMPORT_LIBRARY)
104MSVC_CHICKEN_EXPORT_FILES = $(MSVC_CHICKEN_IMPORT_LIBRARIES:.lib=.exp)
105LIBCHICKEN_SO_LINKER_OPTIONS = -implib:$(LIBCHICKEN_IMPORT_LIBRARY)
106LIBUCHICKEN_SO_LINKER_OPTIONS = -implib:$(LIBUCHICKEN_IMPORT_LIBRARY)
107LIBCHICKENGUI_SO_LINKER_OPTIONS = -implib:$(LIBCHICKENGUI_IMPORT_LIBRARY)
108
109# librarian-dependent output options
110
111LIBRARIAN_OPTIONS = -nologo
112LIBRARIAN_OUTPUT_OPTION = -out:
113LIBRARIAN_OUTPUT = $(LIBRARIAN_OUTPUT_OPTION)$@
114
115# assembler-dependent (here we are configured for compiling C w/ inline assembly)
116
117ASSEMBLER_OPTIONS = $(C_COMPILER_OPTIONS)
118ASSEMBLER_OUTPUT_OPTION = -Fo
119ASSEMBLER_OUTPUT = $(ASSEMBLER_OUTPUT_OPTION)$@
120ASSEMBLER_COMPILE_OPTION = -c
121
122# stuff for static-only builds
123ifdef STATICBUILD
124PRIMARY_LIBCHICKEN = libchicken$(A)
125else
126PRIMARY_LIBCHICKEN = libchicken$(SO)
127LIBCHICKEN_SO_FILE = libchicken$(SO)
128LIBUCHICKEN_SO_FILE = libuchicken$(SO)
129LIBCHICKENGUI_SO_FILE = libchickengui$(SO)
130endif
131
132# import libraries, needed in windows
133
134LIBCHICKEN_SO_LIBRARIES = $(LIBRARIES)
135LIBUCHICKEN_SO_LIBRARIES = $(LIBRARIES)
136LIBCHICKENGUI_SO_LIBRARIES = $(LIBRARIES) kernel32.lib user32.lib gdi32.lib
137
138# manifest files, yet more windows crap (VC2005+)
139
140INSTALL_MANIFEST_OPTIONS = -m755
141
142CHICKEN_MANIFEST = $(CHICKEN_PROGRAM)$(EXE)$(MANIFEST)
143CSI_MANIFEST = $(CSI_PROGRAM)$(EXE)$(MANIFEST)
144CHICKEN_PROFILE_MANIFEST = $(CHICKEN_PROFILE_PROGRAM)$(EXE)$(MANIFEST)
145CSC_MANIFEST = $(CSC_PROGRAM)$(EXE)$(MANIFEST)
146CHICKEN_BUG_MANIFEST = $(CHICKEN_BUG_PROGRAM)$(EXE)$(MANIFEST)
147ifndef BUILD_SETUP_TOOLS
148CHICKEN_SETUP_MANIFEST = $(CHICKEN_SETUP_PROGRAM)$(EXE)$(MANIFEST)
149CLEAN_MANIFESTS = $(CHICKEN_MANIFEST) $(CSI_MANIFEST) $(CHICKEN_PROFILE_MANIFEST) \
150                  $(CSC_MANIFEST) $(CHICKEN_BUG_MANIFEST) $(CHICKEN_SETUP_MANIFEST) \
151                  $(LIBCHICKEN_SO_FILE)$(MANIFEST) $(LIBUCHICKEN_SO_FILE)$(MANIFEST) \
152                  $(LIBCHICKENGUI_SO_FILE)$(MANIFEST)
153else
154CHICKEN_INSTALL_MANIFEST = $(CHICKEN_INSTALL_PROGRAM)$(EXE)$(MANIFEST)
155CHICKEN_UNINSTALL_MANIFEST = $(CHICKEN_UNINSTALL_PROGRAM)$(EXE)$(MANIFEST)
156CHICKEN_STATUS_MANIFEST = $(CHICKEN_STATUS_PROGRAM)$(EXE)$(MANIFEST)
157CLEAN_MANIFESTS = $(CHICKEN_MANIFEST) $(CSI_MANIFEST) $(CHICKEN_PROFILE_MANIFEST) \
158                  $(CSC_MANIFEST) $(CHICKEN_BUG_MANIFEST) $(CHICKEN_INSTALL_MANIFEST) \
159                  $(CHICKEN_UNINSTALL_MANIFEST) $(CHICKEN_STATUS_MANIFEST) \
160                  $(LIBCHICKEN_SO_FILE)$(MANIFEST) $(LIBUCHICKEN_SO_FILE)$(MANIFEST) \
161                  $(LIBCHICKENGUI_SO_FILE)$(MANIFEST)
162endif
163
164# special files
165
166CHICKEN_CONFIG_H = chicken-config.h
167APPLY_HACK_SRC = 
168APPLY_HACK_OBJECT = 
169POSIXFILE = posixwin
170
171# default settings (the default chicken-defaults.h seems to be fine)
172
173include defaults.make
174
175# main target
176
177all: libchicken$(A) libuchicken$(A) chicken$(EXE) csi$(EXE) chicken-profile$(EXE) \
178        csc$(EXE) libchicken$(SO) \
179        libuchicken$(SO) libchickengui$(SO) libchickengui$(A) chicken-setup$(EXE) \
180        chicken.info
181
182chicken-config.h: chicken-defaults.h
183        echo "#define HAVE_DIRENT_H 0" >>$@
184        echo "#define HAVE_INTTYPES_H 0" >>$@
185        echo "#define HAVE_LIMITS_H 1" >>$@
186        echo "#define HAVE_LONG_LONG 1" >>$@
187        echo "#define HAVE_MEMMOVE 1" >>$@
188        echo "#define HAVE_MEMORY_H 1" >>$@
189        echo "#define HAVE_STDINT_H 0" >>$@
190        echo "#define HAVE_STDLIB_H 1" >>$@
191        echo "#define HAVE_STRERROR 1" >>$@
192        echo "#define HAVE_STRINGS_H 0" >>$@
193        echo "#define HAVE_STRING_H 1" >>$@
194        echo "#define HAVE_STRTOLL 0" >>$@
195        echo "#define HAVE_SYS_STAT_H 1" >>$@
196        echo "#define HAVE_SYS_TYPES_H 1" >>$@
197        echo "#define HAVE_UNISTD_H 0" >>$@
198        echo "#define HAVE_UNSIGNED_LONG_LONG 0" >>$@
199        echo "#define HAVE_WINDOWS_H 1" >>$@
200        echo "#define HAVE__STRTOI64 1" >>$@
201        echo "#define STDC_HEADERS 1" >>$@
202        echo "#define HAVE_ALLOCA_H 0" >>$@
203        echo "#define HAVE_DIRECT_H 1" >>$@
204        echo "#define HAVE_ERRNO_H 1" >>$@
205        echo "#define HAVE_GCVT 1" >>$@
206        echo "#define HAVE_LOADLIBRARY 1" >>$@
207        echo "#define HAVE_GETPROCADDRESS 1" >>$@
208        echo "#define HAVE_WINSOCK2_H 1" >>$@
209        echo "#define HAVE_WS2TCPIP_H 1" >>$@
210        echo "#define C_STACK_GROWS_DOWNWARD 1" >>$@
211ifdef GCHOOKS
212        echo "#define C_GC_HOOKS" >>$@
213endif
214ifdef SYMBOLGC
215        echo "#define C_COLLECT_ALL_SYMBOLS" >>$@
216endif
217ifdef NOAPPLYHOOK
218        echo "#define C_NO_APPLY_HOOK" >>$@
219endif
220        echo "#define C_HACKED_APPLY" >>$@
221        cat chicken-defaults.h >>$@
222
223include rules.make
Note: See TracBrowser for help on using the repository browser.