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

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

merged trunk

File size: 12.4 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
147ifndef NOPTABLES
148C_COMPILER_PTABLES_OPTIONS = -DC_ENABLE_PTABLES
149endif
150INCLUDES ?= -I.
151PCRE_INCLUDES ?= $(INCLUDES) -Ipcre
152C_COMPILER_COMPILE_OPTION ?= -c
153C_COMPILER_OUTPUT_OPTION ?= -o
154ifdef DEBUGBUILD
155C_COMPILER_OPTIMIZATION_OPTIONS ?= -g -Wall -Wno-unused
156endif
157C_COMPILER_BUILD_RUNTIME_OPTIONS ?= -DC_BUILDING_LIBCHICKEN
158C_COMPILER_BUILD_UNSAFE_RUNTIME_OPTIONS ?= $(C_COMPILER_BUILD_RUNTIME_OPTIONS) -DNDEBUG -DC_UNSAFE_RUNTIME
159C_COMPILER_PCRE_OPTIONS ?= -DPCRE_STATIC
160C_COMPILER_SHARED_OPTIONS ?= -fPIC -DPIC
161LINKER_EXECUTABLE_OPTIONS ?= -L.
162LINKER_STATIC_OPTIONS ?= $(LINKER_EXECUTABLE_OPTIONS)
163LINKER_OUTPUT_OPTION ?= -o
164LINKER_LIBRARY_OPTION ?= -l
165LINKER_LINK_SHARED_LIBRARY_OPTIONS ?= -shared
166LIBRARIAN_OPTIONS ?= cru
167LIBRARIES ?= -lm
168ifeq ($(PLATFORM),mingw)
169REMOVE_COMMAND_OPTIONS ?= /f /q
170REMOVE_COMMAND_RECURSIVE_OPTIONS ?= /f /s /q
171MAKE_WRITABLE_COMMAND ?= rem
172else
173REMOVE_COMMAND_OPTIONS ?= -f
174REMOVE_COMMAND_RECURSIVE_OPTIONS ?= -fr
175MAKE_WRITABLE_COMMAND ?= chmod a+rw
176endif
177MAKEINFO_PROGRAM_OPTIONS ?= --no-split
178ifneq ($(PLATFORM),mingw)
179INSTALL_PROGRAM_SHARED_LIBRARY_OPTIONS ?= -m755
180INSTALL_PROGRAM_STATIC_LIBRARY_OPTIONS ?= -m644
181INSTALL_PROGRAM_EXECUTABLE_OPTIONS ?= -m755
182INSTALL_PROGRAM_FILE_OPTIONS ?= -m644
183MAKEDIR_COMMAND_OPTIONS ?= -p
184endif
185ASSEMBLER_OPTIONS ?= $(C_COMPILER_OPTIONS)
186ASSEMBLER_OUTPUT_OPTION ?= -o
187ASSEMBLER_COMPILE_OPTION ?= -c
188ifdef STATICBUILD
189PRIMARY_LIBCHICKEN ?= libchicken$(A)
190else
191ifeq ($(PLATFORM),cygwin)
192PRIMARY_LIBCHICKEN = cygchicken-0.dll
193LIBCHICKEN_SO_FILE = cygchicken-0.dll
194LIBUCHICKEN_SO_FILE = cyguchicken-0.dll
195else
196PRIMARY_LIBCHICKEN ?= libchicken$(SO)
197LIBCHICKEN_SO_FILE ?= libchicken$(SO)
198LIBUCHICKEN_SO_FILE ?= libuchicken$(SO)
199endif
200endif
201UNINSTALLINFO_PROGRAM_OPTIONS ?= --delete
202LIBCHICKEN_SO_LIBRARIES ?= $(LIBRARIES)
203LIBUCHICKEN_SO_LIBRARIES ?= $(LIBRARIES)
204LIBCHICKENGUI_SO_LIBRARIES ?= $(LIBRARIES)
205
206# other settings
207
208HOSTNAME ?= $(shell hostname)
209ifeq ($(PLATFORM),mingw)
210BUILD_TIME ?= $(shell date /t)
211UNAME_SYS ?= MinGW
212else
213BUILD_TIME ?= $(shell date +%Y-%m-%d)
214UNAME_SYS ?= $(shell uname)
215endif
216BUILD_TAG ?= compiled $(BUILD_TIME) on $(HOSTNAME) ($(UNAME_SYS))
217
218ifdef LOCKTOSPACE
219C_COMPILER_BUILD_RUNTIME_OPTIONS += -DC_LOCK_TOSPACE
220endif
221
222# file extensions
223
224O ?= .o
225A ?= .a
226# EXE =
227SO ?= .so
228
229# special files
230
231POSIXFILE ?= posixunix
232CHICKEN_CONFIG_H = chicken-config.h
233PCRE_OBJECT_FILES ?= pcre/*.o
234
235ifneq ($(ARCH),)
236HACKED_APPLY = 1
237APPLY_HACK_OBJECT = apply-hack.$(ARCH)$(O)
238endif
239
240# bootstrapping compiler
241
242CHICKEN = $(PREFIX)/bin/chicken$(EXE)
243
244# Scheme compiler flags
245
246CHICKEN_OPTIONS = -quiet -no-trace -optimize-level 2 -include-path .
247CHICKEN_LIBRARY_OPTIONS = $(CHICKEN_OPTIONS) -explicit-use
248CHICKEN_PROGRAM_OPTIONS = $(CHICKEN_OPTIONS) -no-lambda-info
249CHICKEN_COMPILER_OPTIONS = $(CHICKEN_PROGRAM_OPTIONS) -extend private-namespace.scm
250CHICKEN_UNSAFE_OPTIONS = -unsafe -no-lambda-info
251
252# targets
253
254CHICKEN_PROGRAM = $(PROGRAM_PREFIX)chicken$(PROGRAM_SUFFIX)
255CSC_PROGRAM = $(PROGRAM_PREFIX)csc$(PROGRAM_SUFFIX)
256CSI_PROGRAM = $(PROGRAM_PREFIX)csi$(PROGRAM_SUFFIX)
257CHICKEN_PROFILE_PROGRAM = $(PROGRAM_PREFIX)chicken-profile$(PROGRAM_SUFFIX)
258CHICKEN_SETUP_PROGRAM = $(PROGRAM_PREFIX)chicken-setup$(PROGRAM_SUFFIX)
259CHICKEN_BUG_PROGRAM = $(PROGRAM_PREFIX)chicken-bug$(PROGRAM_SUFFIX)
260
261ifdef STATICBUILD
262CHICKEN_STATIC_EXECUTABLE = $(CHICKEN_PROGRAM)$(EXE)
263CSI_STATIC_EXECUTABLE = $(CSI_PROGRAM)$(EXE)
264CHICKEN_SHARED_EXECUTABLE = $(CHICKEN_PROGRAM)-shared$(EXE)
265CSI_SHARED_EXECUTABLE = $(CSI_PROGRAM)-shared$(EXE)
266TARGETLIBS ?= libchicken$(A) libuchicken$(A)
267TARGETS ?= $(TARGETLIBS) $(CHICKEN_STATIC_EXECUTABLE) \
268        $(CSI_STATIC_EXECUTABLE) $(CHICKEN_PROFILE_PROGRAM)$(EXE) \
269        $(CSC_PROGRAM)$(EXE) \
270        chicken.info $(CHICKEN_BUG_PROGRAM)$(EXE)
271else
272CHICKEN_STATIC_EXECUTABLE = $(CHICKEN_PROGRAM)-static$(EXE)
273CSI_STATIC_EXECUTABLE = $(CSI_PROGRAM)-static$(EXE)
274CHICKEN_SHARED_EXECUTABLE = $(CHICKEN_PROGRAM)$(EXE)
275CSI_SHARED_EXECUTABLE = $(CSI_PROGRAM)$(EXE)
276TARGETLIBS ?= libchicken$(A) libuchicken$(A) \
277        $(LIBCHICKEN_SO_FILE) $(LIBUCHICKEN_SO_FILE)
278TARGETS ?= $(TARGETLIBS) $(CHICKEN_SHARED_EXECUTABLE) \
279        $(CSI_SHARED_EXECUTABLE) $(CHICKEN_PROFILE_PROGRAM)$(EXE) \
280        $(CSC_PROGRAM)$(EXE) $(CHICKEN_SETUP_PROGRAM)$(EXE) chicken.info \
281        $(CHICKEN_BUG_PROGRAM)$(EXE)
282endif
283
284# main rule
285
286.PHONY: all
287
288all: $(TARGETS)
289
290# generic part of chicken-config.h
291
292ifndef CUSTOM_CHICKEN_DEFAULTS
293chicken-defaults.h:
294        echo "/* generated */" >$@
295        echo "#define C_BUILD_TAG \"$(BUILD_TAG)\"" >>$@
296        echo "#ifndef C_INSTALL_CC" >>$@
297        echo "# define C_INSTALL_CC \"$(C_COMPILER)\"" >>$@
298        echo "#endif" >>$@
299        echo "#ifndef C_INSTALL_CXX" >>$@
300        echo "# define C_INSTALL_CXX \"$(CXX_COMPILER)\"" >>$@
301        echo "#endif" >>$@
302        echo "#ifndef C_INSTALL_CFLAGS" >>$@
303        echo "# define C_INSTALL_CFLAGS \"$(C_COMPILER_OPTIONS) $(C_COMPILER_OPTIMIZATION_OPTIONS)\"" >>$@
304        echo "#endif" >>$@
305        echo "#ifndef C_INSTALL_LDFLAGS" >>$@
306        echo "# define C_INSTALL_LDFLAGS \"$(LINKER_OPTIONS) $(LINKER_OPTIMIZATION_OPTIONS)\"" >>$@
307        echo "#endif" >>$@
308        echo "#ifndef C_INSTALL_SHARE_HOME" >>$@
309        echo "# define C_INSTALL_SHARE_HOME \"$(DATADIR)\"" >>$@
310        echo "#endif" >>$@
311        echo "#ifndef C_INSTALL_BIN_HOME" >>$@
312        echo "# define C_INSTALL_BIN_HOME \"$(BINDIR)\"" >>$@
313        echo "#endif" >>$@
314        echo "#ifndef C_INSTALL_EGG_HOME" >>$@
315        echo "# define C_INSTALL_EGG_HOME \"$(EGGDIR)\"" >>$@
316        echo "#endif" >>$@
317        echo "#ifndef C_INSTALL_LIB_HOME" >>$@
318        echo "# define C_INSTALL_LIB_HOME \"$(LIBDIR)\"" >>$@
319        echo "#endif" >>$@
320        echo "#ifndef C_INSTALL_STATIC_LIB_HOME" >>$@
321        echo "# define C_INSTALL_STATIC_LIB_HOME \"$(LIBDIR)\"" >>$@
322        echo "#endif" >>$@
323        echo "#ifndef C_INSTALL_INCLUDE_HOME" >>$@
324        echo "# define C_INSTALL_INCLUDE_HOME \"$(INCDIR)\"" >>$@
325        echo "#endif" >>$@
326        echo "#ifndef C_INSTALL_MORE_LIBS" >>$@
327        echo "# define C_INSTALL_MORE_LIBS \"$(LIBRARIES)\"" >>$@
328        echo "#endif" >>$@
329        echo "#ifndef C_INSTALL_MORE_STATIC_LIBS" >>$@
330        echo "# define C_INSTALL_MORE_STATIC_LIBS \"$(LIBRARIES)\"" >>$@
331        echo "#endif" >>$@
332        echo "#ifndef C_DEFAULT_TARGET_STACK_SIZE" >>$@
333        echo "# define C_DEFAULT_TARGET_STACK_SIZE $(NURSERY)" >>$@
334        echo "#endif" >>$@
335        echo "#ifndef C_STACK_GROWS_DOWNWARD" >>$@
336        echo "# define C_STACK_GROWS_DOWNWARD $(STACKDIRECTION)" >>$@
337        echo "#endif" >>$@
338        echo "#ifndef C_TARGET_MORE_LIBS" >>$@
339        echo "# define C_TARGET_MORE_LIBS \"$(TARGET_LIBRARIES)\"" >>$@
340        echo "#endif" >>$@
341        echo "#ifndef C_TARGET_MORE_STATIC_LIBS" >>$@
342        echo "# define C_TARGET_MORE_STATIC_LIBS \"$(TARGET_LIBRARIES)\"" >>$@
343        echo "#endif" >>$@
344        echo "#ifndef C_TARGET_CC" >>$@
345        echo "# define C_TARGET_CC \"$(TARGET_C_COMPILER)\"" >>$@
346        echo "#endif" >>$@
347        echo "#ifndef C_TARGET_CXX" >>$@
348        echo "# define C_TARGET_CXX \"$(TARGET_CXX_COMPILER)\"" >>$@
349        echo "#endif" >>$@
350        echo "#ifndef C_TARGET_CFLAGS" >>$@
351        echo "# define C_TARGET_CFLAGS \"$(TARGET_C_COMPILER_OPTIONS) $(TARGET_C_COMPILER_OPTIMIZATION_OPTIONS)\"" >>$@
352        echo "#endif" >>$@
353        echo "#ifndef C_TARGET_LDFLAGS" >>$@
354        echo "# define C_TARGET_LDFLAGS \"$(TARGET_LINKER_OPTIONS) $(TARGET_LINKER_OPTIMIZATION_OPTIONS)\"" >>$@
355        echo "#endif" >>$@
356        echo "#ifndef C_CROSS_CHICKEN" >>$@
357        echo "# define C_CROSS_CHICKEN $(CROSS_CHICKEN)" >>$@
358        echo "#endif" >>$@
359        echo "#ifndef C_TARGET_LIB_HOME" >>$@
360        echo "# define C_TARGET_LIB_HOME \"$(TARGET_PREFIX)/lib\"" >>$@
361        echo "#endif" >>$@
362        echo "#ifndef C_TARGET_RUN_LIB_HOME" >>$@
363        echo "# define C_TARGET_RUN_LIB_HOME \"$(TARGET_RUN_PREFIX)/lib\"" >>$@
364        echo "#endif" >>$@
365        echo "#ifndef C_TARGET_SHARE_HOME" >>$@
366        echo "# define C_TARGET_SHARE_HOME \"$(TARGET_PREFIX)/share\"" >>$@
367        echo "#endif" >>$@
368        echo "#ifndef C_TARGET_INCLUDE_HOME" >>$@
369        echo "# define C_TARGET_INCLUDE_HOME \"$(TARGET_PREFIX)/include\"" >>$@
370        echo "#endif" >>$@
371        echo "#ifndef C_TARGET_STATIC_LIB_HOME" >>$@
372        echo "# define C_TARGET_STATIC_LIB_HOME \"$(TARGET_PREFIX)/lib\"" >>$@
373        echo "#endif" >>$@
374        echo "#ifndef C_CHICKEN_PROGRAM" >>$@
375        echo "# define C_CHICKEN_PROGRAM \"$(CHICKEN_PROGRAM)\"" >>$@
376        echo "#endif" >>$@
377        echo "#ifndef C_CSC_PROGRAM" >>$@
378        echo "# define C_CSC_PROGRAM \"$(CSC_PROGRAM)\"" >>$@
379        echo "#endif" >>$@
380        echo "#ifndef C_CSI_PROGRAM" >>$@
381        echo "# define C_CSI_PROGRAM \"$(CSI_PROGRAM)\"" >>$@
382        echo "#endif" >>$@
383        echo "#ifndef C_CHICKEN_PROFILE_PROGRAM" >>$@
384        echo "# define C_CHICKEN_PROFILE_PROGRAM \"$(CHICKEN_PROFILE_PROGRAM)\"" >>$@
385        echo "#endif" >>$@
386        echo "#ifndef C_CHICKEN_SETUP_PROGRAM" >>$@
387        echo "# define C_CHICKEN_SETUP_PROGRAM \"$(CHICKEN_SETUP_PROGRAM)\"" >>$@
388        echo "#endif" >>$@
389        echo "#ifndef C_CHICKEN_BUG_PROGRAM" >>$@
390        echo "# define C_CHICKEN_BUG_PROGRAM \"$(CHICKEN_BUG_PROGRAM)\"" >>$@
391        echo "#endif" >>$@
392endif
393#
Note: See TracBrowser for help on using the repository browser.