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

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

merged from trunk rev. 7324

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