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

Last change on this file since 12819 was 12819, checked in by felix winkelmann, 12 years ago

build bugfixes (thanks to Wietse Jacobs); added -repository option to setup tools

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