source: project/chicken/branches/release/defaults.make @ 6577

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

merged changes from trunk (rev 6579)

File size: 10.6 KB
Line 
1# defaults.make - default settings -*- 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
35
36# basic parameters
37
38BINARYVERSION ?= 3
39NURSERY ?= (128*1024)
40STACKDIRECTION ?= 1
41
42# directories
43
44ifeq ($(PLATFORM),mingw)
45PREFIX ?= c:/devtools
46else
47PREFIX ?= /usr/local
48endif
49DESTDIR = $(PREFIX)
50BINDIR = $(DESTDIR)/bin
51LIBDIR = $(DESTDIR)/lib
52SHAREDIR = $(DESTDIR)/share
53DATADIR = $(SHAREDIR)/chicken
54MANDIR = $(SHAREDIR)/man/man1
55INFODIR = $(SHAREDIR)/info
56INCDIR = $(DESTDIR)/include
57DOCDIR = $(DATADIR)/doc
58EGGDIR = $(DESTDIR)/lib/chicken/$(BINARYVERSION)
59
60# commands
61
62ifdef HOST
63C_COMPILER ?= $(HOST)-gcc
64CXX_COMPILER ?= $(HOST)-g++
65LIBRARIAN ?= $(HOST)-ar
66else
67C_COMPILER ?= gcc
68CXX_COMPILER ?= g++
69LIBRARIAN ?= ar
70endif
71LINKER ?= $(C_COMPILER)
72ifeq ($(PLATFORM),mingw)
73REMOVE_COMMAND ?= del
74else
75REMOVE_COMMAND ?= rm
76endif
77ASSEMBLER ?= $(C_COMPILER)
78MAKEINFO_PROGRAM ?= -makeinfo
79MAKEDIR_COMMAND ?= mkdir
80INSTALL_PROGRAM ?= install
81POSTINSTALL_STATIC_LIBRARY ?= true
82POSTINSTALL_PROGRAM ?= true
83INSTALLINFO_PROGRAM ?= -install-info
84UNINSTALLINFO_PROGRAM ?= -install-info
85
86# target variables
87
88ifdef TARGET
89TARGET_C_COMPILER ?= $(TARGET)-$(C_COMPILER)
90TARGET_CXX_COMPILER ?= $(TARGET)-$(CXX_COMPILER)
91else
92TARGET_C_COMPILER ?= $(C_COMPILER)
93TARGET_CXX_COMPILER ?= $(CXX_COMPILER)
94endif
95
96TARGET_C_COMPILER_OPTIONS ?= $(C_COMPILER_OPTIONS)
97TARGET_C_COMPILER_OPTIMIZATION_OPTIONS ?= $(C_COMPILER_OPTIMIZATION_OPTIONS)
98TARGET_PREFIX ?= $(PREFIX)
99TARGET_LIBRARIES ?= $(LIBRARIES)
100
101ifneq ($(TARGET_C_COMPILER),$(HOST_C_COMPILER))
102CROSS_CHICKEN = 1
103else
104CROSS_CHICKEN = 0
105endif
106
107
108# options
109
110ifndef NOPTABLES
111C_COMPILER_PTABLES_OPTIONS = -DC_ENABLE_PTABLES
112endif
113INCLUDES ?= -I.
114PCRE_INCLUDES ?= $(INCLUDES) -Ipcre
115C_COMPILER_COMPILE_OPTION ?= -c
116C_COMPILER_OUTPUT_OPTION ?= -o
117ifdef DEBUGBUILD
118C_COMPILER_OPTIMIZATION_OPTIONS ?= -g -Wall -Wno-unused
119endif
120C_COMPILER_BUILD_RUNTIME_OPTIONS ?= -DC_BUILDING_LIBCHICKEN
121C_COMPILER_BUILD_UNSAFE_RUNTIME_OPTIONS ?= $(C_COMPILER_BUILD_RUNTIME_OPTIONS) -DNDEBUG -DC_UNSAFE_RUNTIME
122C_COMPILER_PCRE_OPTIONS ?= -DPCRE_STATIC
123C_COMPILER_SHARED_OPTIONS ?= -fPIC -DPIC
124LINKER_OPTIONS ?= -L.
125LINKER_STATIC_OPTIONS ?= $(LINKERFLAGS)
126LINKER_OUTPUT_OPTION ?= -o
127LINKER_LIBRARY_OPTION ?= -l
128LINKER_LINK_SHARED_LIBRARY_OPTIONS ?= -shared
129LIBRARIAN_OPTIONS ?= cru
130LIBRARIES ?= -lm
131ifeq ($(PLATFORM),mingw)
132REMOVE_COMMAND_OPTIONS ?= /f /q
133REMOVE_COMMAND_RECURSIVE_OPTIONS ?= /f /s /q
134else
135REMOVE_COMMAND_OPTIONS ?= -f
136REMOVE_COMMAND_RECURSIVE_OPTIONS ?= -fr
137endif
138MAKEINFO_PROGRAM_OPTIONS ?= --no-split
139INSTALL_PROGRAM_SHARED_LIBRARY_OPTIONS ?= -m755
140INSTALL_PROGRAM_STATIC_LIBRARY_OPTIONS ?= -m644
141INSTALL_PROGRAM_EXECUTABLE_OPTIONS ?= -m755
142INSTALL_PROGRAM_FILE_OPTIONS ?= -m644
143MAKEDIR_COMMAND_OPTIONS ?= -p
144ASSEMBLER_OPTIONS ?= $(C_COMPILER_OPTIONS)
145ASSEMBLER_OUTPUT_OPTION ?= -o
146ASSEMBLER_COMPILE_OPTION ?= -c
147PRIMARY_LIBCHICKEN ?= libchicken$(SO)
148UNINSTALLINFO_PROGRAM_OPTIONS ?= --delete
149LIBCHICKEN_SO_LIBRARIES ?= $(LIBRARIES)
150LIBUCHICKEN_SO_LIBRARIES ?= $(LIBRARIES)
151LIBCHICKENGUI_SO_LIBRARIES ?= $(LIBRARIES)
152
153# other settings
154
155HOSTNAME ?= $(shell hostname)
156ifeq ($(PLATFORM),mingw)
157BUILD_TIME ?= $(shell date /t)
158UNAME_SYS ?= MinGW
159else
160BUILD_TIME ?= $(shell date +%Y-%m-%d)
161UNAME_SYS ?= $(shell uname)
162endif
163BUILD_TAG ?= compiled $(BUILD_TIME) on $(HOSTNAME) ($(UNAME_SYS))
164
165# file extensions
166
167O ?= .o
168A ?= .a
169# EXE =
170SO ?= .so
171
172# special files
173
174POSIXFILE ?= posixunix
175CHICKEN_CONFIG_H = chicken-config.h
176PCRE_OBJECT_FILES ?= pcre/*.o
177
178ifneq ($(ARCH),)
179HACKED_APPLY = 1
180APPLY_HACK_OBJECT = apply-hack.$(ARCH)$(O)
181endif
182
183# bootstrapping compiler
184
185CHICKEN = $(PREFIX)/bin/chicken$(EXE)
186
187# Scheme compiler flags
188
189CHICKEN_OPTIONS = -quiet -no-trace -optimize-level 2 -include-path .
190CHICKEN_LIBRARY_OPTIONS = $(CHICKEN_OPTIONS) -explicit-use
191CHICKEN_PROGRAM_OPTIONS = $(CHICKEN_OPTIONS) -no-lambda-info
192CHICKEN_UNSAFE_OPTIONS = -unsafe -no-lambda-info
193
194# targets
195
196CHICKEN_PROGRAM = $(PROGRAM_PREFIX)chicken$(PROGRAM_SUFFIX)
197CSC_PROGRAM = $(PROGRAM_PREFIX)csc$(PROGRAM_SUFFIX)
198CSI_PROGRAM = $(PROGRAM_PREFIX)csi$(PROGRAM_SUFFIX)
199CHICKEN_PROFILE_PROGRAM = $(PROGRAM_PREFIX)chicken-profile$(PROGRAM_SUFFIX)
200CHICKEN_SETUP_PROGRAM = $(PROGRAM_PREFIX)chicken-setup$(PROGRAM_SUFFIX)
201CHICKEN_BUG_PROGRAM = $(PROGRAM_PREFIX)chicken-bug$(PROGRAM_SUFFIX)
202
203ifdef STATICBUILD
204CHICKEN_STATIC_EXECUTABLE = $(CHICKEN_PROGRAM)$(EXE)
205CSI_STATIC_EXECUTABLE = $(CSI_PROGRAM)$(EXE)
206CHICKEN_SHARED_EXECUTABLE = $(CHICKEN_PROGRAM)-shared$(EXE)
207CSI_SHARED_EXECUTABLE = $(CSI_PROGRAM)-shared$(EXE)
208TARGETS ?= libchicken$(A) libuchicken$(A) $(CHICKEN_STATIC_EXECUTABLE) \
209        $(CSI_STATIC_EXECUTABLE) $(CHICKEN_PROFILE_PROGRAM)$(EXE) \
210        $(CSC_PROGRAM)$(EXE) \
211        chicken.info $(CHICKEN_BUG_PROGRAM)$(EXE)
212else
213CHICKEN_STATIC_EXECUTABLE = $(CHICKEN_PROGRAM)-static$(EXE)
214CSI_STATIC_EXECUTABLE = $(CSI_PROGRAM)-static$(EXE)
215CHICKEN_SHARED_EXECUTABLE = $(CHICKEN_PROGRAM)$(EXE)
216CSI_SHARED_EXECUTABLE = $(CSI_PROGRAM)$(EXE)
217TARGETS ?= libchicken$(A) libuchicken$(A) $(CHICKEN_SHARED_EXECUTABLE) \
218        $(CSI_SHARED_EXECUTABLE) $(CHICKEN_PROFILE_PROGRAM)$(EXE) \
219        $(CSC_PROGRAM)$(EXE) libchicken$(SO) \
220        libuchicken$(SO) $(CHICKEN_SETUP_PROGRAM)$(EXE) chicken.info \
221        $(CHICKEN_BUG_PROGRAM)$(EXE)
222endif
223
224# main rule
225
226.PHONY: all
227
228all: $(TARGETS)
229
230# generic part of chicken-config.h
231
232ifndef CUSTOM_CHICKEN_DEFAULTS
233chicken-defaults.h:
234        echo "/* generated */" >$@
235        echo "#define C_BUILD_TAG \"$(BUILD_TAG)\"" >>$@
236        echo "#ifndef C_INSTALL_CC" >>$@
237        echo "# define C_INSTALL_CC \"$(C_COMPILER)\"" >>$@
238        echo "#endif" >>$@
239        echo "#ifndef C_INSTALL_CXX" >>$@
240        echo "# define C_INSTALL_CXX \"$(CXX_COMPILER)\"" >>$@
241        echo "#endif" >>$@
242        echo "#ifndef C_INSTALL_CFLAGS" >>$@
243        echo "# define C_INSTALL_CFLAGS \"$(C_COMPILER_OPTIONS) $(C_COMPILER_OPTIMIZATION_OPTIONS)\"" >>$@
244        echo "#endif" >>$@
245        echo "#ifndef C_INSTALL_SHARE_HOME" >>$@
246        echo "# define C_INSTALL_SHARE_HOME \"$(DATADIR)\"" >>$@
247        echo "#endif" >>$@
248        echo "#ifndef C_INSTALL_BIN_HOME" >>$@
249        echo "# define C_INSTALL_BIN_HOME \"$(BINDIR)\"" >>$@
250        echo "#endif" >>$@
251        echo "#ifndef C_INSTALL_EGG_HOME" >>$@
252        echo "# define C_INSTALL_EGG_HOME \"$(EGGDIR)\"" >>$@
253        echo "#endif" >>$@
254        echo "#ifndef C_INSTALL_LIB_HOME" >>$@
255        echo "# define C_INSTALL_LIB_HOME \"$(LIBDIR)\"" >>$@
256        echo "#endif" >>$@
257        echo "#ifndef C_INSTALL_STATIC_LIB_HOME" >>$@
258        echo "# define C_INSTALL_STATIC_LIB_HOME \"$(LIBDIR)\"" >>$@
259        echo "#endif" >>$@
260        echo "#ifndef C_INSTALL_INCLUDE_HOME" >>$@
261        echo "# define C_INSTALL_INCLUDE_HOME \"$(INCDIR)\"" >>$@
262        echo "#endif" >>$@
263        echo "#ifndef C_INSTALL_MORE_LIBS" >>$@
264        echo "# define C_INSTALL_MORE_LIBS \"$(LIBRARIES)\"" >>$@
265        echo "#endif" >>$@
266        echo "#ifndef C_INSTALL_MORE_STATIC_LIBS" >>$@
267        echo "# define C_INSTALL_MORE_STATIC_LIBS \"$(LIBRARIES)\"" >>$@
268        echo "#endif" >>$@
269        echo "#ifndef C_DEFAULT_TARGET_STACK_SIZE" >>$@
270        echo "# define C_DEFAULT_TARGET_STACK_SIZE $(NURSERY)" >>$@
271        echo "#endif" >>$@
272        echo "#ifndef C_STACK_GROWS_DOWNWARD" >>$@
273        echo "# define C_STACK_GROWS_DOWNWARD $(STACKDIRECTION)" >>$@
274        echo "#endif" >>$@
275        echo "#ifndef C_TARGET_MORE_LIBS" >>$@
276        echo "# define C_TARGET_MORE_LIBS \"$(TARGET_LIBRARIES)\"" >>$@
277        echo "#endif" >>$@
278        echo "#ifndef C_TARGET_MORE_STATIC_LIBS" >>$@
279        echo "# define C_TARGET_MORE_STATIC_LIBS \"$(TARGET_LIBRARIES)\"" >>$@
280        echo "#endif" >>$@
281        echo "#ifndef C_TARGET_CC" >>$@
282        echo "# define C_TARGET_CC \"$(TARGET_C_COMPILER)\"" >>$@
283        echo "#endif" >>$@
284        echo "#ifndef C_TARGET_CXX" >>$@
285        echo "# define C_TARGET_CXX \"$(TARGET_CXX_COMPILER)\"" >>$@
286        echo "#endif" >>$@
287        echo "#ifndef C_TARGET_CFLAGS" >>$@
288        echo "# define C_TARGET_CFLAGS \"$(TARGET_C_COMPILER_OPTIONS) $(TARGET_C_COMPILER_OPTIMIZATION_OPTIONS)\"" >>$@
289        echo "#endif" >>$@
290        echo "#ifndef C_CROSS_CHICKEN" >>$@
291        echo "# define C_CROSS_CHICKEN $(CROSS_CHICKEN)" >>$@
292        echo "#endif" >>$@
293        echo "#ifndef C_TARGET_LIB_HOME" >>$@
294        echo "# define C_TARGET_LIB_HOME \"$(TARGET_PREFIX)/lib\"" >>$@
295        echo "#endif" >>$@
296        echo "#ifndef C_TARGET_RUN_LIB_HOME" >>$@
297        echo "# define C_TARGET_RUN_LIB_HOME \"$(TARGET_PREFIX)/lib\"" >>$@
298        echo "#endif" >>$@
299        echo "#ifndef C_TARGET_SHARE_HOME" >>$@
300        echo "# define C_TARGET_SHARE_HOME \"$(TARGET_PREFIX)/share\"" >>$@
301        echo "#endif" >>$@
302        echo "#ifndef C_TARGET_INCLUDE_HOME" >>$@
303        echo "# define C_TARGET_INCLUDE_HOME \"$(TARGET_PREFIX)/include\"" >>$@
304        echo "#endif" >>$@
305        echo "#ifndef C_TARGET_STATIC_LIB_HOME" >>$@
306        echo "# define C_TARGET_STATIC_LIB_HOME \"$(TARGET_PREFIX)/lib\"" >>$@
307        echo "#endif" >>$@
308        echo "#ifndef C_CHICKEN_PROGRAM" >>$@
309        echo "# define C_CHICKEN_PROGRAM \"$(CHICKEN_PROGRAM)\"" >>$@
310        echo "#endif" >>$@
311        echo "#ifndef C_CSC_PROGRAM" >>$@
312        echo "# define C_CSC_PROGRAM \"$(CSC_PROGRAM)\"" >>$@
313        echo "#endif" >>$@
314        echo "#ifndef C_CSI_PROGRAM" >>$@
315        echo "# define C_CSI_PROGRAM \"$(CSI_PROGRAM)\"" >>$@
316        echo "#endif" >>$@
317        echo "#ifndef C_CHICKEN_PROFILE_PROGRAM" >>$@
318        echo "# define C_CHICKEN_PROFILE_PROGRAM \"$(CHICKEN_PROFILE_PROGRAM)\"" >>$@
319        echo "#endif" >>$@
320        echo "#ifndef C_CHICKEN_SETUP_PROGRAM" >>$@
321        echo "# define C_CHICKEN_SETUP_PROGRAM \"$(CHICKEN_SETUP_PROGRAM)\"" >>$@
322        echo "#endif" >>$@
323        echo "#ifndef C_CHICKEN_BUG_PROGRAM" >>$@
324        echo "# define C_CHICKEN_BUG_PROGRAM \"$(CHICKEN_BUG_PROGRAM)\"" >>$@
325        echo "#endif" >>$@
326endif
Note: See TracBrowser for help on using the repository browser.