~ chicken-core (chicken-5) /rules.make
Trap1# rules.make - basic build rules -*- Makefile -*-
2#
3# Copyright (c) 2008-2022, The CHICKEN Team
4# Copyright (c) 2000-2007, Felix L. Winkelmann
5# All rights reserved.
6#
7# Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following
8# conditions are met:
9#
10# Redistributions of source code must retain the above copyright notice, this list of conditions and the following
11# disclaimer.
12# Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following
13# disclaimer in the documentation and/or other materials provided with the distribution.
14# Neither the name of the author nor the names of its contributors may be used to endorse or promote
15# products derived from this software without specific prior written permission.
16#
17# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
18# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
19# AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
20# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
24# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25# POSSIBILITY OF SUCH DAMAGE.
26
27VPATH=$(SRCDIR)
28
29# Clear Make's default rules for C programs
30.SUFFIXES:
31%.o : %.c
32%: %.o
33
34# object files
35
36LIBCHICKEN_SCHEME_OBJECTS_1 = \
37 library eval read-syntax repl data-structures pathname port file \
38 extras lolevel tcp srfi-4 continuation $(POSIXFILE) internal \
39 irregex scheduler debugger-client profiler stub expand modules \
40 chicken-syntax chicken-ffi-syntax build-version
41LIBCHICKEN_OBJECTS_1 = $(LIBCHICKEN_SCHEME_OBJECTS_1) runtime
42LIBCHICKEN_SHARED_OBJECTS = $(LIBCHICKEN_OBJECTS_1:=$(O))
43LIBCHICKEN_STATIC_OBJECTS = $(LIBCHICKEN_OBJECTS_1:=-static$(O)) \
44 eval-modules-static$(O)
45
46COMPILER_OBJECTS_1 = \
47 chicken batch-driver core optimizer lfa2 compiler-syntax scrutinizer support \
48 c-platform c-backend user-pass
49COMPILER_OBJECTS = $(COMPILER_OBJECTS_1:=$(O))
50COMPILER_STATIC_OBJECTS = $(COMPILER_OBJECTS_1:=-static$(O))
51
52# "Utility programs" is arbitrary. It includes anything but the "chicken" binary.
53# We can't use the INSTALLED_PROGRAMS below because of the possible $(EXE)
54# suffix and other possible mangling requested by the user. (is this supported?)
55UTILITY_PROGRAM_OBJECTS_1 = \
56 csc csi chicken-install chicken-uninstall chicken-status chicken-profile
57
58# Not all programs built are installed(?) This is the master list that takes
59# care of which programs should actually be installed/uninstalled
60INSTALLED_PROGRAMS = \
61 $(CHICKEN_PROGRAM) $(CSI_PROGRAM) $(CHICKEN_PROFILE_PROGRAM) \
62 $(CSC_PROGRAM) \
63 $(CHICKEN_DO_PROGRAM) $(CHICKEN_STATUS_PROGRAM) \
64 $(CHICKEN_INSTALL_PROGRAM) $(CHICKEN_UNINSTALL_PROGRAM)
65
66# These generated files make up a bootstrapped distribution build.
67# They are not cleaned by the 'clean' target, but only by 'spotless'.
68DISTFILES = $(filter-out runtime.c,$(LIBCHICKEN_OBJECTS_1:=.c)) \
69 $(UTILITY_PROGRAM_OBJECTS_1:=.c) \
70 $(COMPILER_OBJECTS_1:=.c) \
71 $(IMPORT_LIBRARIES:=.import.c) \
72 $(DYNAMIC_IMPORT_LIBRARIES:=.import.scm) \
73 $(foreach lib,$(DYNAMIC_CHICKEN_IMPORT_LIBRARIES),chicken.$(lib).import.scm) \
74 $(foreach lib,$(DYNAMIC_CHICKEN_UNIT_IMPORT_LIBRARIES),chicken.$(lib).import.scm) \
75 $(foreach lib,$(COMPILER_OBJECTS_1),chicken.compiler.$(lib).import.scm) \
76 eval-modules.c posixunix.c posixwin.c
77# Remove the duplicate $(POSIXFILE) entry:
78DISTFILES := $(sort $(DISTFILES))
79
80# library objects
81
82## Any variable that starts with "declare-" is a meta-rule. When $(call)ed
83## it produces output that represents an instantiated rule and recipe.
84## This output then needs to be $(eval)ed in order to be added to the
85## ruleset evaluated by Make. This allows us to automatically generate
86## similar rules for long lists of targets.
87
88## Note: in some of the rules that follow it is important to add
89## $(INCLUDES) last, because on raw mingw (using the DOS shell) the
90## backslash in "-I.\" seems to be interpreted as a line-terminator.
91## This may be caused by cmd.exe-stupidness or a bug in mingw32-make
92## or some other obscure reason.
93
94define declare-shared-library-object
95$(1)$(O): $(1).c chicken.h $$(CHICKEN_CONFIG_H)
96 $$(C_COMPILER) $$(C_COMPILER_OPTIONS) \
97 $$(C_COMPILER_COMPILE_OPTION) $$(C_COMPILER_OPTIMIZATION_OPTIONS) $$(C_COMPILER_SHARED_OPTIONS) \
98 $$(C_COMPILER_BUILD_RUNTIME_OPTIONS) $$< $$(C_COMPILER_OUTPUT) \
99 $$(INCLUDES)
100endef
101
102# The above meta-rule is reused in the setup API stuff below, so we alias it
103declare-libchicken-object = $(declare-shared-library-object)
104
105$(foreach obj, $(LIBCHICKEN_OBJECTS_1),\
106 $(eval $(call declare-libchicken-object,$(obj))))
107
108# static versions
109
110define declare-static-library-object
111$(1)-static$(O): $(1).c chicken.h $$(CHICKEN_CONFIG_H)
112 $$(C_COMPILER) $$(C_COMPILER_OPTIONS) \
113 $$(C_COMPILER_COMPILE_OPTION) $$(C_COMPILER_OPTIMIZATION_OPTIONS) \
114 $$(C_COMPILER_STATIC_OPTIONS) \
115 $$(C_COMPILER_BUILD_RUNTIME_OPTIONS) $$< $$(C_COMPILER_OUTPUT) \
116 $$(INCLUDES)
117endef
118
119declare-static-libchicken-object = $(declare-static-library-object)
120
121$(foreach obj, $(LIBCHICKEN_OBJECTS_1),\
122 $(eval $(call declare-static-libchicken-object,$(obj))))
123
124$(eval $(call declare-static-libchicken-object,eval-modules))
125
126# import library objects
127
128define declare-import-lib-object
129$(1).import$(O): $(1).import.c chicken.h $$(CHICKEN_CONFIG_H)
130 $$(C_COMPILER) $$(C_COMPILER_OPTIONS) \
131 -DC_SHARED $$(C_COMPILER_COMPILE_OPTION) \
132 $$(C_COMPILER_OPTIMIZATION_OPTIONS) $$(C_COMPILER_SHARED_OPTIONS) \
133 $$(C_COMPILER_BUILD_RUNTIME_OPTIONS) $$< $$(C_COMPILER_OUTPUT) \
134 $$(INCLUDES)
135endef
136
137$(foreach obj,$(IMPORT_LIBRARIES),\
138 $(eval $(call declare-import-lib-object,$(obj))))
139
140# compiler objects
141
142define declare-compiler-object
143$(1)$(O): $(1).c chicken.h $$(CHICKEN_CONFIG_H)
144 $$(C_COMPILER) $$(C_COMPILER_OPTIONS) \
145 $$(C_COMPILER_COMPILE_OPTION) $$(C_COMPILER_OPTIMIZATION_OPTIONS) $$(C_COMPILER_SHARED_OPTIONS) $$< \
146 $$(C_COMPILER_OUTPUT) $$(INCLUDES)
147endef
148
149$(foreach obj, $(COMPILER_OBJECTS_1),\
150 $(eval $(call declare-compiler-object,$(obj))))
151
152# static compiler objects
153
154define declare-static-compiler-object
155$(1)-static$(O): $(1).c chicken.h $$(CHICKEN_CONFIG_H)
156 $$(C_COMPILER) $$(C_COMPILER_OPTIONS) \
157 $$(C_COMPILER_STATIC_OPTIONS) \
158 $$(C_COMPILER_COMPILE_OPTION) $$(C_COMPILER_OPTIMIZATION_OPTIONS) $$< $$(C_COMPILER_OUTPUT) \
159 $$(INCLUDES)
160endef
161
162$(foreach obj, $(COMPILER_OBJECTS_1),\
163 $(eval $(call declare-static-compiler-object,$(obj))))
164
165# program objects
166
167define declare-utility-program-object
168$(1)$(O): $(1).c chicken.h $$(CHICKEN_CONFIG_H)
169 $$(C_COMPILER) $$(C_COMPILER_OPTIONS) $$(C_COMPILER_SHARED_OPTIONS) \
170 $$(C_COMPILER_COMPILE_OPTION) $$(C_COMPILER_OPTIMIZATION_OPTIONS) $$< $$(C_COMPILER_OUTPUT) \
171 $$(INCLUDES)
172endef
173
174$(foreach obj, $(UTILITY_PROGRAM_OBJECTS_1),\
175 $(eval $(call declare-utility-program-object,$(obj))))
176
177
178# resource objects
179
180%.rc.o: %.rc
181 $(RC_COMPILER) $< $@
182
183# libraries
184
185.PHONY: libs
186
187libs: $(TARGETLIBS)
188
189lib$(PROGRAM_PREFIX)chicken$(PROGRAM_SUFFIX)$(SO): $(LIBCHICKEN_SHARED_OBJECTS)
190 $(LINKER) $(LINKER_OPTIONS) $(LINKER_LINK_SHARED_LIBRARY_OPTIONS) $(LIBCHICKEN_SO_LINKER_OPTIONS) \
191 $(LINKER_OUTPUT) $^ $(LIBCHICKEN_SO_LIBRARIES)
192ifdef USES_SONAME
193 ln -sf $(LIBCHICKEN_SO_FILE) $(LIBCHICKEN_SO_FILE).$(BINARYVERSION)
194endif
195
196cyg$(PROGRAM_PREFIX)chicken$(PROGRAM_SUFFIX)-0.dll: $(LIBCHICKEN_SHARED_OBJECTS)
197 $(LINKER) -shared -o $(LIBCHICKEN_SO_FILE) -Wl,--dll -Wl,--add-stdcall-alias \
198 -Wl,--enable-stdcall-fixup -Wl,--warn-unresolved-symbols \
199 -Wl,--dll-search-prefix=cyg -Wl,--allow-multiple-definition \
200 -Wl,--allow-shlib-undefined \
201 -Wl,--out-implib=libchicken.dll.a -Wl,--export-all-symbols \
202 -Wl,--enable-auto-import \
203 -Wl,--whole-archive $(LIBCHICKEN_SHARED_OBJECTS) \
204 -Wl,--no-whole-archive $(LIBCHICKEN_SO_LIBRARIES)
205
206lib$(PROGRAM_PREFIX)chicken$(PROGRAM_SUFFIX)$(A): $(LIBCHICKEN_STATIC_OBJECTS)
207 $(LIBRARIAN) $(LIBRARIAN_OPTIONS) $(LIBRARIAN_OUTPUT) $^
208
209# import libraries and extensions
210
211%.so: %.o $(LIBCHICKEN_SO_FILE)
212 $(LINKER) $(LINKER_OPTIONS) $(LINKER_LINK_SHARED_DLOADABLE_OPTIONS) $< $(LINKER_OUTPUT_OPTION) $@ \
213 $(LINKER_LIBRARY_PREFIX)$(PROGRAM_PREFIX)chicken$(PROGRAM_SUFFIX)$(LINKER_LIBRARY_SUFFIX) \
214 $(LIBRARIES)
215
216# executables
217
218$(CHICKEN_SHARED_EXECUTABLE): $(COMPILER_OBJECTS) $(PRIMARY_LIBCHICKEN)
219 $(LINKER) $(LINKER_OPTIONS) $(LINKER_EXECUTABLE_OPTIONS) $(COMPILER_OBJECTS) $(LINKER_OUTPUT) \
220 $(LINKER_LIBRARY_PREFIX)$(PROGRAM_PREFIX)chicken$(PROGRAM_SUFFIX)$(LINKER_LIBRARY_SUFFIX) $(LINKER_LINK_SHARED_PROGRAM_OPTIONS) $(LIBRARIES)
221 $(PREINSTALL_PROGRAM_FIXUP) $(CHICKEN_SHARED_EXECUTABLE)
222
223define declare-program-from-object
224$(1)-RC_FILE = $(if $(and $(RC_COMPILER),$(3)),$(2).rc$(O))
225
226$(1): $(2)$(O) $$(PRIMARY_LIBCHICKEN) $$($(1)-RC_FILE)
227 $$(LINKER) $$(LINKER_OPTIONS) $$(LINKER_EXECUTABLE_OPTIONS) $$< \
228 $$($(1)-RC_FILE) $$(LINKER_OUTPUT) \
229 $$(LINKER_LIBRARY_PREFIX)$$(PROGRAM_PREFIX)chicken$$(PROGRAM_SUFFIX)$$(LINKER_LIBRARY_SUFFIX) \
230 $$(LINKER_LINK_SHARED_PROGRAM_OPTIONS) $$(LIBRARIES)
231endef
232
233# Unfortunately, we can't loop over INSTALLED_PROGRAMS here because of
234# the possible name mangling and EXE suffixing in there :(
235$(eval $(call declare-program-from-object,$(CSI_SHARED_EXECUTABLE),csi))
236$(eval $(call declare-program-from-object,$(CHICKEN_INSTALL_PROGRAM)$(EXE),chicken-install,true))
237$(eval $(call declare-program-from-object,$(CHICKEN_UNINSTALL_PROGRAM)$(EXE),chicken-uninstall,true))
238$(eval $(call declare-program-from-object,$(CHICKEN_STATUS_PROGRAM)$(EXE),chicken-status))
239$(eval $(call declare-program-from-object,$(CHICKEN_PROFILE_PROGRAM)$(EXE),chicken-profile))
240$(eval $(call declare-program-from-object,$(CSC_PROGRAM)$(EXE),csc))
241
242# static executables
243
244$(CHICKEN_STATIC_EXECUTABLE): $(COMPILER_STATIC_OBJECTS) lib$(PROGRAM_PREFIX)chicken$(PROGRAM_SUFFIX)$(A)
245 $(LINKER) $(LINKER_OPTIONS) $(LINKER_STATIC_OPTIONS) $(COMPILER_STATIC_OBJECTS) $(LINKER_OUTPUT) lib$(PROGRAM_PREFIX)chicken$(PROGRAM_SUFFIX)$(A) $(LIBRARIES)
246
247define declare-static-program-from-object
248$(1): $(2)$(O) lib$(PROGRAM_PREFIX)chicken$(PROGRAM_SUFFIX)$(A)
249 $$(LINKER) $$(LINKER_OPTIONS) $$(LINKER_STATIC_OPTIONS) $$< $$(LINKER_OUTPUT) lib$(PROGRAM_PREFIX)chicken$(PROGRAM_SUFFIX)$(A) $$(LIBRARIES)
250endef
251
252$(eval $(call declare-program-from-object,$(CSI_STATIC_EXECUTABLE),csi))
253
254# "chicken-do"
255
256$(CHICKEN_DO_PROGRAM)$(EXE): $(SRCDIR)chicken-do.c chicken.h $(CHICKEN_CONFIG_H)
257 $(C_COMPILER) $(C_COMPILER_OPTIONS) $(C_COMPILER_OPTIMIZATION_OPTIONS) $< -o $@
258
259# scripts
260
261$(CHICKEN_DEBUGGER_PROGRAM): $(SRCDIR)feathers$(SCRIPT_EXT).in
262 $(GENERATE_DEBUGGER)
263
264
265# installation
266
267.PHONY: install uninstall install-libs
268.PHONY: install-target install-dev install-bin install-other-files install-wrappers
269
270install: $(TARGETS) install-target install-bin install-libs install-dev install-other-files
271
272install-target: install-libs
273
274install-libs: libs $(LIBCHICKEN_IMPORT_LIBRARY)
275 $(MAKEDIR_COMMAND) $(MAKEDIR_COMMAND_OPTIONS) "$(DESTDIR)$(ILIBDIR)"
276ifneq ($(LIBCHICKEN_IMPORT_LIBRARY),)
277 $(INSTALL_PROGRAM) $(INSTALL_PROGRAM_STATIC_LIBRARY_OPTIONS) $(LIBCHICKEN_IMPORT_LIBRARY) "$(DESTDIR)$(ILIBDIR)"
278endif
279ifndef STATICBUILD
280ifdef DLLSINPATH
281 $(MAKEDIR_COMMAND) $(MAKEDIR_COMMAND_OPTIONS) "$(DESTDIR)$(IBINDIR)"
282 $(INSTALL_PROGRAM) $(INSTALL_PROGRAM_SHARED_LIBRARY_OPTIONS) $(LIBCHICKEN_SO_FILE) "$(DESTDIR)$(IBINDIR)"
283else
284ifdef USES_SONAME
285 $(INSTALL_PROGRAM) $(INSTALL_PROGRAM_SHARED_LIBRARY_OPTIONS) $(LIBCHICKEN_SO_FILE) "$(DESTDIR)$(ILIBDIR)$(SEP)$(LIBCHICKEN_SO_FILE).$(BINARYVERSION)"
286 cd "$(DESTDIR)$(ILIBDIR)" && ln -sf $(LIBCHICKEN_SO_FILE).$(BINARYVERSION) lib$(PROGRAM_PREFIX)chicken$(PROGRAM_SUFFIX)$(SO)
287else
288 $(INSTALL_PROGRAM) $(INSTALL_PROGRAM_SHARED_LIBRARY_OPTIONS) $(LIBCHICKEN_SO_FILE) "$(DESTDIR)$(ILIBDIR)$(SEP)$(LIBCHICKEN_SO_FILE)"
289endif
290endif
291endif
292
293define NL
294
295
296endef # A newline, used to inject recipe lines in a loop. Ugly, but necessary
297
298install-dev: install-libs
299 $(MAKEDIR_COMMAND) $(MAKEDIR_COMMAND_OPTIONS) "$(DESTDIR)$(ILIBDIR)"
300 $(MAKEDIR_COMMAND) $(MAKEDIR_COMMAND_OPTIONS) "$(DESTDIR)$(ISHAREDIR)"
301 $(MAKEDIR_COMMAND) $(MAKEDIR_COMMAND_OPTIONS) "$(DESTDIR)$(IEGGDIR)"
302 $(MAKEDIR_COMMAND) $(MAKEDIR_COMMAND_OPTIONS) "$(DESTDIR)$(ICHICKENINCDIR)"
303 $(MAKEDIR_COMMAND) $(MAKEDIR_COMMAND_OPTIONS) "$(DESTDIR)$(IDATADIR)"
304 $(INSTALL_PROGRAM) $(INSTALL_PROGRAM_STATIC_LIBRARY_OPTIONS) lib$(PROGRAM_PREFIX)chicken$(PROGRAM_SUFFIX)$(A) "$(DESTDIR)$(ILIBDIR)"
305ifneq ($(POSTINSTALL_STATIC_LIBRARY),true)
306 $(POSTINSTALL_STATIC_LIBRARY) $(POSTINSTALL_STATIC_LIBRARY_FLAGS) "$(ILIBDIR)$(SEP)libchicken$(A)"
307endif
308 $(INSTALL_PROGRAM) $(INSTALL_PROGRAM_FILE_OPTIONS) $(SRCDIR)chicken.h "$(DESTDIR)$(ICHICKENINCDIR)"
309 $(INSTALL_PROGRAM) $(INSTALL_PROGRAM_FILE_OPTIONS) $(CHICKEN_CONFIG_H) "$(DESTDIR)$(ICHICKENINCDIR)"
310ifdef WINDOWS
311 $(INSTALL_PROGRAM) $(INSTALL_PROGRAM_FILE_OPTIONS) $(SRCDIR)chicken.ico "$(DESTDIR)$(IDATADIR)"
312 $(INSTALL_PROGRAM) $(INSTALL_PROGRAM_FILE_OPTIONS) $(SRCDIR)chicken.rc$(O) "$(DESTDIR)$(IDATADIR)"
313endif
314 $(INSTALL_PROGRAM) $(INSTALL_PROGRAM_FILE_OPTIONS) $(SRCDIR)types.db "$(DESTDIR)$(IEGGDIR)"
315
316ifeq ($(NEEDS_RELINKING),yes)
317install-bin: $(TARGETS) install-libs install-dev
318 $(foreach prog,$(INSTALLED_PROGRAMS),\
319 $(REMOVE_COMMAND) $(REMOVE_COMMAND_OPTIONS) $(prog)$(EXE) $(NL))
320
321 $(REMOVE_COMMAND) $(REMOVE_COMMAND_OPTIONS) $(IMPORT_LIBRARIES:%=%.so)
322 $(REMOVE_COMMAND) $(REMOVE_COMMAND_OPTIONS) $(IMPORT_LIBRARIES:%=%.import.so)
323 $(REMOVE_COMMAND) $(REMOVE_COMMAND_OPTIONS) $(LIBCHICKEN_SO_FILE)
324 "$(MAKE)" PLATFORM=$(PLATFORM) CONFIG=$(CONFIG) NEEDS_RELINKING=no RUNTIME_LINKER_PATH="$(LIBDIR)" install-bin
325# Damn. What was this for, again?
326#
327# $(MAKE_WRITABLE_COMMAND) $(CHICKEN_PROGRAM)$(EXE) $(CSI_PROGRAM)$(EXE) $(CSC_PROGRAM)$(EXE) $(CHICKEN_PROFILE_PROGRAM)$(EXE)
328# $(MAKE_WRITABLE_COMMAND) $(CHICKEN_INSTALL_PROGRAM)$(EXE)
329# $(MAKE_WRITABLE_COMMAND) $(CHICKEN_UNINSTALL_PROGRAM)$(EXE)
330# $(MAKE_WRITABLE_COMMAND) $(CHICKEN_STATUS_PROGRAM)$(EXE)
331else
332install-bin: $(TARGETS) install-libs install-dev
333 $(MAKEDIR_COMMAND) $(MAKEDIR_COMMAND_OPTIONS) "$(DESTDIR)$(IBINDIR)"
334
335 $(foreach prog,$(INSTALLED_PROGRAMS),\
336 $(INSTALL_PROGRAM) $(INSTALL_PROGRAM_EXECUTABLE_OPTIONS) \
337 $(prog)$(EXE) "$(DESTDIR)$(IBINDIR)" $(NL))
338
339 $(INSTALL_PROGRAM) $(INSTALL_PROGRAM_EXECUTABLE_OPTIONS) $(CHICKEN_DEBUGGER_PROGRAM) "$(DESTDIR)$(IBINDIR)"
340
341ifdef STATICBUILD
342 $(foreach lib,$(IMPORT_LIBRARIES),\
343 $(INSTALL_PROGRAM) $(INSTALL_PROGRAM_FILE_OPTIONS) \
344 $(lib).import.scm "$(DESTDIR)$(IEGGDIR)" $(NL))
345else
346 $(foreach lib,$(IMPORT_LIBRARIES),\
347 $(INSTALL_PROGRAM) $(INSTALL_PROGRAM_EXECUTABLE_OPTIONS) \
348 $(lib).import.so "$(DESTDIR)$(IEGGDIR)" $(NL))
349endif
350
351ifneq ($(POSTINSTALL_PROGRAM),true)
352ifndef STATICBUILD
353 $(foreach prog,$(INSTALLED_PROGRAMS),\
354 $(POSTINSTALL_PROGRAM) $(POSTINSTALL_PROGRAM_FLAGS) \
355 "$(DESTDIR)$(IBINDIR)$(SEP)$(prog)" $(NL))
356
357 $(foreach import-lib,$(IMPORT_LIBRARIES),\
358 $(POSTINSTALL_PROGRAM) $(POSTINSTALL_PROGRAM_FLAGS) \
359 "$(DESTDIR)$(IEGGDIR)$(SEP)$(import-lib).import.so" $(NL))
360endif
361endif
362ifeq ($(CROSS_CHICKEN)$(DESTDIR),0)
363 -$(IBINDIR)$(SEP)$(CHICKEN_INSTALL_PROGRAM) -defaults $(SRCDIR)setup.defaults -update-db
364else
365 @echo
366 @echo "Warning: cannot run \`$(CHICKEN_INSTALL_PROGRAM) -update-db' when cross-compiling or DESTDIR is set"
367 @echo
368endif
369endif
370ifdef WINDOWS_SHELL
371 $(INSTALL_PROGRAM) $(INSTALL_PROGRAM_EXECUTABLE_OPTIONS) $(SRCDIR)csibatch.bat "$(DESTDIR)$(IBINDIR)"
372endif
373
374install-other-files:
375 $(MAKEDIR_COMMAND) $(MAKEDIR_COMMAND_OPTIONS) "$(DESTDIR)$(IMAN1DIR)"
376 $(MAKEDIR_COMMAND) $(MAKEDIR_COMMAND_OPTIONS) "$(DESTDIR)$(IDOCDIR)"
377 $(MAKEDIR_COMMAND) $(MAKEDIR_COMMAND_OPTIONS) "$(DESTDIR)$(IDATADIR)"
378
379 $(INSTALL_PROGRAM) $(INSTALL_PROGRAM_FILE_OPTIONS) $(SRCDIR)chicken$(MAN) "$(DESTDIR)$(IMAN1DIR)$(SEP)$(CHICKEN_PROGRAM).1"
380 $(INSTALL_PROGRAM) $(INSTALL_PROGRAM_FILE_OPTIONS) $(SRCDIR)csc$(MAN) "$(DESTDIR)$(IMAN1DIR)$(SEP)$(CSC_PROGRAM).1"
381 $(INSTALL_PROGRAM) $(INSTALL_PROGRAM_FILE_OPTIONS) $(SRCDIR)csi$(MAN) "$(DESTDIR)$(IMAN1DIR)$(SEP)$(CSI_PROGRAM).1"
382 $(INSTALL_PROGRAM) $(INSTALL_PROGRAM_FILE_OPTIONS) $(SRCDIR)chicken-do$(MAN) "$(DESTDIR)$(IMAN1DIR)$(SEP)$(CHICKEN_DO_PROGRAM).1"
383 $(INSTALL_PROGRAM) $(INSTALL_PROGRAM_FILE_OPTIONS) $(SRCDIR)chicken-install$(MAN) "$(DESTDIR)$(IMAN1DIR)$(SEP)$(CHICKEN_INSTALL_PROGRAM).1"
384 $(INSTALL_PROGRAM) $(INSTALL_PROGRAM_FILE_OPTIONS) $(SRCDIR)chicken-uninstall$(MAN) "$(DESTDIR)$(IMAN1DIR)$(SEP)$(CHICKEN_UNINSTALL_PROGRAM).1"
385 $(INSTALL_PROGRAM) $(INSTALL_PROGRAM_FILE_OPTIONS) $(SRCDIR)chicken-status$(MAN) "$(DESTDIR)$(IMAN1DIR)$(SEP)$(CHICKEN_STATUS_PROGRAM).1"
386 $(INSTALL_PROGRAM) $(INSTALL_PROGRAM_FILE_OPTIONS) $(SRCDIR)chicken-profile$(MAN) "$(DESTDIR)$(IMAN1DIR)$(SEP)$(CHICKEN_PROFILE_PROGRAM).1"
387 $(INSTALL_PROGRAM) $(INSTALL_PROGRAM_FILE_OPTIONS) $(SRCDIR)feathers$(MAN) "$(DESTDIR)$(IMAN1DIR)$(SEP)$(CHICKEN_DEBUGGER_PROGRAM).1"
388
389 $(MAKEDIR_COMMAND) $(MAKEDIR_COMMAND_OPTIONS) "$(DESTDIR)$(IDOCDIR)$(SEP)manual"
390 -$(INSTALL_PROGRAM) $(INSTALL_PROGRAM_FILE_OPTIONS) $(SRCDIR)manual-html$(SEP)* "$(DESTDIR)$(IDOCDIR)$(SEP)manual"
391 $(INSTALL_PROGRAM) $(INSTALL_PROGRAM_FILE_OPTIONS) $(SRCDIR)README "$(DESTDIR)$(IDOCDIR)"
392 $(INSTALL_PROGRAM) $(INSTALL_PROGRAM_FILE_OPTIONS) $(SRCDIR)DEPRECATED "$(DESTDIR)$(IDOCDIR)"
393 $(INSTALL_PROGRAM) $(INSTALL_PROGRAM_FILE_OPTIONS) $(SRCDIR)LICENSE "$(DESTDIR)$(IDOCDIR)"
394 $(INSTALL_PROGRAM) $(INSTALL_PROGRAM_FILE_OPTIONS) $(SRCDIR)setup.defaults "$(DESTDIR)$(IDATADIR)"
395 $(INSTALL_PROGRAM) $(INSTALL_PROGRAM_FILE_OPTIONS) $(SRCDIR)feathers.tcl "$(DESTDIR)$(IDATADIR)"
396
397install-wrappers:
398ifeq ($(WRAPPERDIR),)
399 @echo
400 @echo Error: WRAPPERDIR is not set
401 @echo
402 @exit 1
403endif
404 $(foreach prg, $(INSTALLED_PROGRAMS), \
405 $(CSI) -s $(SRCDIR)scripts$(SEP)make-wrapper.scm $(prg) "$(WRAPPERDIR)" $(NL))
406
407uninstall:
408 $(foreach prog,$(INSTALLED_PROGRAMS),\
409 $(REMOVE_COMMAND) $(REMOVE_COMMAND_OPTIONS)\
410 "$(DESTDIR)$(IBINDIR)$(SEP)$(prog)$(EXE)" $(NL))
411 $(REMOVE_COMMAND) $(REMOVE_COMMAND_OPTIONS) "$(DESTDIR)$(IBINDIR)$(SEP)$(CHICKEN_DEBUGGER_PROGRAM)"
412 $(REMOVE_COMMAND) $(REMOVE_COMMAND_OPTIONS) "$(DESTDIR)$(ILIBDIR)$(SEP)lib$(PROGRAM_PREFIX)chicken$(PROGRAM_SUFFIX)$(A)"
413 $(REMOVE_COMMAND) $(REMOVE_COMMAND_OPTIONS) "$(DESTDIR)$(ILIBDIR)$(SEP)lib$(PROGRAM_PREFIX)chicken$(PROGRAM_SUFFIX)$(SO)"
414ifdef USES_SONAME
415 -$(REMOVE_COMMAND) $(REMOVE_COMMAND_OPTIONS) "$(DESTDIR)$(ILIBDIR)$(SEP)lib$(PROGRAM_PREFIX)chicken$(PROGRAM_SUFFIX)$(SO).$(BINARYVERSION)"
416endif
417ifdef WINDOWS
418 $(REMOVE_COMMAND) $(REMOVE_COMMAND_OPTIONS) "$(DESTDIR)$(IBINDIR)$(SEP)lib$(PROGRAM_PREFIX)chicken$(PROGRAM_SUFFIX)$(SO)"
419 $(REMOVE_COMMAND) $(REMOVE_COMMAND_OPTIONS) "$(DESTDIR)$(ILIBDIR)$(SEP)$(LIBCHICKEN_IMPORT_LIBRARY)"
420endif
421ifeq ($(PLATFORM),cygwin)
422 $(REMOVE_COMMAND) $(REMOVE_COMMAND_OPTIONS) "$(DESTDIR)$(IBINDIR)$(SEP)cyg$(PROGRAM_PREFIX)chicken$(PROGRAM_SUFFIX)*"
423endif
424
425 $(REMOVE_COMMAND) $(REMOVE_COMMAND_OPTIONS) "$(DESTDIR)$(IMAN1DIR)$(SEP)$(CHICKEN_PROGRAM).1"
426 $(REMOVE_COMMAND) $(REMOVE_COMMAND_OPTIONS) "$(DESTDIR)$(IMAN1DIR)$(SEP)$(CSC_PROGRAM).1"
427 $(REMOVE_COMMAND) $(REMOVE_COMMAND_OPTIONS) "$(DESTDIR)$(IMAN1DIR)$(SEP)$(CSI_PROGRAM).1"
428 $(REMOVE_COMMAND) $(REMOVE_COMMAND_OPTIONS) "$(DESTDIR)$(IMAN1DIR)$(SEP)$(CHICKEN_DO_PROGRAM).1"
429 $(REMOVE_COMMAND) $(REMOVE_COMMAND_OPTIONS) "$(DESTDIR)$(IMAN1DIR)$(SEP)$(CHICKEN_INSTALL_PROGRAM).1"
430 $(REMOVE_COMMAND) $(REMOVE_COMMAND_OPTIONS) "$(DESTDIR)$(IMAN1DIR)$(SEP)$(CHICKEN_UNINSTALL_PROGRAM).1"
431 $(REMOVE_COMMAND) $(REMOVE_COMMAND_OPTIONS) "$(DESTDIR)$(IMAN1DIR)$(SEP)$(CHICKEN_STATUS_PROGRAM).1"
432 $(REMOVE_COMMAND) $(REMOVE_COMMAND_OPTIONS) "$(DESTDIR)$(IMAN1DIR)$(SEP)$(CHICKEN_PROFILE_PROGRAM).1"
433 $(REMOVE_COMMAND) $(REMOVE_COMMAND_OPTIONS) "$(DESTDIR)$(IMAN1DIR)$(SEP)$(CHICKEN_DEBUGGER_PROGRAM).1"
434
435 $(REMOVE_COMMAND) $(REMOVE_COMMAND_OPTIONS) "$(DESTDIR)$(ICHICKENINCDIR)$(SEP)chicken.h"
436 $(REMOVE_COMMAND) $(REMOVE_COMMAND_OPTIONS) "$(DESTDIR)$(ICHICKENINCDIR)$(SEP)$(CHICKEN_CONFIG_H)"
437 $(REMOVE_COMMAND) $(REMOVE_COMMAND_RECURSIVE_OPTIONS) "$(DESTDIR)$(IDATADIR)"
438 $(REMOVE_COMMAND) $(REMOVE_COMMAND_RECURSIVE_OPTIONS) "$(DESTDIR)$(IEGGDIR)"
439ifdef WINDOWS_SHELL
440 $(REMOVE_COMMAND) $(REMOVE_COMMAND_OPTIONS) "$(DESTDIR)$(IBINDIR)$(SEP)csibatch.bat"
441endif
442
443# build versioning
444
445ifdef WINDOWS_SHELL
446buildbranch:
447 echo.$(BRANCHNAME)>buildbranch
448buildid:
449 echo.$(BUILD_ID)>buildid
450else
451.PHONY: identify-me
452
453identify-me:
454 @sh $(SRCDIR)identify.sh $(SRCDIR)
455
456buildbranch: identify-me
457buildid: identify-me
458endif
459
460# bootstrapping c sources
461
462define declare-emitted-import-lib-dependency
463.SECONDARY: $(1).import.scm
464$(1).import.scm: $(2).c
465endef
466
467define declare-emitted-chicken-import-lib-dependency
468$(call declare-emitted-import-lib-dependency,chicken.$(1),$(1))
469endef
470
471define declare-emitted-compiler-import-lib-dependency
472$(call declare-emitted-import-lib-dependency,chicken.compiler.$(1),$(1))
473endef
474
475$(foreach lib, $(DYNAMIC_IMPORT_LIBRARIES),\
476 $(eval $(call declare-emitted-import-lib-dependency,$(lib),$(lib))))
477
478$(foreach lib, $(DYNAMIC_CHICKEN_UNIT_IMPORT_LIBRARIES),\
479 $(eval $(call declare-emitted-chicken-import-lib-dependency,$(lib))))
480
481$(foreach lib, $(COMPILER_OBJECTS_1),\
482 $(eval $(call declare-emitted-compiler-import-lib-dependency,$(lib))))
483
484# special cases for modules not corresponding directly to units
485$(eval $(call declare-emitted-import-lib-dependency,chicken.errno,$(POSIXFILE)))
486$(eval $(call declare-emitted-import-lib-dependency,chicken.file.posix,$(POSIXFILE)))
487$(eval $(call declare-emitted-import-lib-dependency,chicken.time.posix,$(POSIXFILE)))
488$(eval $(call declare-emitted-import-lib-dependency,chicken.process,$(POSIXFILE)))
489$(eval $(call declare-emitted-import-lib-dependency,chicken.process.signal,$(POSIXFILE)))
490$(eval $(call declare-emitted-import-lib-dependency,chicken.process-context.posix,$(POSIXFILE)))
491$(eval $(call declare-emitted-import-lib-dependency,chicken.bitwise,library))
492$(eval $(call declare-emitted-import-lib-dependency,chicken.blob,library))
493$(eval $(call declare-emitted-import-lib-dependency,chicken.fixnum,library))
494$(eval $(call declare-emitted-import-lib-dependency,chicken.flonum,library))
495$(eval $(call declare-emitted-import-lib-dependency,chicken.gc,library))
496$(eval $(call declare-emitted-import-lib-dependency,chicken.keyword,library))
497$(eval $(call declare-emitted-import-lib-dependency,chicken.platform,library))
498$(eval $(call declare-emitted-import-lib-dependency,chicken.plist,library))
499$(eval $(call declare-emitted-import-lib-dependency,chicken.process-context,library))
500$(eval $(call declare-emitted-import-lib-dependency,chicken.time,library))
501$(eval $(call declare-emitted-import-lib-dependency,chicken.load,eval))
502$(eval $(call declare-emitted-import-lib-dependency,chicken.format,extras))
503$(eval $(call declare-emitted-import-lib-dependency,chicken.io,extras))
504$(eval $(call declare-emitted-import-lib-dependency,chicken.pretty-print,extras))
505$(eval $(call declare-emitted-import-lib-dependency,chicken.random,extras))
506$(eval $(call declare-emitted-import-lib-dependency,chicken.locative,lolevel))
507$(eval $(call declare-emitted-import-lib-dependency,chicken.memory,lolevel))
508$(eval $(call declare-emitted-import-lib-dependency,chicken.memory.representation,lolevel))
509$(eval $(call declare-emitted-import-lib-dependency,chicken.sort,data-structures))
510$(eval $(call declare-emitted-import-lib-dependency,chicken.string,data-structures))
511
512chicken.c: chicken.scm mini-srfi-1.scm \
513 chicken.compiler.batch-driver.import.scm \
514 chicken.compiler.c-platform.import.scm \
515 chicken.compiler.support.import.scm \
516 chicken.compiler.user-pass.import.scm \
517 chicken.process-context.import.scm \
518 chicken.string.import.scm
519batch-driver.c: batch-driver.scm mini-srfi-1.scm \
520 chicken.compiler.core.import.scm \
521 chicken.compiler.compiler-syntax.import.scm \
522 chicken.compiler.optimizer.import.scm \
523 chicken.compiler.scrutinizer.import.scm \
524 chicken.compiler.c-platform.import.scm \
525 chicken.compiler.lfa2.import.scm \
526 chicken.compiler.c-backend.import.scm \
527 chicken.compiler.support.import.scm \
528 chicken.compiler.user-pass.import.scm \
529 chicken.format.import.scm \
530 chicken.gc.import.scm \
531 chicken.internal.import.scm \
532 chicken.load.import.scm \
533 chicken.pathname.import.scm \
534 chicken.platform.import.scm \
535 chicken.pretty-print.import.scm \
536 chicken.process-context.import.scm \
537 chicken.process-context.posix.import.scm \
538 chicken.condition.import.scm \
539 chicken.port.import.scm \
540 chicken.string.import.scm \
541 chicken.syntax.import.scm \
542 chicken.time.import.scm
543c-platform.c: c-platform.scm mini-srfi-1.scm \
544 chicken.compiler.optimizer.import.scm \
545 chicken.compiler.support.import.scm \
546 chicken.compiler.core.import.scm \
547 chicken.internal.import.scm
548c-backend.c: c-backend.scm mini-srfi-1.scm \
549 chicken.compiler.c-platform.import.scm \
550 chicken.compiler.support.import.scm \
551 chicken.compiler.core.import.scm \
552 chicken.bitwise.import.scm \
553 chicken.flonum.import.scm \
554 chicken.foreign.import.scm \
555 chicken.format.import.scm \
556 chicken.internal.import.scm \
557 chicken.sort.import.scm \
558 chicken.string.import.scm \
559 chicken.time.import.scm
560core.c: core.scm mini-srfi-1.scm \
561 chicken.compiler.scrutinizer.import.scm \
562 chicken.compiler.support.import.scm \
563 chicken.eval.import.scm \
564 chicken.file.import.scm \
565 chicken.fixnum.import.scm \
566 chicken.format.import.scm \
567 chicken.io.import.scm \
568 chicken.keyword.import.scm \
569 chicken.load.import.scm \
570 chicken.pretty-print.import.scm \
571 chicken.string.import.scm \
572 chicken.syntax.import.scm
573optimizer.c: optimizer.scm mini-srfi-1.scm \
574 chicken.compiler.support.import.scm \
575 chicken.fixnum.import.scm \
576 chicken.internal.import.scm \
577 chicken.sort.import.scm \
578 chicken.string.import.scm
579scheduler.c: scheduler.scm \
580 chicken.fixnum.import.scm \
581 chicken.format.import.scm \
582 chicken.condition.import.scm
583scrutinizer.c: scrutinizer.scm mini-srfi-1.scm \
584 chicken.compiler.support.import.scm \
585 chicken.fixnum.import.scm \
586 chicken.format.import.scm \
587 chicken.internal.import.scm \
588 chicken.io.import.scm \
589 chicken.pathname.import.scm \
590 chicken.platform.import.scm \
591 chicken.sort.import.scm \
592 chicken.port.import.scm \
593 chicken.pretty-print.import.scm \
594 chicken.string.import.scm
595lfa2.c: lfa2.scm mini-srfi-1.scm \
596 chicken.compiler.support.import.scm \
597 chicken.format.import.scm
598compiler-syntax.c: compiler-syntax.scm mini-srfi-1.scm \
599 chicken.compiler.support.import.scm \
600 chicken.compiler.core.import.scm \
601 chicken.fixnum.import.scm \
602 chicken.format.import.scm \
603 chicken.syntax.import.scm
604chicken-ffi-syntax.c: chicken-ffi-syntax.scm \
605 chicken.format.import.scm \
606 chicken.internal.import.scm \
607 chicken.string.import.scm
608support.c: support.scm mini-srfi-1.scm \
609 chicken.bitwise.import.scm \
610 chicken.blob.import.scm \
611 chicken.condition.import.scm \
612 chicken.file.import.scm \
613 chicken.fixnum.import.scm \
614 chicken.foreign.import.scm \
615 chicken.format.import.scm \
616 chicken.internal.import.scm \
617 chicken.io.import.scm \
618 chicken.keyword.import.scm \
619 chicken.pathname.import.scm \
620 chicken.platform.import.scm \
621 chicken.plist.import.scm \
622 chicken.port.import.scm \
623 chicken.pretty-print.import.scm \
624 chicken.random.import.scm \
625 chicken.sort.import.scm \
626 chicken.string.import.scm \
627 chicken.time.import.scm
628modules.c: modules.scm \
629 chicken.internal.import.scm \
630 chicken.keyword.import.scm \
631 chicken.base.import.scm \
632 chicken.syntax.import.scm \
633 chicken.load.import.scm \
634 chicken.platform.import.scm
635csc.c: csc.scm \
636 chicken.file.import.scm \
637 chicken.foreign.import.scm \
638 chicken.format.import.scm \
639 chicken.io.import.scm \
640 chicken.pathname.import.scm \
641 chicken.process.import.scm \
642 chicken.process-context.import.scm \
643 chicken.string.import.scm
644csi.c: csi.scm \
645 chicken.condition.import.scm \
646 chicken.file.import.scm \
647 chicken.foreign.import.scm \
648 chicken.format.import.scm \
649 chicken.gc.import.scm \
650 chicken.internal.import.scm \
651 chicken.io.import.scm \
652 chicken.keyword.import.scm \
653 chicken.load.import.scm \
654 chicken.platform.import.scm \
655 chicken.port.import.scm \
656 chicken.pretty-print.import.scm \
657 chicken.process.import.scm \
658 chicken.process-context.import.scm \
659 chicken.repl.import.scm \
660 chicken.sort.import.scm \
661 chicken.string.import.scm
662chicken-profile.c: chicken-profile.scm \
663 chicken.internal.import.scm \
664 chicken.file.import.scm \
665 chicken.file.posix.import.scm \
666 chicken.fixnum.import.scm \
667 chicken.process-context.import.scm \
668 chicken.sort.import.scm \
669 chicken.string.import.scm
670chicken-status.c: chicken-status.scm \
671 chicken.file.import.scm \
672 chicken.file.posix.import.scm \
673 chicken.fixnum.import.scm \
674 chicken.foreign.import.scm \
675 chicken.format.import.scm \
676 chicken.irregex.import.scm \
677 chicken.pathname.import.scm \
678 chicken.port.import.scm \
679 chicken.pretty-print.import.scm \
680 chicken.process-context.import.scm \
681 chicken.sort.import.scm \
682 chicken.string.import.scm
683chicken-install.c: chicken-install.scm \
684 chicken.condition.import.scm \
685 chicken.file.import.scm \
686 chicken.file.posix.import.scm \
687 chicken.fixnum.import.scm \
688 chicken.foreign.import.scm \
689 chicken.format.import.scm \
690 chicken.internal.import.scm \
691 chicken.io.import.scm \
692 chicken.irregex.import.scm \
693 chicken.pathname.import.scm \
694 chicken.port.import.scm \
695 chicken.pretty-print.import.scm \
696 chicken.process.import.scm \
697 chicken.process-context.import.scm \
698 chicken.sort.import.scm \
699 chicken.string.import.scm \
700 chicken.tcp.import.scm
701chicken-uninstall.c: chicken-uninstall.scm \
702 chicken.file.import.scm \
703 chicken.fixnum.import.scm \
704 chicken.foreign.import.scm \
705 chicken.format.import.scm \
706 chicken.irregex.import.scm \
707 chicken.pathname.import.scm \
708 chicken.port.import.scm \
709 chicken.process.import.scm \
710 chicken.process-context.import.scm \
711 chicken.string.import.scm
712chicken-syntax.c: chicken-syntax.scm \
713 chicken.fixnum.import.scm \
714 chicken.platform.import.scm \
715 chicken.internal.import.scm
716srfi-4.c: srfi-4.scm \
717 chicken.bitwise.import.scm \
718 chicken.fixnum.import.scm \
719 chicken.foreign.import.scm \
720 chicken.gc.import.scm \
721 chicken.platform.import.scm
722posixunix.c: posixunix.scm \
723 chicken.bitwise.import.scm \
724 chicken.condition.import.scm \
725 chicken.foreign.import.scm \
726 chicken.memory.import.scm \
727 chicken.pathname.import.scm \
728 chicken.platform.import.scm \
729 chicken.port.import.scm \
730 chicken.process-context.import.scm \
731 chicken.time.import.scm
732posixwin.c: posixwin.scm \
733 chicken.condition.import.scm \
734 chicken.bitwise.import.scm \
735 chicken.foreign.import.scm \
736 chicken.memory.import.scm \
737 chicken.pathname.import.scm \
738 chicken.platform.import.scm \
739 chicken.port.import.scm \
740 chicken.process-context.import.scm \
741 chicken.string.import.scm \
742 chicken.time.import.scm
743data-structures.c: data-structures.scm \
744 chicken.condition.import.scm \
745 chicken.fixnum.import.scm \
746 chicken.foreign.import.scm
747expand.c: expand.scm \
748 chicken.blob.import.scm \
749 chicken.condition.import.scm \
750 chicken.fixnum.import.scm \
751 chicken.keyword.import.scm \
752 chicken.platform.import.scm \
753 chicken.string.import.scm \
754 chicken.internal.import.scm
755extras.c: extras.scm \
756 chicken.fixnum.import.scm \
757 chicken.string.import.scm \
758 chicken.time.import.scm
759eval.c: eval.scm \
760 chicken.blob.import.scm \
761 chicken.condition.import.scm \
762 chicken.fixnum.import.scm \
763 chicken.foreign.import.scm \
764 chicken.internal.import.scm \
765 chicken.keyword.import.scm \
766 chicken.syntax.import.scm \
767 chicken.platform.import.scm
768repl.c: repl.scm \
769 chicken.eval.import.scm
770file.c: file.scm \
771 chicken.condition.import.scm \
772 chicken.fixnum.import.scm \
773 chicken.io.import.scm \
774 chicken.irregex.import.scm \
775 chicken.foreign.import.scm \
776 chicken.pathname.import.scm \
777 chicken.process-context.import.scm
778lolevel.c: lolevel.scm \
779 chicken.fixnum.import.scm \
780 chicken.foreign.import.scm
781pathname.c: pathname.scm \
782 chicken.fixnum.import.scm \
783 chicken.irregex.import.scm \
784 chicken.platform.import.scm \
785 chicken.string.import.scm
786port.c: port.scm \
787 chicken.fixnum.import.scm \
788 chicken.io.import.scm
789read-syntax.c: read-syntax.scm \
790 chicken.internal.import.scm \
791 chicken.platform.import.scm
792tcp.c: tcp.scm \
793 chicken.fixnum.import.scm \
794 chicken.foreign.import.scm \
795 chicken.port.import.scm \
796 chicken.time.import.scm
797eval-modules.c: eval-modules.scm $(DYNAMIC_IMPORT_LIBRARIES:=.import.scm) \
798 $(foreach lib,$(DYNAMIC_CHICKEN_IMPORT_LIBRARIES),chicken.$(lib).import.scm) \
799 $(foreach lib,$(DYNAMIC_CHICKEN_UNIT_IMPORT_LIBRARIES),$(lib).c)
800continuation.c: continuation.scm \
801 chicken.fixnum.import.scm
802internal.c: internal.scm \
803 chicken.fixnum.import.scm
804irregex.c: irregex.scm \
805 chicken.fixnum.import.scm \
806 chicken.syntax.import.scm
807profiler.c: profiler.scm \
808 chicken.fixnum.import.scm
809stub.c: stub.scm \
810 chicken.platform.import.scm
811
812
813define profile-flags
814$(if $(filter $(basename $(1)),$(PROFILE_OBJECTS)),-profile)
815endef
816
817bootstrap-lib = $(CHICKEN) $(call profile-flags, $@) $< $(CHICKEN_LIBRARY_OPTIONS) -output-file $@
818
819library.c: $(SRCDIR)library.scm
820 $(bootstrap-lib) \
821 -no-module-registration \
822 -emit-import-library chicken.bitwise \
823 -emit-import-library chicken.blob \
824 -emit-import-library chicken.fixnum \
825 -emit-import-library chicken.flonum \
826 -emit-import-library chicken.gc \
827 -emit-import-library chicken.keyword \
828 -emit-import-library chicken.platform \
829 -emit-import-library chicken.plist \
830 -emit-import-library chicken.process-context
831internal.c: $(SRCDIR)internal.scm $(SRCDIR)mini-srfi-1.scm
832 $(bootstrap-lib) -emit-import-library chicken.internal
833eval.c: $(SRCDIR)eval.scm $(SRCDIR)common-declarations.scm $(SRCDIR)mini-srfi-1.scm
834 $(bootstrap-lib) \
835 -emit-import-library chicken.eval \
836 -emit-import-library chicken.load
837read-syntax.c: $(SRCDIR)read-syntax.scm $(SRCDIR)common-declarations.scm
838 $(bootstrap-lib) -emit-import-library chicken.read-syntax
839repl.c: $(SRCDIR)repl.scm $(SRCDIR)common-declarations.scm
840 $(bootstrap-lib) -emit-import-library chicken.repl
841expand.c: $(SRCDIR)expand.scm $(SRCDIR)synrules.scm $(SRCDIR)common-declarations.scm
842 $(bootstrap-lib) \
843 -no-module-registration
844modules.c: $(SRCDIR)modules.scm $(SRCDIR)common-declarations.scm $(SRCDIR)mini-srfi-1.scm
845 $(bootstrap-lib)
846extras.c: $(SRCDIR)extras.scm $(SRCDIR)common-declarations.scm
847 $(bootstrap-lib) \
848 -emit-import-library chicken.format \
849 -emit-import-library chicken.io \
850 -emit-import-library chicken.pretty-print \
851 -emit-import-library chicken.random
852posixunix.c: $(SRCDIR)posix.scm $(SRCDIR)posixunix.scm $(SRCDIR)posix-common.scm $(SRCDIR)common-declarations.scm
853 $(bootstrap-lib) -feature platform-unix \
854 -emit-import-library chicken.errno \
855 -emit-import-library chicken.file.posix \
856 -emit-import-library chicken.time.posix \
857 -emit-import-library chicken.process \
858 -emit-import-library chicken.process.signal \
859 -emit-import-library chicken.process-context.posix \
860 -no-module-registration
861posixwin.c: $(SRCDIR)posix.scm $(SRCDIR)posixwin.scm $(SRCDIR)posix-common.scm $(SRCDIR)common-declarations.scm
862 $(bootstrap-lib) -feature platform-windows \
863 -emit-import-library chicken.errno \
864 -emit-import-library chicken.file.posix \
865 -emit-import-library chicken.time.posix \
866 -emit-import-library chicken.process \
867 -emit-import-library chicken.process.signal \
868 -emit-import-library chicken.process-context.posix \
869 -no-module-registration
870irregex.c: $(SRCDIR)irregex.scm $(SRCDIR)irregex-core.scm $(SRCDIR)irregex-utils.scm $(SRCDIR)common-declarations.scm
871 $(bootstrap-lib) -emit-import-library chicken.irregex
872chicken-syntax.c: $(SRCDIR)chicken-syntax.scm $(SRCDIR)common-declarations.scm $(SRCDIR)mini-srfi-1.scm
873 $(bootstrap-lib)
874chicken-ffi-syntax.c: $(SRCDIR)chicken-ffi-syntax.scm $(SRCDIR)common-declarations.scm $(SRCDIR)mini-srfi-1.scm
875 $(bootstrap-lib)
876continuation.c: $(SRCDIR)continuation.scm $(SRCDIR)common-declarations.scm
877 $(bootstrap-lib) -emit-import-library chicken.continuation
878data-structures.c: $(SRCDIR)data-structures.scm $(SRCDIR)common-declarations.scm
879 $(bootstrap-lib) \
880 -emit-import-library chicken.sort \
881 -emit-import-library chicken.string
882pathname.c: $(SRCDIR)pathname.scm $(SRCDIR)common-declarations.scm
883 $(bootstrap-lib) -emit-import-library chicken.pathname
884port.c: $(SRCDIR)port.scm $(SRCDIR)common-declarations.scm
885 $(bootstrap-lib) -emit-import-library chicken.port
886file.c: $(SRCDIR)file.scm $(SRCDIR)common-declarations.scm
887 $(bootstrap-lib) -emit-import-library chicken.file
888lolevel.c: $(SRCDIR)lolevel.scm $(SRCDIR)common-declarations.scm
889 $(bootstrap-lib) \
890 -emit-import-library chicken.locative \
891 -emit-import-library chicken.memory \
892 -emit-import-library chicken.memory.representation
893tcp.c: $(SRCDIR)tcp.scm $(SRCDIR)common-declarations.scm
894 $(bootstrap-lib) -emit-import-library chicken.tcp
895srfi-4.c: $(SRCDIR)srfi-4.scm $(SRCDIR)common-declarations.scm
896 $(bootstrap-lib) -emit-import-library srfi-4
897scheduler.c: $(SRCDIR)scheduler.scm $(SRCDIR)common-declarations.scm
898 $(bootstrap-lib)
899profiler.c: $(SRCDIR)profiler.scm $(SRCDIR)common-declarations.scm
900 $(bootstrap-lib)
901stub.c: $(SRCDIR)stub.scm $(SRCDIR)common-declarations.scm
902 $(bootstrap-lib)
903debugger-client.c: $(SRCDIR)debugger-client.scm $(SRCDIR)common-declarations.scm dbg-stub.c
904 $(bootstrap-lib)
905build-version.c: $(SRCDIR)build-version.scm $(SRCDIR)buildversion buildbranch buildid
906 $(bootstrap-lib)
907eval-modules.c: $(SRCDIR)eval-modules.scm $(SRCDIR)common-declarations.scm
908 $(bootstrap-lib)
909
910define declare-bootstrap-import-lib
911$(1).import.c: $$(SRCDIR)$(1).import.scm
912 $$(CHICKEN) $$< $$(CHICKEN_IMPORT_LIBRARY_OPTIONS) -output-file $$@
913endef
914
915$(foreach obj, $(IMPORT_LIBRARIES),\
916 $(eval $(call declare-bootstrap-import-lib,$(obj))))
917
918# Bootstrap compiler objects
919
920define declare-bootstrap-compiler-object
921$(1).c: $$(SRCDIR)$(1).scm $$(SRCDIR)tweaks.scm
922 $$(CHICKEN) $$< $$(CHICKEN_PROGRAM_OPTIONS) -emit-import-library chicken.compiler.$(1) \
923 -output-file $$@
924endef
925
926$(foreach obj, $(COMPILER_OBJECTS_1),\
927 $(eval $(call declare-bootstrap-compiler-object,$(obj))))
928
929csi.c: $(SRCDIR)csi.scm $(SRCDIR)banner.scm $(SRCDIR)mini-srfi-1.scm
930 $(CHICKEN) $< $(CHICKEN_PROGRAM_OPTIONS) -output-file $@
931chicken-profile.c: $(SRCDIR)chicken-profile.scm $(SRCDIR)mini-srfi-1.scm
932 $(CHICKEN) $< $(CHICKEN_PROGRAM_OPTIONS) -output-file $@
933chicken-install.c: $(SRCDIR)chicken-install.scm $(SRCDIR)mini-srfi-1.scm $(SRCDIR)egg-compile.scm $(SRCDIR)egg-download.scm $(SRCDIR)egg-environment.scm $(SRCDIR)egg-information.scm
934 $(CHICKEN) $< $(CHICKEN_PROGRAM_OPTIONS) -output-file $@
935chicken-uninstall.c: $(SRCDIR)chicken-uninstall.scm $(SRCDIR)mini-srfi-1.scm $(SRCDIR)egg-environment.scm $(SRCDIR)egg-information.scm
936 $(CHICKEN) $< $(CHICKEN_PROGRAM_OPTIONS) -output-file $@
937chicken-status.c: $(SRCDIR)chicken-status.scm $(SRCDIR)mini-srfi-1.scm $(SRCDIR)egg-environment.scm $(SRCDIR)egg-information.scm
938 $(CHICKEN) $< $(CHICKEN_PROGRAM_OPTIONS) -output-file $@
939csc.c: $(SRCDIR)csc.scm $(SRCDIR)mini-srfi-1.scm $(SRCDIR)egg-environment.scm
940 $(CHICKEN) $< $(CHICKEN_PROGRAM_OPTIONS) -output-file $@
941
942# distribution files
943
944.PHONY: distfiles dist html
945
946distfiles: $(DISTFILES)
947
948dist: distfiles html
949 CSI=$(CSI) $(CSI) -s $(SRCDIR)scripts$(SEP)makedist.scm -platform $(PLATFORM) CHICKEN=$(CHICKEN)
950
951# Jim's `manual-labor' must be installed (just run "chicken-install manual-labor")
952html:
953 $(MAKEDIR_COMMAND) $(MAKEDIR_COMMAND_OPTIONS) $(SRCDIR)manual-html
954 manual-labor $(SRCDIR)manual $(SRCDIR)manual-html
955 $(COPY_COMMAND) $(SRCDIR)chicken.png manual-html
956 $(COPY_COMMAND) $(SRCDIR)manual.css manual-html
957 $(COPY_COMMAND) $(SRCDIR)index.html manual-html
958
959# cleaning up
960
961.PHONY: clean spotless confclean testclean
962
963BUILD_CONFIG_FILES = chicken-config.h chicken-defaults.h chicken-install.rc chicken-uninstall.rc
964
965clean:
966 -$(REMOVE_COMMAND) $(REMOVE_COMMAND_OPTIONS) $(PROGRAM_PREFIX)chicken$(PROGRAM_SUFFIX)$(EXE) $(PROGRAM_PREFIX)csi$(PROGRAM_SUFFIX)$(EXE) $(PROGRAM_PREFIX)csc$(PROGRAM_SUFFIX)$(EXE) \
967 $(CHICKEN_PROFILE_PROGRAM)$(EXE) \
968 $(CHICKEN_INSTALL_PROGRAM)$(EXE) \
969 $(CHICKEN_UNINSTALL_PROGRAM)$(EXE) \
970 $(CHICKEN_STATUS_PROGRAM)$(EXE) \
971 *$(O) \
972 $(CHICKEN_DO_PROGRAM)$(EXE) \
973 $(CHICKEN_DEBUGGER_PROGRAM) \
974 $(LIBCHICKEN_SO_FILE) \
975 $(PRIMARY_LIBCHICKEN) \
976 lib$(PROGRAM_PREFIX)chicken$(PROGRAM_SUFFIX)$(A) \
977 $(IMPORT_LIBRARIES:=.import.so) $(LIBCHICKEN_IMPORT_LIBRARY) \
978 $(foreach lib,$(DYNAMIC_IMPORT_LIBRARIES),chicken.$(lib).import.scm) \
979 $(BUILD_CONFIG_FILES)
980ifdef USES_SONAME
981 -$(REMOVE_COMMAND) $(REMOVE_COMMAND_OPTIONS) lib$(PROGRAM_PREFIX)chicken$(PROGRAM_SUFFIX).so.$(BINARYVERSION)
982endif
983
984confclean:
985 -$(REMOVE_COMMAND) $(REMOVE_COMMAND_OPTIONS) $(BUILD_CONFIG_FILES)
986
987spotless: clean testclean
988 -$(REMOVE_COMMAND) $(REMOVE_COMMAND_OPTIONS) $(DISTFILES) \
989 buildid buildbranch
990
991testclean:
992 -$(REMOVE_COMMAND) $(REMOVE_COMMAND_RECURSIVE_OPTIONS) \
993 $(SRCDIR)tests$(SEP)*.dll \
994 $(SRCDIR)tests$(SEP)*.import.scm \
995 $(SRCDIR)tests$(SEP)*.inline \
996 $(SRCDIR)tests$(SEP)*.link \
997 $(SRCDIR)tests$(SEP)*.o \
998 $(SRCDIR)tests$(SEP)*.obj \
999 $(SRCDIR)tests$(SEP)*.out \
1000 $(SRCDIR)tests$(SEP)*.profile \
1001 $(SRCDIR)tests$(SEP)*.redacted \
1002 $(SRCDIR)tests$(SEP)*.so \
1003 $(SRCDIR)tests$(SEP)tmp \
1004 $(SRCDIR)tests$(SEP)tmp.c \
1005 $(SRCDIR)tests$(SEP)empty-file \
1006 $(SRCDIR)tests$(SEP)null \
1007 $(SRCDIR)tests$(SEP)null.c \
1008 $(SRCDIR)tests$(SEP)null.exe \
1009 $(SRCDIR)tests$(SEP)test-repository \
1010 $(SRCDIR)tests$(SEP)redact-gensyms
1011
1012# run tests
1013
1014.PHONY: check
1015
1016export PROGRAM_PREFIX
1017export PROGRAM_SUFFIX
1018
1019check: $(TARGETS)
1020ifndef WINDOWS_SHELL
1021 cd tests; sh runtests.sh
1022else
1023 cd tests & runtests.bat
1024endif
1025
1026# benchmark
1027
1028.PHONY: bench
1029
1030bench: $(CHICKEN_SHARED_EXECUTABLE) $(CSI_SHARED_EXECUTABLE) $(CSC_PROGRAM)$(EXE)
1031 cd tests; echo >>bench.log; date >>bench.log; sh runbench.sh 2>&1 | tee -a bench.log
1032
1033
1034# build static bootstrapping chicken
1035
1036.PHONY: boot-chicken bootclean
1037
1038STAGE1_CONFIG = PLATFORM=$(PLATFORM) PREFIX=/nowhere CONFIG= \
1039 CHICKEN=$(CHICKEN) PROGRAM_SUFFIX=-boot-stage1 STATICBUILD=1 \
1040 C_COMPILER_OPTIMIZATION_OPTIONS="$(C_COMPILER_OPTIMIZATION_OPTIONS)" BUILDING_CHICKEN_BOOT=1
1041
1042BOOT_CONFIG = PLATFORM=$(PLATFORM) PREFIX=/nowhere CONFIG= \
1043 CHICKEN=.$(SEP)chicken-boot-stage1$(EXE) PROGRAM_SUFFIX=-boot \
1044 STATICBUILD=1 C_COMPILER_OPTIMIZATION_OPTIONS="$(C_COMPILER_OPTIMIZATION_OPTIONS)"
1045
1046boot-chicken:
1047 "$(MAKE)" $(STAGE1_CONFIG) confclean
1048 "$(MAKE)" $(STAGE1_CONFIG) chicken-boot-stage1$(EXE)
1049 "$(MAKE)" $(BOOT_CONFIG) touchfiles
1050 "$(MAKE)" $(BOOT_CONFIG) chicken-boot$(EXE)
1051 "$(MAKE)" $(BOOT_CONFIG) confclean
1052
1053bootclean:
1054 -$(REMOVE_COMMAND) $(REMOVE_COMMAND_OPTIONS) \
1055 $(SRCDIR)chicken-boot$(EXE) \
1056 $(SRCDIR)chicken-boot-stage1$(EXE) \
1057 $(SRCDIR)libchicken-boot$(A) \
1058 $(SRCDIR)libchicken-boot-stage1$(A)
1059
1060.PHONY: touchfiles
1061
1062touchfiles:
1063ifdef WINDOWS_SHELL
1064 for %%x in (*.scm) do copy /b %%x +,,
1065else
1066 touch *.scm
1067endif