source: project/chicken/trunk/defaults.make @ 6175

Last change on this file since 6175 was 6175, checked in by Kon Lovett, 12 years ago

Changes for PCRE 7.4, use of compiled regexp in posix & utils units.

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