1 | |
---|
2 | ;; |
---|
3 | ;; Chicken make file. |
---|
4 | ;; |
---|
5 | ;; Copyright 2008 The Chicken Team. |
---|
6 | ;; |
---|
7 | ;; Redistribution and use in source and binary forms, with or without |
---|
8 | ;; modification, are permitted provided that the following |
---|
9 | ;; conditions are met: |
---|
10 | ;; |
---|
11 | ;; Redistributions of source code must retain the above copyright |
---|
12 | ;; notice, this list of conditions and the following disclaimer. |
---|
13 | ;; |
---|
14 | ;; Redistributions in binary form must reproduce the above copyright |
---|
15 | ;; notice, this list of conditions and the following disclaimer in |
---|
16 | ;; the documentation and/or other materials provided with the |
---|
17 | ;; distribution. |
---|
18 | ;; |
---|
19 | ;; Neither the name of the author nor the names of its contributors |
---|
20 | ;; may be used to endorse or promote products derived from this |
---|
21 | ;; software without specific prior written permission. |
---|
22 | ;; |
---|
23 | ;; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
---|
24 | ;; "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
---|
25 | ;; LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
---|
26 | ;; FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
---|
27 | ;; COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, |
---|
28 | ;; INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
---|
29 | ;; (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
---|
30 | ;; SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
---|
31 | ;; HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, |
---|
32 | ;; STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
---|
33 | ;; ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
---|
34 | ;; OF THE POSSIBILITY OF SUCH DAMAGE. |
---|
35 | ;; |
---|
36 | ;; |
---|
37 | |
---|
38 | (declare (run-time-macros) |
---|
39 | (disable-interrupts) |
---|
40 | (uses library eval extras ) |
---|
41 | (foreign-declare #<<EOF |
---|
42 | |
---|
43 | |
---|
44 | #include <errno.h> |
---|
45 | #include <stdio.h> |
---|
46 | #include <unistd.h> |
---|
47 | |
---|
48 | #include <sys/types.h> |
---|
49 | #include <sys/stat.h> |
---|
50 | |
---|
51 | #define open_binary_input_pipe(a, n, name) C_mpointer(a, popen(C_c_string(name), "r")) |
---|
52 | #define open_text_input_pipe(a, n, name) open_binary_input_pipe(a, n, name) |
---|
53 | #define open_binary_output_pipe(a, n, name) C_mpointer(a, popen(C_c_string(name), "w")) |
---|
54 | #define open_text_output_pipe(a, n, name) open_binary_output_pipe(a, n, name) |
---|
55 | #define close_pipe(p) C_fix(pclose(C_port_file(p))) |
---|
56 | |
---|
57 | #define C_set_file_ptr(port, ptr) (C_set_block_item(port, 0, (C_block_item(ptr, 0))), C_SCHEME_UNDEFINED) |
---|
58 | #define C_curdir(buf) (getcwd(C_c_string(buf), 256) ? C_fix(strlen(C_c_string(buf))) : C_SCHEME_FALSE) |
---|
59 | |
---|
60 | #define C_stat(fn) C_fix(stat((char *)C_data_pointer(fn), &C_statbuf)) |
---|
61 | #define C_lstat(fn) C_fix(lstat((char *)C_data_pointer(fn), &C_statbuf)) |
---|
62 | #define C_fstat(f) C_fix(fstat(C_unfix(f), &C_statbuf)) |
---|
63 | |
---|
64 | static C_TLS struct stat C_statbuf; |
---|
65 | |
---|
66 | EOF |
---|
67 | )) |
---|
68 | |
---|
69 | (include "chicken-more-macros.scm") |
---|
70 | (include "args.scm") |
---|
71 | (include "cmk-utils.scm") |
---|
72 | |
---|
73 | (define run-verbose (make-parameter #f)) |
---|
74 | (define print-rules (make-parameter #f)) |
---|
75 | |
---|
76 | (define opts |
---|
77 | `( |
---|
78 | ,(args:make-option (debug-build) #:none |
---|
79 | "specify that a debug version of Chicken is built") |
---|
80 | ,(args:make-option (static-build) #:none |
---|
81 | "specify that a static version of Chicken is built") |
---|
82 | ,(args:make-option (platform) (required: "PLATFORM") |
---|
83 | "target platform" |
---|
84 | ($ arg)) |
---|
85 | ,(args:make-option (host-system) (required: "NAME") |
---|
86 | "host system prefix" |
---|
87 | ($ arg)) |
---|
88 | ,(args:make-option (program-prefix) (required: "NAME") |
---|
89 | "prefix for the names of Chicken executables" |
---|
90 | ($ arg)) |
---|
91 | ,(args:make-option (program-suffix) (required: "NAME") |
---|
92 | "suffix for the names of Chicken executables" |
---|
93 | ($ arg)) |
---|
94 | |
---|
95 | ,(args:make-option (assembler) (required: "NAME") |
---|
96 | "assembler command (default is gcc)") |
---|
97 | ,(args:make-option (c-compiler) (required: "NAME") |
---|
98 | "path to C compiler (default is gcc)") |
---|
99 | ,(args:make-option (cxx-compiler) (required: "NAME") |
---|
100 | "path to C++ compiler (default is g++)") |
---|
101 | ,(args:make-option (librarian) (required: "NAME") |
---|
102 | "archiver command (default is ar)") |
---|
103 | ,(args:make-option (linker) (required: "NAME") |
---|
104 | "linker command (default is gcc)") |
---|
105 | ,(args:make-option (makeinfo) (required: "NAME") |
---|
106 | "makeinfo command (default is makeinfo)") |
---|
107 | ,(args:make-option (remove-command) (required: "NAME") |
---|
108 | "file removal command (default is rm (POSIX) or del (Windows))") |
---|
109 | ,(args:make-option (install-command) (required: "NAME") |
---|
110 | "file install command (default is install (POSIX) or copy (Windows))") |
---|
111 | ,(args:make-option (makedir-command) (required: "NAME") |
---|
112 | "directory creation command (default is mkdir)") |
---|
113 | ,(args:make-option (prefix) (required: "DIR") |
---|
114 | "installation prefix") |
---|
115 | ,(args:make-option (dest-dir) (required: "DIR") |
---|
116 | "destination directory for installation") |
---|
117 | ,(args:make-option (src-dir) (required: "DIR") |
---|
118 | "directory where the Chicken source tree is located") |
---|
119 | ,(args:make-option (symbol-gc) #:none |
---|
120 | "always enable garbage collection for unused symbols") |
---|
121 | ,(args:make-option (no-apply-hook) #:none |
---|
122 | "disable support for breakpoints (and speed up procedure invocation)") |
---|
123 | ,(args:make-option (use-host-pcre) #:none |
---|
124 | "use PCRE installed on host system") |
---|
125 | ,(args:make-option (v verbose) #:none |
---|
126 | "Print each command before it is executed" |
---|
127 | (run-verbose #t)) |
---|
128 | ,(args:make-option (p print-rules) #:none |
---|
129 | "Print all make rules and exit" |
---|
130 | (print-rules #t)) |
---|
131 | ,(args:make-option (h help) #:none "Print help and exit" |
---|
132 | (usage)) |
---|
133 | |
---|
134 | )) |
---|
135 | |
---|
136 | |
---|
137 | ;; Use args:usage to generate a formatted list of options (from OPTS), |
---|
138 | ;; suitable for embedding into help text. |
---|
139 | (define (usage) |
---|
140 | (print "Usage: " (car (argv)) " [options...] <target> ") |
---|
141 | (newline) |
---|
142 | (print "Where <target> can be one of: " ) |
---|
143 | (newline) |
---|
144 | (for-each (lambda (x) (print " " x)) |
---|
145 | `(all clean distclean spotless install uninstall |
---|
146 | confclean check fullcheck dist libs install-libs bootstrap)) |
---|
147 | (newline) |
---|
148 | (print "The following options are recognized: ") |
---|
149 | (newline) |
---|
150 | (print (parameterize ((args:indent 5) (args:width 30)) (args:usage opts))) |
---|
151 | |
---|
152 | (exit 1)) |
---|
153 | |
---|
154 | |
---|
155 | ;; Process arguments and collate options and arguments into OPTIONS |
---|
156 | ;; alist, and operands (filenames) into OPERANDS. |
---|
157 | (define args (command-line-arguments)) |
---|
158 | (set!-values (options operands) (args:parse args opts)) |
---|
159 | |
---|
160 | |
---|
161 | (define (compute-rules options) |
---|
162 | |
---|
163 | (if (not (or (getenv "PLATFORM") (alist-ref 'platform options))) |
---|
164 | (begin |
---|
165 | (print "No platform given." nl) |
---|
166 | (print "Please select your target platform by running one of the following commands:" nl) |
---|
167 | (print "chicken-build --platform=linux " ) |
---|
168 | (print "chicken-build --platform=bsd") |
---|
169 | (print "chicken-build --platform=macosx") |
---|
170 | (print "chicken-build --platform=mingw-msys") |
---|
171 | (print "chicken-build --platform=mingw") |
---|
172 | (print "chicken-build --platform=cygwin") |
---|
173 | (print "chicken-build --platform=solaris") |
---|
174 | (print "chicken-build --platform=msvc") |
---|
175 | (print nl) |
---|
176 | (print "For more information, consult the README file." nl) |
---|
177 | (exit 1))) |
---|
178 | |
---|
179 | |
---|
180 | ;; Basic platform configuration |
---|
181 | |
---|
182 | (define platform ($ (or (getenv "PLATFORM") (lookup-def 'platform options))) ) |
---|
183 | |
---|
184 | (define arch-value (make-parameter #f)) |
---|
185 | |
---|
186 | (define (arch) |
---|
187 | (if (not (arch-value)) |
---|
188 | (arch-value |
---|
189 | (case platform |
---|
190 | ((linux bsd macosx solaris) |
---|
191 | ($ (ipipe read-line (sh ,(source-path "config-arch.sh"))))) |
---|
192 | (else "x86")))) |
---|
193 | (arch-value)) |
---|
194 | |
---|
195 | (define needs-relinking? |
---|
196 | (make-parameter |
---|
197 | (case platform |
---|
198 | ((linux) #t) |
---|
199 | (else #f)))) |
---|
200 | |
---|
201 | ;; Runtime parameters |
---|
202 | |
---|
203 | (define binary-version 3) |
---|
204 | (define stack-direction (make-parameter 1)) |
---|
205 | |
---|
206 | ;; Directories |
---|
207 | |
---|
208 | (define src-dir (or (getenv "SRCDIR") (lookup-def 'src-dir options) ".")) |
---|
209 | (define dest-dir (or (getenv "DESTDIR") (lookup-def 'dest-dir options) "")) |
---|
210 | |
---|
211 | (define prefix (make-parameter (or (getenv "PREFIX") (lookup-def 'prefix options) |
---|
212 | (case platform |
---|
213 | ((mingw-msys) "c:/devtools") |
---|
214 | ((mingw) "c:\\devtools") |
---|
215 | (else "/usr/local"))))) |
---|
216 | |
---|
217 | (define bin-dir (make-parameter (make-pathname (prefix) "bin"))) |
---|
218 | (define lib-dir (make-parameter (make-pathname (prefix) "lib"))) |
---|
219 | (define chicken-lib-dir (make-parameter (make-pathname (lib-dir) "chicken"))) |
---|
220 | (define inc-dir (make-parameter (make-pathname (prefix) "include"))) |
---|
221 | (define egg-dir (make-parameter (make-pathname (chicken-lib-dir) (->string binary-version)))) |
---|
222 | |
---|
223 | (define share-dir (make-parameter (make-pathname (prefix) "share"))) |
---|
224 | (define data-dir (make-parameter (make-pathname (share-dir) "chicken"))) |
---|
225 | (define doc-dir (make-parameter (make-pathname (data-dir) "doc"))) |
---|
226 | (define top-man-dir (make-parameter (make-pathname (share-dir) "man"))) |
---|
227 | (define man-dir (make-parameter (make-pathname (top-man-dir) "man1"))) |
---|
228 | (define info-dir (make-parameter (make-pathname (share-dir) "info"))) |
---|
229 | |
---|
230 | (define (source-path x) |
---|
231 | (make-pathname src-dir (->string x))) |
---|
232 | |
---|
233 | (define (pcre-source-path x) |
---|
234 | (make-pathname src-dir (make-pathname "pcre" (->string x)))) |
---|
235 | |
---|
236 | (define (dest-path x) |
---|
237 | (if (zero? (string-length dest-dir)) (->string x) |
---|
238 | (make-pathname dest-dir (->string x)))) |
---|
239 | |
---|
240 | |
---|
241 | ;; Build parameters |
---|
242 | |
---|
243 | (define nursery (make-parameter |
---|
244 | (case (arch) |
---|
245 | ((x86-64) (* 256 1024)) |
---|
246 | (else (* 128 1024))))) |
---|
247 | |
---|
248 | (define debug-build? (assoc 'debug-build options)) |
---|
249 | (define symbol-gc? (or (getenv "SYMBOLGC") (assoc 'symbol-gc options))) |
---|
250 | (define no-apply-hook? (or (getenv "NOAPPLYHOOK") (assoc 'no-apply-hook options))) |
---|
251 | (define hacked-apply? (make-parameter #t)) |
---|
252 | |
---|
253 | ;; Commands |
---|
254 | |
---|
255 | (define host-system (or (getenv "HOSTSYSTEM") (lookup-def 'host-system options))) |
---|
256 | |
---|
257 | (define c-compiler (or (getenv "C_COMPILER") (lookup-def 'c-compiler options) |
---|
258 | (pcmd$ host-system "gcc"))) |
---|
259 | (define cxx-compiler (or (getenv "CXX_COMPILER") (lookup-def 'cxx-compiler options) |
---|
260 | (pcmd$ host-system "g++"))) |
---|
261 | (define librarian (or (getenv "LIBRARIAN") (lookup-def 'librarian options) |
---|
262 | (pcmd$ host-system "ar"))) |
---|
263 | (define linker (or (getenv "LINKER") (lookup-def 'linker options) |
---|
264 | c-compiler)) |
---|
265 | |
---|
266 | (define assembler (or (getenv "ASSEMBLER") (lookup-def 'assembler options) |
---|
267 | c-compiler)) |
---|
268 | (define makeinfo (or (getenv "MAKEINFO") (lookup-def 'makeinfo options) |
---|
269 | "makeinfo")) |
---|
270 | |
---|
271 | (define remove-command (or (getenv "REMOVE_COMMAND") (lookup-def 'remove-command options) |
---|
272 | (case platform |
---|
273 | ((mingw) "del") |
---|
274 | (else "rm")))) |
---|
275 | (define install-command (or (getenv "INSTALL_COMMAND") (lookup-def 'install-command options) |
---|
276 | (case platform |
---|
277 | ((mingw) "copy") |
---|
278 | (else "install")))) |
---|
279 | (define makedir-command (or (getenv "MAKEDIR_COMMAND") (lookup-def 'makedir-command options) |
---|
280 | "mkdir")) |
---|
281 | |
---|
282 | (define install-info-command (or (getenv "INSTALL_INFO_COMMAND") |
---|
283 | (lookup-def 'install-info-command options) |
---|
284 | "install-info")) |
---|
285 | |
---|
286 | (define uninstall-info-command (or (getenv "UNINSTALL_INFO_COMMAND") |
---|
287 | (lookup-def 'uninstall-info-command options) |
---|
288 | "uninstall-info")) |
---|
289 | |
---|
290 | (define postinstall-static-library (make-parameter #f)) |
---|
291 | (define postinstall-program (make-parameter #f)) |
---|
292 | (define postinstall-program-flags (make-parameter #f)) |
---|
293 | |
---|
294 | ;; Compiler- and linker-related options |
---|
295 | |
---|
296 | (define libraries (make-parameter (list))) |
---|
297 | (define includes (make-parameter (list "-I." (s+ "-I" src-dir)))) |
---|
298 | |
---|
299 | (define target-libraries (make-parameter (lambda () (pv libraries)))) |
---|
300 | |
---|
301 | (define soname-version |
---|
302 | (make-parameter "")) |
---|
303 | |
---|
304 | (define c-compiler-options |
---|
305 | (make-parameter (list))) |
---|
306 | |
---|
307 | (define c-compiler-optimization-options |
---|
308 | (make-parameter (list))) |
---|
309 | |
---|
310 | (define c-compiler-compile-option |
---|
311 | (make-parameter "-c")) |
---|
312 | |
---|
313 | (define c-compiler-output-option |
---|
314 | (make-parameter "-o")) |
---|
315 | |
---|
316 | (define (c-compiler-output x) |
---|
317 | (s+ (c-compiler-output-option) " " x)) |
---|
318 | |
---|
319 | (define c-compiler-build-runtime-options |
---|
320 | (make-parameter (list "-DC_BUILDING_LIBCHICKEN"))) |
---|
321 | |
---|
322 | (define c-compiler-build-unsafe-runtime-options |
---|
323 | (make-parameter (lambda () (append (pv c-compiler-build-runtime-options) |
---|
324 | (list "-DNDEBUG" "-DC_UNSAFE_RUNTIME"))))) |
---|
325 | |
---|
326 | (define c-compiler-shared-options |
---|
327 | (make-parameter (list "-fPIC" "-DPIC"))) |
---|
328 | |
---|
329 | (define runtime-linker-path |
---|
330 | (make-parameter (current-directory))) |
---|
331 | |
---|
332 | (define linker-link-shared-library-extra-options |
---|
333 | (make-parameter (lambda (x) (list)))) |
---|
334 | |
---|
335 | (define linker-link-shared-library-options |
---|
336 | (make-parameter (list))) |
---|
337 | |
---|
338 | (define linker-link-shared-program-options |
---|
339 | (make-parameter (list))) |
---|
340 | |
---|
341 | (define linker-executable-options |
---|
342 | (make-parameter (list "-L."))) |
---|
343 | |
---|
344 | (define linker-static-options |
---|
345 | (make-parameter linker-executable-options)) |
---|
346 | |
---|
347 | (define linker-options |
---|
348 | (make-parameter (list))) |
---|
349 | |
---|
350 | (define linker-output-option |
---|
351 | (make-parameter "-o")) |
---|
352 | |
---|
353 | (define (linker-output x) |
---|
354 | (s+ (linker-output-option) " " x)) |
---|
355 | |
---|
356 | (define linker-library-option |
---|
357 | (make-parameter (list "-l"))) |
---|
358 | |
---|
359 | (define static-build? |
---|
360 | (make-parameter (or (getenv "STATICBUILD") (lookup-def 'static-build options)))) |
---|
361 | |
---|
362 | (define linker-library-prefix |
---|
363 | (make-parameter (if (pv static-build?) "lib" "-l"))) |
---|
364 | |
---|
365 | (define linker-library-suffix |
---|
366 | (make-parameter (if (pv static-build?) ".a" ""))) |
---|
367 | |
---|
368 | |
---|
369 | ;; Helper program options |
---|
370 | |
---|
371 | (define librarian-options |
---|
372 | (make-parameter (list "cru"))) |
---|
373 | |
---|
374 | (define librarian-output-option |
---|
375 | (make-parameter "")) |
---|
376 | |
---|
377 | (define (librarian-output x) |
---|
378 | (s+ (librarian-output-option) " " x)) |
---|
379 | |
---|
380 | (define remove-command-options |
---|
381 | (make-parameter (list "-f"))) |
---|
382 | |
---|
383 | (define remove-command-recursive-options |
---|
384 | (make-parameter (list "-fr"))) |
---|
385 | |
---|
386 | (define make-writable-command |
---|
387 | (make-parameter "chmod 0755")) |
---|
388 | |
---|
389 | (define makeinfo-options |
---|
390 | (make-parameter (list "--no-split"))) |
---|
391 | |
---|
392 | (define install-program-shared-library-options |
---|
393 | (make-parameter (list))) |
---|
394 | |
---|
395 | (define install-program-static-library-options |
---|
396 | (make-parameter (list))) |
---|
397 | |
---|
398 | (define install-program-executable-options |
---|
399 | (make-parameter (list))) |
---|
400 | |
---|
401 | (define install-program-file-options |
---|
402 | (make-parameter (list))) |
---|
403 | |
---|
404 | (define makedir-command-options |
---|
405 | (make-parameter (list))) |
---|
406 | |
---|
407 | (define assembler-options |
---|
408 | (make-parameter c-compiler-options)) |
---|
409 | |
---|
410 | (define assembler-output-option |
---|
411 | (make-parameter "-o")) |
---|
412 | |
---|
413 | (define (assembler-output x) |
---|
414 | (s+ (assembler-output-option) " " x)) |
---|
415 | |
---|
416 | (define assembler-compile-option |
---|
417 | (make-parameter "-c")) |
---|
418 | |
---|
419 | (define uninstallinfo-program-options |
---|
420 | (make-parameter (list "--delete"))) |
---|
421 | |
---|
422 | |
---|
423 | ;; Other settings |
---|
424 | |
---|
425 | (define no-unix-shell? (make-parameter #f)) |
---|
426 | (define dlls-in-path? (make-parameter #f)) |
---|
427 | (define clean-mingw-libs (make-parameter (list))) |
---|
428 | |
---|
429 | (define hostname (make-parameter "")) |
---|
430 | (define build-time (make-parameter "")) |
---|
431 | (define uname-sys (make-parameter "")) |
---|
432 | |
---|
433 | (define build-tag |
---|
434 | (make-parameter (lambda () (s+ "compiled " (pv build-time) " on " (pv hostname) " " "(" (pv uname-sys) ")")))) |
---|
435 | |
---|
436 | (define lock-to-space? |
---|
437 | (or (getenv "LOCKTOSPACE") (lookup-def 'lock-tospace options))) |
---|
438 | |
---|
439 | (if lock-to-space? |
---|
440 | (c-compiler-build-runtime-options |
---|
441 | (cons "-DC_LOCK_TOSPACE" (pv c-compiler-build-runtime-options)))) |
---|
442 | |
---|
443 | (define no-ptables? |
---|
444 | (or (getenv "NOPTABLES") (lookup-def 'no-ptables options))) |
---|
445 | |
---|
446 | (define c-compiler-ptables-options |
---|
447 | (make-parameter (if (not no-ptables?) (list "-DC_ENABLE_PTABLES") (list)))) |
---|
448 | |
---|
449 | ;; Program prefix and suffix |
---|
450 | |
---|
451 | (define program-prefix (or (lookup-def 'program-prefix options) "")) |
---|
452 | (define program-suffix (or (lookup-def 'program-suffix options) "")) |
---|
453 | |
---|
454 | ;; File extensions |
---|
455 | |
---|
456 | (define O (make-parameter ".o")) |
---|
457 | (define A (make-parameter ".a")) |
---|
458 | (define SO (make-parameter ".so")) |
---|
459 | (define ASM (make-parameter ".s")) |
---|
460 | (define EXE (make-parameter "")) |
---|
461 | |
---|
462 | ;; Special files |
---|
463 | |
---|
464 | (define posix-file (make-parameter "posixunix")) |
---|
465 | (define chicken_config_h-file "chicken-config.h") |
---|
466 | |
---|
467 | (define apply-hack-src (make-parameter (s+ "apply-hack." (arch) (pv ASM)))) |
---|
468 | (define apply-hack-object (make-parameter (s+ "apply-hack." (arch) (pv O)))) |
---|
469 | |
---|
470 | ;; Bootstrapping compiler |
---|
471 | |
---|
472 | (define chicken-bootstrap (make-parameter (lambda () (s+ "chicken" (pv EXE))))) |
---|
473 | |
---|
474 | ;; Scheme compiler flags |
---|
475 | |
---|
476 | (define chicken-options |
---|
477 | (make-parameter (lambda () (list "-quiet" "-no-trace" "-optimize-level 2" |
---|
478 | "-include-path ." (s+ "-include-path " src-dir))))) |
---|
479 | |
---|
480 | (define (chicken-library-options ) |
---|
481 | (cons "-explicit-use" (pv chicken-options))) |
---|
482 | |
---|
483 | (define (chicken-program-options ) |
---|
484 | (cons "-no-lambda-info" (pv chicken-options))) |
---|
485 | |
---|
486 | (define (chicken-compiler-options ) |
---|
487 | (cons "-extend private-namespace.scm" (chicken-program-options))) |
---|
488 | |
---|
489 | (define (chicken-unsafe-options) |
---|
490 | (list "-unsafe" "-no-lambda-info")) |
---|
491 | |
---|
492 | |
---|
493 | ;; PCRE-specific setup |
---|
494 | |
---|
495 | (define use-host-pcre? |
---|
496 | (or (getenv "USE_HOST_PCRE") |
---|
497 | (assoc 'use-host-pcre options))) |
---|
498 | |
---|
499 | (define pcre-dir |
---|
500 | (make-parameter (source-path "pcre"))) |
---|
501 | |
---|
502 | (define pcre-includes |
---|
503 | (make-parameter (lambda () (cons (s+ "-I" (pv pcre-dir)) (pv includes))))) |
---|
504 | |
---|
505 | (define pcre-c-compiler-options |
---|
506 | (make-parameter (list "-DPCRE_STATIC" "-DHAVE_CONFIG_H"))) |
---|
507 | |
---|
508 | (define chicken-pcre-library-options |
---|
509 | (make-parameter (list (s+ "-include-path " (pv pcre-dir))))) |
---|
510 | |
---|
511 | (if use-host-pcre? |
---|
512 | (chicken-pcre-library-options (list)) |
---|
513 | (includes (cons (s+ "-I" (pv pcre-dir)) (pv includes)))) |
---|
514 | |
---|
515 | |
---|
516 | ;; Platform-specific configuration |
---|
517 | |
---|
518 | (case platform |
---|
519 | ((linux) (begin |
---|
520 | (libraries |
---|
521 | (append (list "-lm" "-ldl") |
---|
522 | (pv libraries))) |
---|
523 | |
---|
524 | (c-compiler-options |
---|
525 | (append (list "-fno-strict-aliasing" "-DHAVE_CHICKEN_CONFIG_H") |
---|
526 | (pv c-compiler-options))) |
---|
527 | |
---|
528 | (c-compiler-optimization-options |
---|
529 | (append (if debug-build? |
---|
530 | (list "-g" "-Wall" "-Wno-unused") |
---|
531 | (list "-Os" "-fomit-frame-pointer")) |
---|
532 | (pv c-compiler-optimization-options))) |
---|
533 | |
---|
534 | (soname-version (s+ "." binary-version)) |
---|
535 | |
---|
536 | (linker-link-shared-library-options (list "-shared")) |
---|
537 | |
---|
538 | (runtime-linker-path (ipipe read-line (pwd))) |
---|
539 | |
---|
540 | (linker-link-shared-program-options |
---|
541 | (list (s+ "-Wl,-R" (pv runtime-linker-path)))) |
---|
542 | |
---|
543 | )) |
---|
544 | |
---|
545 | ((bsd) (begin |
---|
546 | (libraries |
---|
547 | (append (list "-lm" ) |
---|
548 | (pv libraries))) |
---|
549 | |
---|
550 | (c-compiler-options |
---|
551 | (append (list "-fno-strict-aliasing" "-DHAVE_CHICKEN_CONFIG_H") |
---|
552 | (pv c-compiler-options))) |
---|
553 | |
---|
554 | (c-compiler-optimization-options |
---|
555 | (append (if debug-build? |
---|
556 | (list "-g" "-Wall" "-Wno-unused") |
---|
557 | (list "-Os" "-fomit-frame-pointer")) |
---|
558 | (pv c-compiler-optimization-options))) |
---|
559 | |
---|
560 | (linker-link-shared-library-options (list "-shared")) |
---|
561 | |
---|
562 | (linker-link-shared-program-options |
---|
563 | (list (s+ "-Wl,-R" (pv runtime-linker-path)))) |
---|
564 | |
---|
565 | )) |
---|
566 | |
---|
567 | ((cygwin) (begin |
---|
568 | (libraries |
---|
569 | (append (list "-lm" ) |
---|
570 | (pv libraries))) |
---|
571 | |
---|
572 | (dlls-in-path? #t) |
---|
573 | (SO ".dll") |
---|
574 | (EXE ".exe") |
---|
575 | |
---|
576 | (c-compiler-options |
---|
577 | (append (list "-fno-strict-aliasing" "-DHAVE_CHICKEN_CONFIG_H") |
---|
578 | (pv c-compiler-options))) |
---|
579 | |
---|
580 | (c-compiler-optimization-options |
---|
581 | (append (if debug-build? |
---|
582 | (list "-g" "-Wall" "-Wno-unused") |
---|
583 | (list "-Os" )) |
---|
584 | (pv c-compiler-optimization-options))) |
---|
585 | |
---|
586 | (c-compiler-shared-options |
---|
587 | (cons "-DPIC" (pv c-compiler-shared-options))) |
---|
588 | |
---|
589 | (linker-link-shared-library-options (list "-shared")) |
---|
590 | |
---|
591 | (linker-link-shared-program-options |
---|
592 | (list "-Wl,--dll-search-prefix=cyg" "-Wl,--export-dynamic" )) |
---|
593 | |
---|
594 | )) |
---|
595 | |
---|
596 | ((macosx) (begin |
---|
597 | (SO ".dylib") |
---|
598 | |
---|
599 | (postinstall-program "install_name_tool") |
---|
600 | |
---|
601 | (c-compiler-options |
---|
602 | (append (list "-no-cpp-precomp" "-fno-common" |
---|
603 | "-fno-strict-aliasing" "-DHAVE_CHICKEN_CONFIG_H") |
---|
604 | (pv c-compiler-options))) |
---|
605 | |
---|
606 | (c-compiler-optimization-options |
---|
607 | (append (if debug-build? |
---|
608 | (list "-g" "-Wall" "-Wno-unused") |
---|
609 | (list "-Os" "-fomit-frame-pointer" )) |
---|
610 | (pv c-compiler-optimization-options))) |
---|
611 | |
---|
612 | (linker-link-shared-library-options |
---|
613 | (list "-dynamiclib" "-compatibility_version 1" |
---|
614 | "-current_version 1.0" )) |
---|
615 | |
---|
616 | (postinstall-program-flags |
---|
617 | (list (s+ "-change libchicken" (pv SO)) |
---|
618 | (make-pathname (pv lib-dir) (s+ "libchicken" (pv SO))))) |
---|
619 | |
---|
620 | (librarian-options (list "scru")) |
---|
621 | |
---|
622 | (case (arch) |
---|
623 | ((x86-64) |
---|
624 | (begin (c-compiler-options (cons "-m64" (pv c-compiler-options))) |
---|
625 | (linker-options (cons "-m64" (pv linker-options))))) |
---|
626 | |
---|
627 | ((universal) |
---|
628 | (c-compiler-options |
---|
629 | (append (list "-arch ppc" "-arch i386" "-isysroot /Developer/SDKs/MacOSX10.4u.sdk" |
---|
630 | (pv c-compiler-options)))) |
---|
631 | (linker-options |
---|
632 | (append (list "-arch ppc" "-arch i386" "-isysroot /Developer/SDKs/MacOSX10.4u.sdk" |
---|
633 | (pv linker-options)))))) |
---|
634 | |
---|
635 | )) |
---|
636 | |
---|
637 | ((mingw) (begin |
---|
638 | (no-unix-shell? #t) |
---|
639 | (dlls-in-path? #t) |
---|
640 | |
---|
641 | (clean-mingw-libs (list "libchickengui.a" "libchickengui.dll" "libchickengui.dll.a")) |
---|
642 | |
---|
643 | (SO ".dll") |
---|
644 | (EXE ".exe") |
---|
645 | |
---|
646 | |
---|
647 | (libraries (append (list "-lm" "-lws2_32") (pv libraries))) |
---|
648 | |
---|
649 | (c-compiler-options |
---|
650 | (append (list "-fno-strict-aliasing" "-DHAVE_CHICKEN_CONFIG_H") |
---|
651 | (pv c-compiler-options))) |
---|
652 | |
---|
653 | (c-compiler-optimization-options |
---|
654 | (append (if debug-build? |
---|
655 | (list "-g" "-Wall" "-Wno-unused") |
---|
656 | (list "-Os" )) |
---|
657 | (pv c-compiler-optimization-options))) |
---|
658 | |
---|
659 | (c-compiler-shared-options |
---|
660 | (cons "-DPIC" (pv c-compiler-shared-options))) |
---|
661 | |
---|
662 | (c-compiler-gui-runtime-options |
---|
663 | (cons "-DPIC" (pv c-compiler-gui-runtime-options))) |
---|
664 | |
---|
665 | (linker-link-shared-library-options (list "-shared")) |
---|
666 | |
---|
667 | (linker-link-shared-program-options |
---|
668 | (list "-Wl,--dll-search-prefix=cyg" "-Wl,--export-dynamic" )) |
---|
669 | |
---|
670 | )) |
---|
671 | |
---|
672 | ((mingw-msys) (begin |
---|
673 | (dlls-in-path? #t) |
---|
674 | |
---|
675 | (clean-mingw-libs (list "libchickengui.a" "libchickengui.dll" "libchickengui.dll.a")) |
---|
676 | |
---|
677 | (SO ".dll") |
---|
678 | (EXE ".exe") |
---|
679 | |
---|
680 | |
---|
681 | (libraries (append (list "-lm" "-lws2_32") (pv libraries))) |
---|
682 | |
---|
683 | (c-compiler-options |
---|
684 | (append (list "-fno-strict-aliasing" "-DHAVE_CHICKEN_CONFIG_H") |
---|
685 | (pv c-compiler-options))) |
---|
686 | |
---|
687 | (c-compiler-optimization-options |
---|
688 | (append (if debug-build? |
---|
689 | (list "-g" "-Wall" "-Wno-unused") |
---|
690 | (list "-Os" )) |
---|
691 | (pv c-compiler-optimization-options))) |
---|
692 | |
---|
693 | (c-compiler-shared-options |
---|
694 | (cons "-DPIC" (pv c-compiler-shared-options))) |
---|
695 | |
---|
696 | (c-compiler-gui-runtime-options |
---|
697 | (cons "-DPIC" (pv c-compiler-gui-runtime-options))) |
---|
698 | |
---|
699 | (linker-link-shared-library-options (list "-shared")) |
---|
700 | |
---|
701 | (linker-link-shared-program-options |
---|
702 | (list "-Wl,--dll-search-prefix=cyg" "-Wl,--export-dynamic" )) |
---|
703 | |
---|
704 | )) |
---|
705 | |
---|
706 | ((solaris) (begin |
---|
707 | |
---|
708 | (libraries |
---|
709 | (append (list "-lrt" "-lsocket" "-lnsl" "-lm" "-ldl") |
---|
710 | (pv libraries))) |
---|
711 | |
---|
712 | (c-compiler-options |
---|
713 | (append (list "-fno-strict-aliasing" "-DHAVE_CHICKEN_CONFIG_H") |
---|
714 | (pv c-compiler-options))) |
---|
715 | |
---|
716 | (c-compiler-optimization-options |
---|
717 | (append (if debug-build? |
---|
718 | (list "-g" "-Wall" "-Wno-unused") |
---|
719 | (list "-Os" "-fomit-frame-pointer")) |
---|
720 | (pv c-compiler-optimization-options))) |
---|
721 | |
---|
722 | (linker-link-shared-library-options (list "-shared")) |
---|
723 | |
---|
724 | (linker-link-shared-program-options |
---|
725 | (list (s+ "-Wl,-R" (pv lib-dir)))) |
---|
726 | |
---|
727 | )) |
---|
728 | ) |
---|
729 | |
---|
730 | |
---|
731 | ;; Some common parameters |
---|
732 | |
---|
733 | (case platform |
---|
734 | ((linux bsd solaris macosx cygwin) |
---|
735 | (begin |
---|
736 | (hostname (ipipe read-line (hostname))) |
---|
737 | (build-time (ipipe read-line (date +%Y-%m-%d))) |
---|
738 | (uname-sys (ipipe read-line (uname))) |
---|
739 | (install-program-shared-library-options (list "-m755")) |
---|
740 | (install-program-static-library-options (list "-m644")) |
---|
741 | (install-program-executable-options (list "-m755")) |
---|
742 | (install-program-file-options (list "-m644")) |
---|
743 | (makedir-command-options (list "-p")))) |
---|
744 | ((mingw) |
---|
745 | (begin |
---|
746 | (build-time (ipipe read-line (date /t))) |
---|
747 | (uname-sys "MinGW") |
---|
748 | (remove-command-options (list "/f" "/q")) |
---|
749 | (remove-command-recursive-options (list "/f" "/s" "/q")) |
---|
750 | (make-writable-command "rem"))) |
---|
751 | ) |
---|
752 | |
---|
753 | ;; Target-specific configuration |
---|
754 | |
---|
755 | (define libchicken_so-libraries |
---|
756 | (case platform |
---|
757 | ((mingw mingw-msys) (list "-lm" "-lws2_32")) |
---|
758 | (else (pv libraries)))) |
---|
759 | |
---|
760 | |
---|
761 | (define libuchicken_so-libraries |
---|
762 | (case platform |
---|
763 | ((mingw mingw-msys) (list "-lm" "-lws2_32")) |
---|
764 | (else (pv libraries)))) |
---|
765 | |
---|
766 | |
---|
767 | (define libchickengui_so-libraries |
---|
768 | (case platform |
---|
769 | ((mingw mingw-msys) (list "-lm" "-lws2_32" "-lkernel32" "-luser32" "-lgdi32" )) |
---|
770 | (else (pv libraries)))) |
---|
771 | |
---|
772 | |
---|
773 | (define libchicken_so-linker-options |
---|
774 | (case platform |
---|
775 | ((linux) (list (s+ "-Wl,-soname,libchicken.so" (pv soname-version)))) |
---|
776 | ((macosx) (list (s+ "-install_name " (s+ "libchicken" (pv SO))))) |
---|
777 | ((cygwin) (list "-Wl,--out-implib,libchicken.dll.a" "-Wl,--export-all-symbols" |
---|
778 | "-Wl,--enable-auto-import" "-Wl,--image-base=0x10000000" |
---|
779 | "-Wl,--dll" "-Wl,--add-stdcall-alias" "-Wl,--no-whole-archive")) |
---|
780 | ((mingw mingw-msys) (list "-Wl,--out-implib,libchicken.dll.a")) |
---|
781 | |
---|
782 | (else (list)))) |
---|
783 | |
---|
784 | (define libuchicken_so-linker-options |
---|
785 | (case platform |
---|
786 | ((linux) (list (s+ "-Wl,-soname,libuchicken.so" (pv soname-version)))) |
---|
787 | ((macosx) (list (s+ "-install_name " (s+ "libuchicken" (pv SO))))) |
---|
788 | ((cygwin) (list "-Wl,--out-implib,libchicken.dll.a" "-Wl,--export-all-symbols" |
---|
789 | "-Wl,--enable-auto-import" "-Wl,--image-base=0x10000000" |
---|
790 | "-Wl,--dll" "-Wl,--add-stdcall-alias" "-Wl,--no-whole-archive")) |
---|
791 | ((mingw mingw-msys) (list "-Wl,--out-implib,libchicken.dll.a")) |
---|
792 | |
---|
793 | (else (list)))) |
---|
794 | |
---|
795 | |
---|
796 | (define libchickengui_so-linker-options |
---|
797 | (case platform |
---|
798 | ((mingw mingw-msys) (list "-Wl,--out-implib,libchickengui.dll.a")) |
---|
799 | (else (list)))) |
---|
800 | |
---|
801 | |
---|
802 | (define libchicken-import-library |
---|
803 | (case platform |
---|
804 | ((mingw mingw-msys cygwin) "libchicken.dll.a") |
---|
805 | (else #f))) |
---|
806 | |
---|
807 | |
---|
808 | (define libuchicken-import-library |
---|
809 | (case platform |
---|
810 | ((mingw mingw-msys cygwin) "libuchicken.dll.a") |
---|
811 | (else #f))) |
---|
812 | |
---|
813 | |
---|
814 | (define libchickengui-import-library |
---|
815 | (case platform |
---|
816 | ((mingw mingw-msys cygwin) "libchickengui.dll.a") |
---|
817 | (else #f))) |
---|
818 | |
---|
819 | |
---|
820 | ;; Chicken program targets |
---|
821 | |
---|
822 | (define chicken-program |
---|
823 | (s+ program-prefix "chicken" program-suffix)) |
---|
824 | |
---|
825 | (define csc-program |
---|
826 | (s+ program-prefix "csc" program-suffix)) |
---|
827 | |
---|
828 | (define csi-program |
---|
829 | (s+ program-prefix "csi" program-suffix)) |
---|
830 | |
---|
831 | (define chicken-profile-program |
---|
832 | (s+ program-prefix "chicken-profile" program-suffix)) |
---|
833 | |
---|
834 | (define chicken-bug-program |
---|
835 | (s+ program-prefix "chicken-bug" program-suffix)) |
---|
836 | |
---|
837 | (define chicken-setup-program |
---|
838 | (s+ program-prefix "chicken-setup" program-suffix)) |
---|
839 | |
---|
840 | |
---|
841 | (define primary-libchicken #f) |
---|
842 | (define libchicken_so-file #f) |
---|
843 | (define libuchicken_so-file #f) |
---|
844 | (define libchickengui_so-file #f) |
---|
845 | |
---|
846 | (define chicken-static-executable #f) |
---|
847 | (define csi-static-executable #f) |
---|
848 | (define chicken-shared-executable #f) |
---|
849 | (define csi-shared-executable #f) |
---|
850 | |
---|
851 | (define libs-target (list)) |
---|
852 | (define targets (list)) |
---|
853 | |
---|
854 | (if (pv static-build? ) |
---|
855 | (begin |
---|
856 | (case platform |
---|
857 | ((cygwin) |
---|
858 | (begin |
---|
859 | (set! primary-libchicken "cygchicken-0.dll") |
---|
860 | (set! libchicken_so-file "cygchicken-0.dll") |
---|
861 | (set! libuchicken_so-file "cyguchicken-0.dll"))) |
---|
862 | (else |
---|
863 | (begin |
---|
864 | (set! primary-libchicken (s+ "libchicken" (pv A)))))) |
---|
865 | |
---|
866 | (set! chicken-static-executable (s+ chicken-program (pv EXE))) |
---|
867 | (set! csi-static-executable (s+ csi-program (pv EXE))) |
---|
868 | (set! chicken-shared-executable (s+ chicken-program "-shared" (pv EXE))) |
---|
869 | (set! csi-shared-executable (s+ csi-program "-shared" (pv EXE))) |
---|
870 | |
---|
871 | (set! libs-target (list (s+ "libchicken" (pv A)) (s+ "libuchicken" (pv A)))) |
---|
872 | (set! targets (append libs-target |
---|
873 | (list chicken-static-executable csi-static-executable |
---|
874 | (s+ chicken-profile-program (pv EXE)) |
---|
875 | (s+ csc-program (pv EXE)) |
---|
876 | (s+ chicken-setup-program (pv EXE)) |
---|
877 | (s+ chicken-bug-program (pv EXE)) |
---|
878 | "chicken.info"))) |
---|
879 | |
---|
880 | ) |
---|
881 | (begin |
---|
882 | (set! primary-libchicken (s+ "libchicken" (pv SO) (pv soname-version))) |
---|
883 | (set! libchicken_so-file (s+ "libchicken" (pv SO) (pv soname-version))) |
---|
884 | (set! libuchicken_so-file (s+ "libuchicken" (pv SO) (pv soname-version))) |
---|
885 | |
---|
886 | (set! chicken-static-executable (s+ chicken-program "-static" (pv EXE))) |
---|
887 | (set! csi-static-executable (s+ csi-program "-static" (pv EXE))) |
---|
888 | (set! chicken-shared-executable (s+ chicken-program (pv EXE))) |
---|
889 | (set! csi-shared-executable (s+ csi-program (pv EXE))) |
---|
890 | |
---|
891 | (set! libs-target (list (s+ "libchicken" (pv A)) (s+ "libuchicken" (pv A)) |
---|
892 | libchicken_so-file libuchicken_so-file)) |
---|
893 | (set! targets (append libs-target |
---|
894 | (list chicken-shared-executable csi-shared-executable |
---|
895 | (s+ chicken-profile-program (pv EXE)) |
---|
896 | (s+ csc-program (pv EXE)) |
---|
897 | (s+ chicken-setup-program (pv EXE)) |
---|
898 | (s+ chicken-bug-program (pv EXE)) |
---|
899 | "chicken.info"))) |
---|
900 | )) |
---|
901 | |
---|
902 | |
---|
903 | |
---|
904 | |
---|
905 | ;; main rule |
---|
906 | |
---|
907 | |
---|
908 | (define (mkdir p) |
---|
909 | (run (,makedir-command ,@(pv makedir-command-options) ,p))) |
---|
910 | |
---|
911 | (define (symlink p1 p2) |
---|
912 | (if (not (equal? p1 p2)) |
---|
913 | (run (ln -sf ,p1 ,p2)))) |
---|
914 | |
---|
915 | (define all-rule |
---|
916 | (let* ((targets (case platform |
---|
917 | ((mingw mingw-msys) |
---|
918 | (append (list (s+ "libchickengui" (pv SO)) (s+ "libchickengui" (pv A))) |
---|
919 | targets)) |
---|
920 | (else targets))) |
---|
921 | (targets (if (pv no-unix-shell?) targets (cons "buildsvnrevision" targets)))) |
---|
922 | `("all" ,targets ,void))) |
---|
923 | |
---|
924 | |
---|
925 | (define buildsvnrevision-rule |
---|
926 | `("buildsvnrevision" () |
---|
927 | ,(lambda () |
---|
928 | (begin |
---|
929 | (run (sh ,(source-path "svnrevision.sh"))))))) |
---|
930 | |
---|
931 | (define (create-chicken-defaults_h out) |
---|
932 | (display |
---|
933 | #<#END |
---|
934 | /* generated */ |
---|
935 | ##define C_BUILD_TAG "#{(pv build-tag)}" |
---|
936 | ##define C_SVN_REVISION #{(ipipe read-line (cat buildsvnrevision))} |
---|
937 | ##ifndef C_INSTALL_CC |
---|
938 | ## define C_INSTALL_CC "#{c-compiler}" |
---|
939 | ##endif |
---|
940 | ##ifndef C_INSTALL_CXX |
---|
941 | ## define C_INSTALL_CXX "#{cxx-compiler}" |
---|
942 | ##endif |
---|
943 | ##ifndef C_INSTALL_CFLAGS |
---|
944 | ## define C_INSTALL_CFLAGS "#{(sw+ (append (pv c-compiler-options) (pv c-compiler-optimization-options)))}" |
---|
945 | ##endif |
---|
946 | ##ifndef C_INSTALL_LDFLAGS |
---|
947 | ## define C_INSTALL_LDFLAGS "#{(sw+ (pv linker-options))}" |
---|
948 | ##endif |
---|
949 | ##ifndef C_INSTALL_SHARE_HOME |
---|
950 | ## define C_INSTALL_SHARE_HOME "#{(pv data-dir)}" |
---|
951 | ##endif |
---|
952 | ##ifndef C_INSTALL_BIN_HOME |
---|
953 | ## define C_INSTALL_BIN_HOME "#{(pv bin-dir)}" |
---|
954 | ##endif |
---|
955 | ##ifndef C_INSTALL_EGG_HOME |
---|
956 | ## define C_INSTALL_EGG_HOME "#{(pv egg-dir)}" |
---|
957 | ##endif |
---|
958 | ##ifndef C_INSTALL_LIB_HOME |
---|
959 | ## define C_INSTALL_LIB_HOME "#{(pv lib-dir)}" |
---|
960 | ##endif |
---|
961 | ##ifndef C_INSTALL_STATIC_LIB_HOME |
---|
962 | ## define C_INSTALL_STATIC_LIB_HOME "#{(pv lib-dir)}" |
---|
963 | ##endif |
---|
964 | ##ifndef C_INSTALL_INCLUDE_HOME |
---|
965 | ## define C_INSTALL_INCLUDE_HOME "#{(pv inc-dir)}" |
---|
966 | ##endif |
---|
967 | ##ifndef C_INSTALL_MORE_LIBS |
---|
968 | ## define C_INSTALL_MORE_LIBS "#{(sw+ (pv libraries))}" |
---|
969 | ##endif |
---|
970 | ##ifndef C_INSTALL_MORE_STATIC_LIBS |
---|
971 | ## define C_INSTALL_MORE_STATIC_LIBS "#{(sw+ (pv libraries))}" |
---|
972 | ##endif |
---|
973 | ##ifndef C_DEFAULT_TARGET_STACK_SIZE |
---|
974 | ## define C_DEFAULT_TARGET_STACK_SIZE #{(pv nursery)} |
---|
975 | ##endif |
---|
976 | ##ifndef C_STACK_GROWS_DOWNWARD |
---|
977 | ## define C_STACK_GROWS_DOWNWARD #{(pv stack-direction)} |
---|
978 | ##endif |
---|
979 | ##ifndef C_TARGET_MORE_LIBS |
---|
980 | ## define C_TARGET_MORE_LIBS "#{(sw+ (pv target-libraries))}" |
---|
981 | ##endif |
---|
982 | ##ifndef C_TARGET_MORE_STATIC_LIBS |
---|
983 | ## define C_TARGET_MORE_STATIC_LIBS "#{(sw+ (pv target-libraries))}" |
---|
984 | ##endif |
---|
985 | |
---|
986 | ##ifndef C_CHICKEN_PROGRAM |
---|
987 | ## define C_CHICKEN_PROGRAM "#{chicken-program}" |
---|
988 | ##endif |
---|
989 | ##ifndef C_CSC_PROGRAM |
---|
990 | ## define C_CSC_PROGRAM "#{csc-program}" |
---|
991 | ##endif |
---|
992 | ##ifndef C_CSI_PROGRAM |
---|
993 | ## define C_CSI_PROGRAM "#{csi-program}" |
---|
994 | ##endif |
---|
995 | ##ifndef C_CHICKEN_PROFILE_PROGRAM |
---|
996 | ## define C_CHICKEN_PROFILE_PROGRAM "#{chicken-profile-program}" |
---|
997 | ##endif |
---|
998 | ##ifndef C_CHICKEN_SETUP_PROGRAM |
---|
999 | ## define C_CHICKEN_SETUP_PROGRAM "#{chicken-setup-program}" |
---|
1000 | ##endif |
---|
1001 | ##ifndef C_CHICKEN_BUG_PROGRAM |
---|
1002 | ## define C_CHICKEN_BUG_PROGRAM "#{chicken-bug-program}" |
---|
1003 | ##endif |
---|
1004 | ##ifndef C_BINARY_VERSION |
---|
1005 | ## define C_BINARY_VERSION #{binary-version} |
---|
1006 | ##endif |
---|
1007 | |
---|
1008 | END |
---|
1009 | out)) |
---|
1010 | |
---|
1011 | (define chicken-defaults_h-rule |
---|
1012 | `("chicken-defaults.h" ("buildsvnrevision") |
---|
1013 | ,(lambda () |
---|
1014 | (call-with-output-file "chicken-defaults.h" create-chicken-defaults_h)))) |
---|
1015 | |
---|
1016 | |
---|
1017 | #| FIXME: |
---|
1018 | ##ifndef C_TARGET_CC |
---|
1019 | ## define C_TARGET_CC \"$(TARGET_C_COMPILER)\" |
---|
1020 | ##endif |
---|
1021 | ##ifndef C_TARGET_CXX |
---|
1022 | ## define C_TARGET_CXX \"$(TARGET_CXX_COMPILER)\" |
---|
1023 | ##endif |
---|
1024 | ##ifndef C_TARGET_CFLAGS |
---|
1025 | ## define C_TARGET_CFLAGS \"$(TARGET_C_COMPILER_OPTIONS) $(TARGET_C_COMPILER_OPTIMIZATION_OPTIONS)\" |
---|
1026 | ##endif |
---|
1027 | ##ifndef C_TARGET_LDFLAGS |
---|
1028 | ## define C_TARGET_LDFLAGS \"$(TARGET_LINKER_OPTIONS) $(TARGET_LINKER_OPTIMIZATION_OPTIONS)\" |
---|
1029 | ##endif |
---|
1030 | ##ifndef C_CROSS_CHICKEN |
---|
1031 | ## define C_CROSS_CHICKEN $(CROSS_CHICKEN) |
---|
1032 | ##endif |
---|
1033 | ifdef WINDOWS |
---|
1034 | ##ifndef C_TARGET_LIB_HOME |
---|
1035 | ## define C_TARGET_LIB_HOME \"$(TARGET_PREFIX)\\lib\" |
---|
1036 | ##endif |
---|
1037 | ##ifndef C_TARGET_RUN_LIB_HOME |
---|
1038 | ## define C_TARGET_RUN_LIB_HOME \"$(TARGET_RUN_PREFIX)\\lib\" |
---|
1039 | ##endif |
---|
1040 | ##ifndef C_TARGET_SHARE_HOME |
---|
1041 | ## define C_TARGET_SHARE_HOME \"$(TARGET_PREFIX)\\share\" |
---|
1042 | ##endif |
---|
1043 | ##ifndef C_TARGET_INCLUDE_HOME |
---|
1044 | ## define C_TARGET_INCLUDE_HOME \"$(TARGET_PREFIX)\\include\" |
---|
1045 | ##endif |
---|
1046 | ##ifndef C_TARGET_STATIC_LIB_HOME |
---|
1047 | ## define C_TARGET_STATIC_LIB_HOME \"$(TARGET_PREFIX)\\lib\" |
---|
1048 | ##endif |
---|
1049 | else |
---|
1050 | echo "#ifndef C_TARGET_LIB_HOME |
---|
1051 | echo "# define C_TARGET_LIB_HOME \"$(TARGET_PREFIX)/lib\" |
---|
1052 | echo "#endif |
---|
1053 | echo "#ifndef C_TARGET_RUN_LIB_HOME |
---|
1054 | echo "# define C_TARGET_RUN_LIB_HOME \"$(TARGET_RUN_PREFIX)/lib\" |
---|
1055 | echo "#endif |
---|
1056 | echo "#ifndef C_TARGET_SHARE_HOME |
---|
1057 | echo "# define C_TARGET_SHARE_HOME \"$(TARGET_PREFIX)/share\" |
---|
1058 | echo "#endif |
---|
1059 | echo "#ifndef C_TARGET_INCLUDE_HOME |
---|
1060 | echo "# define C_TARGET_INCLUDE_HOME \"$(TARGET_PREFIX)/include\" |
---|
1061 | echo "#endif |
---|
1062 | echo "#ifndef C_TARGET_STATIC_LIB_HOME |
---|
1063 | echo "# define C_TARGET_STATIC_LIB_HOME \"$(TARGET_PREFIX)/lib\" |
---|
1064 | echo "#endif |
---|
1065 | endif |
---|
1066 | |# |
---|
1067 | |
---|
1068 | (define chicken-config_h-rule |
---|
1069 | `("chicken-config.h" ("chicken-defaults.h") |
---|
1070 | ,(lambda () |
---|
1071 | (call-with-output-file "chicken-config.h" |
---|
1072 | (lambda (out) |
---|
1073 | (case platform |
---|
1074 | ((linux) |
---|
1075 | (display |
---|
1076 | #<<END |
---|
1077 | #define HAVE_DIRENT_H 1 |
---|
1078 | #define HAVE_DLFCN_H 1 |
---|
1079 | #define HAVE_INTTYPES_H 1 |
---|
1080 | #define HAVE_LIMITS_H 1 |
---|
1081 | #define HAVE_LONG_LONG 1 |
---|
1082 | #define HAVE_MEMMOVE 1 |
---|
1083 | #define HAVE_MEMORY_H 1 |
---|
1084 | #define HAVE_STDINT_H 1 |
---|
1085 | #define HAVE_STDLIB_H 1 |
---|
1086 | #define HAVE_STRERROR 1 |
---|
1087 | #define HAVE_STRINGS_H 1 |
---|
1088 | #define HAVE_STRING_H 1 |
---|
1089 | #define HAVE_STRTOLL 1 |
---|
1090 | #define HAVE_STRTOQ 1 |
---|
1091 | #define HAVE_SYS_STAT_H 1 |
---|
1092 | #define HAVE_SYS_TYPES_H 1 |
---|
1093 | #define HAVE_UNISTD_H 1 |
---|
1094 | #define HAVE_UNSIGNED_LONG_LONG 1 |
---|
1095 | #define STDC_HEADERS 1 |
---|
1096 | #define HAVE_ALLOCA 1 |
---|
1097 | #define HAVE_ALLOCA_H 1 |
---|
1098 | #define HAVE_GRP_H 1 |
---|
1099 | #define HAVE_ERRNO_H 1 |
---|
1100 | #define HAVE_GCVT 1 |
---|
1101 | #define HAVE_SYSEXITS_H 1 |
---|
1102 | #define HAVE_MEMMOVE 1 |
---|
1103 | #define C_STACK_GROWS_DOWNWARD 1 |
---|
1104 | |
---|
1105 | END |
---|
1106 | out)) |
---|
1107 | ((bsd) |
---|
1108 | (display |
---|
1109 | #<<END |
---|
1110 | #define HAVE_DIRENT_H 1 |
---|
1111 | #define HAVE_DLFCN_H 1 |
---|
1112 | #define HAVE_INTTYPES_H 1 |
---|
1113 | #define HAVE_LIMITS_H 1 |
---|
1114 | #define HAVE_LONG_LONG 1 |
---|
1115 | #define HAVE_MEMMOVE 1 |
---|
1116 | #define HAVE_MEMORY_H 1 |
---|
1117 | #define HAVE_STDINT_H 1 |
---|
1118 | #define HAVE_STDLIB_H 1 |
---|
1119 | #define HAVE_STRERROR 1 |
---|
1120 | #define HAVE_STRINGS_H 1 |
---|
1121 | #define HAVE_STRING_H 1 |
---|
1122 | #define HAVE_STRTOLL 1 |
---|
1123 | #define HAVE_STRTOQ 1 |
---|
1124 | #define HAVE_SYS_STAT_H 1 |
---|
1125 | #define HAVE_SYS_TYPES_H 1 |
---|
1126 | #define HAVE_UNISTD_H 1 |
---|
1127 | #define HAVE_UNSIGNED_LONG_LONG 1 |
---|
1128 | #define STDC_HEADERS 1 |
---|
1129 | #define HAVE_ALLOCA 1 |
---|
1130 | #define HAVE_ALLOCA_H 1 |
---|
1131 | #define HAVE_GRP_H 1 |
---|
1132 | #define HAVE_ERRNO_H 1 |
---|
1133 | #define HAVE_SYSEXITS_H 1 |
---|
1134 | #define C_STACK_GROWS_DOWNWARD 1 |
---|
1135 | |
---|
1136 | END |
---|
1137 | out)) |
---|
1138 | ((macosx) |
---|
1139 | (display |
---|
1140 | #<<END |
---|
1141 | #define HAVE_DIRENT_H 1 |
---|
1142 | #define HAVE_DLFCN_H 1 |
---|
1143 | #define HAVE_INTTYPES_H 1 |
---|
1144 | #define HAVE_LIMITS_H 1 |
---|
1145 | #define HAVE_LONG_LONG 1 |
---|
1146 | #define HAVE_MEMMOVE 1 |
---|
1147 | #define HAVE_MEMORY_H 1 |
---|
1148 | #define HAVE_STDINT_H 1 |
---|
1149 | #define HAVE_STDLIB_H 1 |
---|
1150 | #define HAVE_STRERROR 1 |
---|
1151 | #define HAVE_STRINGS_H 1 |
---|
1152 | #define HAVE_STRING_H 1 |
---|
1153 | #define HAVE_STRTOLL 1 |
---|
1154 | #define HAVE_STRTOQ 1 |
---|
1155 | #define HAVE_SYS_STAT_H 1 |
---|
1156 | #define HAVE_SYS_TYPES_H 1 |
---|
1157 | #define HAVE_UNISTD_H 1 |
---|
1158 | #define HAVE_UNSIGNED_LONG_LONG 1 |
---|
1159 | #define STDC_HEADERS 1 |
---|
1160 | #define HAVE_ALLOCA 1 |
---|
1161 | #define HAVE_ALLOCA_H 1 |
---|
1162 | #define HAVE_GRP_H 1 |
---|
1163 | #define HAVE_CRT_EXTERNS_H 1 |
---|
1164 | #define HAVE_ERRNO_H 1 |
---|
1165 | #define HAVE_SYSEXITS_H 1 |
---|
1166 | #define C_STACK_GROWS_DOWNWARD 1 |
---|
1167 | |
---|
1168 | END |
---|
1169 | out)) |
---|
1170 | ((solaris) |
---|
1171 | (display |
---|
1172 | #<<END |
---|
1173 | #define HAVE_DIRENT_H 1 |
---|
1174 | #define HAVE_DLFCN_H 1 |
---|
1175 | #define HAVE_INTTYPES_H 1 |
---|
1176 | #define HAVE_LIMITS_H 1 |
---|
1177 | #define HAVE_LONG_LONG 1 |
---|
1178 | #define HAVE_MEMMOVE 1 |
---|
1179 | #define HAVE_MEMORY_H 1 |
---|
1180 | #define HAVE_STDINT_H 1 |
---|
1181 | #define HAVE_STDLIB_H 1 |
---|
1182 | #define HAVE_STRERROR 1 |
---|
1183 | #define HAVE_STRINGS_H 1 |
---|
1184 | #define HAVE_STRING_H 1 |
---|
1185 | #define HAVE_STRTOLL 1 |
---|
1186 | #define HAVE_SYS_STAT_H 1 |
---|
1187 | #define HAVE_SYS_TYPES_H 1 |
---|
1188 | #define HAVE_UNISTD_H 1 |
---|
1189 | #define HAVE_UNSIGNED_LONG_LONG 1 |
---|
1190 | #define STDC_HEADERS 1 |
---|
1191 | #define HAVE_ALLOCA_H 1 |
---|
1192 | #define HAVE_ALLOCA 1 |
---|
1193 | #define HAVE_GRP_H 1 |
---|
1194 | #define HAVE_ERRNO_H 1 |
---|
1195 | #define HAVE_GCVT 1 |
---|
1196 | #define HAVE_SYSEXITS_H 1 |
---|
1197 | #define C_STACK_GROWS_DOWNWARD 1 |
---|
1198 | |
---|
1199 | END |
---|
1200 | out)) |
---|
1201 | ((cygwin) |
---|
1202 | (display (s+ "#define C_SVN_REVISION " (ipipe read-line (cat buildsvnrevision))) out) |
---|
1203 | (display |
---|
1204 | #<<END |
---|
1205 | #define HAVE_DIRENT_H 1 |
---|
1206 | #define HAVE_INTTYPES_H 1 |
---|
1207 | #define HAVE_LIMITS_H 1 |
---|
1208 | #define HAVE_LONG_LONG 1 |
---|
1209 | #define HAVE_MEMMOVE 1 |
---|
1210 | #define HAVE_MEMORY_H 1 |
---|
1211 | #define HAVE_STDINT_H 1 |
---|
1212 | #define HAVE_STDLIB_H 1 |
---|
1213 | #define HAVE_STRERROR 1 |
---|
1214 | #define HAVE_STRINGS_H 1 |
---|
1215 | #define HAVE_STRING_H 1 |
---|
1216 | #define HAVE_STRTOLL 1 |
---|
1217 | #define HAVE_STRTOQ 1 |
---|
1218 | #define HAVE_SYS_STAT_H 1 |
---|
1219 | #define HAVE_SYS_TYPES_H 1 |
---|
1220 | #define HAVE_UNISTD_H 1 |
---|
1221 | #define HAVE_UNSIGNED_LONG_LONG 1 |
---|
1222 | #define STDC_HEADERS 1 |
---|
1223 | #define HAVE_ALLOCA 1 |
---|
1224 | #define HAVE_ALLOCA_H 1 |
---|
1225 | #define HAVE_GRP_H 1 |
---|
1226 | #define HAVE_ERRNO_H 1 |
---|
1227 | #define HAVE_GCVT 1 |
---|
1228 | #define HAVE_SYSEXITS_H 1 |
---|
1229 | #define HAVE_DLFCN_H 1 |
---|
1230 | #define C_STACK_GROWS_DOWNWARD 1 |
---|
1231 | |
---|
1232 | END |
---|
1233 | out)) |
---|
1234 | |
---|
1235 | ((mingw) |
---|
1236 | (display |
---|
1237 | #<<END |
---|
1238 | #define HAVE_DIRENT_H 1 |
---|
1239 | #define HAVE_INTTYPES_H 1 |
---|
1240 | #define HAVE_LIMITS_H 1 |
---|
1241 | #define HAVE_LONG_LONG 1 |
---|
1242 | #define HAVE_MEMMOVE 1 |
---|
1243 | #define HAVE_MEMORY_H 1 |
---|
1244 | #define HAVE_STDINT_H 1 |
---|
1245 | #define HAVE_STDLIB_H 1 |
---|
1246 | #define HAVE_STRERROR 1 |
---|
1247 | #define HAVE_STRINGS_H 1 |
---|
1248 | #define HAVE_STRING_H 1 |
---|
1249 | #define HAVE_STRTOLL 1 |
---|
1250 | #define HAVE_SYS_STAT_H 1 |
---|
1251 | #define HAVE_SYS_TYPES_H 1 |
---|
1252 | #define HAVE_UNISTD_H 1 |
---|
1253 | #define HAVE_UNSIGNED_LONG_LONG 1 |
---|
1254 | #define HAVE_WINDOWS_H 1 |
---|
1255 | #define HAVE__STRTOI64 1 |
---|
1256 | #define STDC_HEADERS 1 |
---|
1257 | #define HAVE_ALLOCA_H 1 |
---|
1258 | #define HAVE_DIRECT_H 1 |
---|
1259 | #define HAVE_ERRNO_H 1 |
---|
1260 | #define HAVE_GCVT 1 |
---|
1261 | #define HAVE_LOADLIBRARY 1 |
---|
1262 | #define HAVE_GETPROCADDRESS 1 |
---|
1263 | #define HAVE_WINSOCK2_H 1 |
---|
1264 | #define HAVE_WS2TCPIP_H 1 |
---|
1265 | #define C_STACK_GROWS_DOWNWARD 1 |
---|
1266 | |
---|
1267 | END |
---|
1268 | out)) |
---|
1269 | ((mingw-msys) |
---|
1270 | (display |
---|
1271 | #<<END |
---|
1272 | #define HAVE_DIRENT_H 1 |
---|
1273 | #define HAVE_INTTYPES_H 1 |
---|
1274 | #define HAVE_LIMITS_H 1 |
---|
1275 | #define HAVE_LONG_LONG 1 |
---|
1276 | #define HAVE_MEMMOVE 1 |
---|
1277 | #define HAVE_MEMORY_H 1 |
---|
1278 | #define HAVE_STDINT_H 1 |
---|
1279 | #define HAVE_STDLIB_H 1 |
---|
1280 | #define HAVE_STRERROR 1 |
---|
1281 | #define HAVE_STRINGS_H 1 |
---|
1282 | #define HAVE_STRING_H 1 |
---|
1283 | #define HAVE_STRTOLL 1 |
---|
1284 | #define HAVE_SYS_STAT_H 1 |
---|
1285 | #define HAVE_SYS_TYPES_H 1 |
---|
1286 | #define HAVE_UNISTD_H 1 |
---|
1287 | #define HAVE_UNSIGNED_LONG_LONG 1 |
---|
1288 | #define HAVE_WINDOWS_H 1 |
---|
1289 | #define HAVE__STRTOI64 1 |
---|
1290 | #define STDC_HEADERS 1 |
---|
1291 | #define HAVE_ALLOCA_H 1 |
---|
1292 | #define HAVE_DIRECT_H 1 |
---|
1293 | #define HAVE_ERRNO_H 1 |
---|
1294 | #define HAVE_GCVT 1 |
---|
1295 | #define HAVE_LOADLIBRARY 1 |
---|
1296 | #define HAVE_GETPROCADDRESS 1 |
---|
1297 | #define HAVE_WINSOCK2_H 1 |
---|
1298 | #define HAVE_WS2TCPIP_H 1 |
---|
1299 | #define C_STACK_GROWS_DOWNWARD 1 |
---|
1300 | |
---|
1301 | END |
---|
1302 | out)) |
---|
1303 | ) |
---|
1304 | (if symbol-gc? |
---|
1305 | (display "#define C_COLLECT_ALL_SYMBOLS\n" out)) |
---|
1306 | |
---|
1307 | (if no-apply-hook? |
---|
1308 | (display "#define C_NO_APPLY_HOOK\n" out)) |
---|
1309 | |
---|
1310 | (if (pv hacked-apply?) |
---|
1311 | (display "#define C_HACKED_APPLY\n" out)) |
---|
1312 | |
---|
1313 | (if use-host-pcre? |
---|
1314 | (display "#define C_USE_HOST_PCRE\n" out)) |
---|
1315 | |
---|
1316 | (create-chicken-defaults_h out) |
---|
1317 | )) |
---|
1318 | ))) |
---|
1319 | |
---|
1320 | (define chicken_h-rule |
---|
1321 | `("chicken.h" (,(source-path "chicken.h")) |
---|
1322 | ,(lambda () |
---|
1323 | (run (,install-command ,(source-path "chicken.h") "."))))) |
---|
1324 | |
---|
1325 | (define libchicken-objects0 |
---|
1326 | `(library eval data-structures ports files extras lolevel utils tcp |
---|
1327 | srfi-1 srfi-4 srfi-13 srfi-14 srfi-18 srfi-69 ,(pv posix-file) |
---|
1328 | regex scheduler profiler stub match )) |
---|
1329 | |
---|
1330 | (define libchicken-shared-objects |
---|
1331 | (map (lambda (x) (s+ x (pv O))) |
---|
1332 | (cons 'runtime libchicken-objects0))) |
---|
1333 | |
---|
1334 | (define libchicken-static-objects |
---|
1335 | (map (lambda (x) (s+ x "-static" (pv O))) |
---|
1336 | (cons 'runtime libchicken-objects0))) |
---|
1337 | |
---|
1338 | (define libuchicken-objects0 |
---|
1339 | `(ulibrary ueval udata-structures uports ufiles uextras ulolevel |
---|
1340 | uutils utcp usrfi-1 usrfi-4 usrfi-13 usrfi-14 usrfi-18 usrfi-69 |
---|
1341 | ,(s+ "u" (pv posix-file)) uregex scheduler profiler stub match |
---|
1342 | )) |
---|
1343 | |
---|
1344 | (define libuchicken-shared-objects |
---|
1345 | (map (lambda (x) (s+ x (pv O))) (cons 'uruntime libuchicken-objects0))) |
---|
1346 | |
---|
1347 | (define libuchicken-static-objects |
---|
1348 | (map (lambda (x) (s+ x "-static" (pv O))) (cons 'uruntime libuchicken-objects0))) |
---|
1349 | |
---|
1350 | (define libchickengui-objects0 |
---|
1351 | `(library eval data-structures ports files extras lolevel utils tcp |
---|
1352 | srfi-1 srfi-4 srfi-13 srfi-14 srfi-18 srfi-69 ,(pv posix-file) |
---|
1353 | regex scheduler profiler stub match gui-runtime)) |
---|
1354 | |
---|
1355 | (define libchickengui-shared-objects |
---|
1356 | (map (lambda (x) (s+ x (pv O))) libchickengui-objects0)) |
---|
1357 | |
---|
1358 | (define libchickengui-static-objects |
---|
1359 | (map (lambda (x) (s+ x "-static" (pv O))) libchickengui-objects0)) |
---|
1360 | |
---|
1361 | (define pcre-objects0 (list)) |
---|
1362 | |
---|
1363 | (if (not use-host-pcre?) |
---|
1364 | (set! pcre-objects0 |
---|
1365 | `(pcre_chartables pcre_compile pcre_config pcre_dfa_exec |
---|
1366 | pcre_exec pcre_fullinfo pcre_get pcre_globals pcre_info |
---|
1367 | pcre_maketables pcre_newline pcre_ord2utf8 pcre_refcount pcre_study |
---|
1368 | pcre_tables pcre_try_flipped pcre_ucd pcre_valid_utf8 pcre_version |
---|
1369 | pcre_xclass))) |
---|
1370 | |
---|
1371 | (define pcre-shared-objects |
---|
1372 | (map (lambda (x) (s+ x (pv O))) pcre-objects0)) |
---|
1373 | |
---|
1374 | (define pcre-static-objects |
---|
1375 | (map (lambda (x) (s+ x "-static" (pv O))) pcre-objects0)) |
---|
1376 | |
---|
1377 | (define compiler-objects0 |
---|
1378 | `(chicken batch-driver compiler optimizer support c-platform c-backend)) |
---|
1379 | |
---|
1380 | (define compiler-objects |
---|
1381 | (map (lambda (x) (s+ x (pv O))) compiler-objects0)) |
---|
1382 | |
---|
1383 | (define compiler-static-objects |
---|
1384 | (map (lambda (x) (s+ x "-static" (pv O))) compiler-objects0)) |
---|
1385 | |
---|
1386 | (define program-objects0 |
---|
1387 | `(chicken-profile chicken-setup csc csi)) |
---|
1388 | |
---|
1389 | (define program-objects |
---|
1390 | (map (lambda (x) (s+ x (pv O))) program-objects0)) |
---|
1391 | |
---|
1392 | ;; rules for library objects |
---|
1393 | |
---|
1394 | (define library-compiler-flags |
---|
1395 | (cons (pv c-compiler-compile-option) |
---|
1396 | (append (pv c-compiler-options) (pv c-compiler-ptables-options) |
---|
1397 | (pv c-compiler-optimization-options) |
---|
1398 | (pv c-compiler-shared-options) (pv c-compiler-build-runtime-options) |
---|
1399 | (pv includes) ))) |
---|
1400 | |
---|
1401 | (define library-objects-rules |
---|
1402 | (map (lambda (x) |
---|
1403 | (let ((source (case x ((runtime) (source-path (s+ x ".c"))) (else (s+ x ".c")))) |
---|
1404 | (obj (s+ x (pv O)))) |
---|
1405 | `(,obj (,source "chicken.h" ,chicken_config_h-file) |
---|
1406 | ,(lambda () (run (,c-compiler ,@library-compiler-flags |
---|
1407 | ,(c-compiler-output obj) |
---|
1408 | ,source)))))) |
---|
1409 | (append '(runtime gui-runtime) libchicken-objects0))) |
---|
1410 | |
---|
1411 | (define library-unsafe-compiler-flags |
---|
1412 | (cons (pv c-compiler-compile-option) |
---|
1413 | (append (pv c-compiler-options) (pv c-compiler-ptables-options) |
---|
1414 | (pv c-compiler-optimization-options) |
---|
1415 | (pv c-compiler-shared-options) (pv c-compiler-build-unsafe-runtime-options) |
---|
1416 | (pv includes)))) |
---|
1417 | |
---|
1418 | (define library-unsafe-objects-rules |
---|
1419 | (cons* |
---|
1420 | (let ((obj (s+ "uruntime" (pv O))) |
---|
1421 | (source (source-path "runtime.c"))) |
---|
1422 | `(,obj (,source "chicken.h" ,chicken_config_h-file) |
---|
1423 | ,(lambda () (run (,c-compiler ,@library-compiler-flags ,source |
---|
1424 | ,(c-compiler-output obj)))))) |
---|
1425 | (map (lambda (x) |
---|
1426 | (let ((obj (s+ "u" x (pv O))) |
---|
1427 | (source (s+ "u" x ".c"))) |
---|
1428 | `(,obj (,source ,"chicken.h" ,chicken_config_h-file) |
---|
1429 | ,(lambda () (run (,c-compiler ,@library-unsafe-compiler-flags |
---|
1430 | ,(c-compiler-output obj) ,source)))))) |
---|
1431 | libchicken-objects0))) |
---|
1432 | |
---|
1433 | |
---|
1434 | (define library-static-compiler-flags |
---|
1435 | (cons (pv c-compiler-compile-option) |
---|
1436 | (append (pv c-compiler-options) (pv c-compiler-ptables-options) |
---|
1437 | (pv c-compiler-optimization-options) |
---|
1438 | (pv c-compiler-build-runtime-options) |
---|
1439 | (pv includes)))) |
---|
1440 | |
---|
1441 | (define library-static-objects-rules |
---|
1442 | (map (lambda (x) |
---|
1443 | (let ((obj (s+ x "-static" (pv O))) |
---|
1444 | (source (case x ((runtime) (source-path (s+ x ".c"))) |
---|
1445 | (else (s+ x ".c"))))) |
---|
1446 | `(,obj (,source "chicken.h" ,chicken_config_h-file) |
---|
1447 | ,(lambda () (run (,c-compiler ,@library-static-compiler-flags |
---|
1448 | ,(c-compiler-output obj) ,source)))))) |
---|
1449 | (append '(runtime gui-runtime) libchicken-objects0))) |
---|
1450 | |
---|
1451 | |
---|
1452 | (define library-unsafe-static-compiler-flags |
---|
1453 | (cons (pv c-compiler-compile-option) |
---|
1454 | (append (pv c-compiler-options) (pv c-compiler-ptables-options) |
---|
1455 | (pv c-compiler-optimization-options) |
---|
1456 | (pv c-compiler-build-unsafe-runtime-options) |
---|
1457 | (pv includes)))) |
---|
1458 | |
---|
1459 | |
---|
1460 | (define library-unsafe-static-objects-rules |
---|
1461 | (cons* |
---|
1462 | (let ((obj (s+ "uruntime-static" (pv O))) |
---|
1463 | (source (source-path "runtime.c"))) |
---|
1464 | `(,obj (,source "chicken.h" ,chicken_config_h-file) |
---|
1465 | ,(lambda () (run (,c-compiler ,@library-unsafe-static-compiler-flags ,(source-path "runtime.c") |
---|
1466 | ,(c-compiler-output obj)))))) |
---|
1467 | (map (lambda (x) |
---|
1468 | (let ((obj (s+ "u" x "-static" (pv O))) |
---|
1469 | (source (s+ "u" x ".c"))) |
---|
1470 | `(,obj (,source "chicken.h" ,chicken_config_h-file) |
---|
1471 | ,(lambda () (run (,c-compiler ,@library-unsafe-static-compiler-flags |
---|
1472 | ,(c-compiler-output obj) ,source)))))) |
---|
1473 | libchicken-objects0))) |
---|
1474 | |
---|
1475 | ;; rules for compiler objects |
---|
1476 | |
---|
1477 | (define compiler-compiler-flags |
---|
1478 | (cons (pv c-compiler-compile-option) |
---|
1479 | (append (pv c-compiler-options) (pv c-compiler-ptables-options) |
---|
1480 | (pv c-compiler-optimization-options) |
---|
1481 | (pv c-compiler-shared-options) (pv includes)))) |
---|
1482 | |
---|
1483 | |
---|
1484 | (define compiler-objects-rules |
---|
1485 | (map (lambda (x) |
---|
1486 | (let ((obj (s+ x (pv O))) |
---|
1487 | (source (s+ x ".c"))) |
---|
1488 | `(,obj (,source "chicken.h" ,chicken_config_h-file) |
---|
1489 | ,(lambda () (run (,c-compiler ,@compiler-compiler-flags |
---|
1490 | ,(c-compiler-output obj) ,source)))))) |
---|
1491 | compiler-objects0)) |
---|
1492 | |
---|
1493 | |
---|
1494 | (define compiler-static-compiler-flags |
---|
1495 | (cons (pv c-compiler-compile-option) |
---|
1496 | (append (pv c-compiler-options) (pv c-compiler-ptables-options) |
---|
1497 | (pv c-compiler-optimization-options) |
---|
1498 | (pv includes)))) |
---|
1499 | |
---|
1500 | |
---|
1501 | (define compiler-static-objects-rules |
---|
1502 | (map (lambda (x) |
---|
1503 | (let ((obj (s+ x "-static" (pv O))) |
---|
1504 | (source (s+ x ".c"))) |
---|
1505 | `(,obj (,source "chicken.h" ,chicken_config_h-file) |
---|
1506 | ,(lambda () (run (,c-compiler ,@compiler-static-compiler-flags |
---|
1507 | ,(c-compiler-output obj) ,source)))))) |
---|
1508 | compiler-objects0)) |
---|
1509 | |
---|
1510 | ;; rules for pcre objects |
---|
1511 | |
---|
1512 | (define pcre-compiler-flags |
---|
1513 | (cons (pv c-compiler-compile-option) |
---|
1514 | (append (pv c-compiler-options) (pv c-compiler-ptables-options) |
---|
1515 | (pv c-compiler-optimization-options) |
---|
1516 | (pv c-compiler-shared-options) (pv pcre-c-compiler-options) |
---|
1517 | (pv pcre-includes)))) |
---|
1518 | |
---|
1519 | |
---|
1520 | (define pcre-objects-rules |
---|
1521 | (map (lambda (x) |
---|
1522 | (let ((obj (s+ x (pv O)) ) |
---|
1523 | (source (pcre-source-path (s+ x ".c")))) |
---|
1524 | `(,obj (,source ,chicken_config_h-file |
---|
1525 | ,@(map pcre-source-path (list "pcre_internal.h" "config.h" "pcre.h" "ucp.h"))) |
---|
1526 | ,(lambda () (run (,c-compiler ,@pcre-compiler-flags |
---|
1527 | ,(c-compiler-output obj) ,source)))))) |
---|
1528 | pcre-objects0)) |
---|
1529 | |
---|
1530 | |
---|
1531 | (define pcre-static-compiler-flags |
---|
1532 | (cons (pv c-compiler-compile-option) |
---|
1533 | (append (pv c-compiler-options) (pv c-compiler-ptables-options) |
---|
1534 | (pv c-compiler-optimization-options) |
---|
1535 | (pv pcre-c-compiler-options) (pv pcre-includes)))) |
---|
1536 | |
---|
1537 | |
---|
1538 | (define pcre-static-objects-rules |
---|
1539 | (map (lambda (x) |
---|
1540 | (let ((obj (s+ x "-static" (pv O)) ) |
---|
1541 | (source (pcre-source-path (s+ x ".c")))) |
---|
1542 | `(,obj (,source ,chicken_config_h-file |
---|
1543 | ,@(map pcre-source-path (list "pcre_internal.h" "config.h" "pcre.h" "ucp.h"))) |
---|
1544 | ,(lambda () (run (,c-compiler ,@pcre-compiler-flags |
---|
1545 | ,(c-compiler-output obj) ,source)))))) |
---|
1546 | pcre-objects0)) |
---|
1547 | |
---|
1548 | ;; rules for assembler objects |
---|
1549 | |
---|
1550 | (define apply-hack-object-rules |
---|
1551 | (case platform |
---|
1552 | ((macosx) |
---|
1553 | (let ((obj (pv apply-hack-object )) |
---|
1554 | (source (list (s+ "apply-hack.x86" (pv O)) (s+ "apply-hack.ppc.darwin" (pv O))))) |
---|
1555 | `( |
---|
1556 | (,(s+ "apply-hack.ppc.darwin" (pv O)) (,(source-path "apply-hack.ppc.darwin.s")) |
---|
1557 | ,(lambda () (run ("as" "-arch ppc" |
---|
1558 | ,(assembler-output (s+ "apply-hack.ppc.darwin" (pv O))) |
---|
1559 | ,(source-path "apply-hack.ppc.darwin.s"))))) |
---|
1560 | (,(s+ "apply-hack.x86" (pv O)) (,(source-path "apply-hack.x86.s")) |
---|
1561 | ,(lambda () (run ("as" "-arch i386" |
---|
1562 | ,(assembler-output (s+ "apply-hack.x86" (pv O))) |
---|
1563 | ,(source-path "apply-hack.x86.s"))))) |
---|
1564 | (,obj ,source |
---|
1565 | ,(lambda () |
---|
1566 | (run ("lipo" "-create" ,(s+ "-output " ,obj) ,@source)))) |
---|
1567 | ))) |
---|
1568 | (else |
---|
1569 | (let ((obj (pv apply-hack-object )) |
---|
1570 | (source (source-path (s+ "apply-hack." (arch) (pv ASM))))) |
---|
1571 | `((,obj (,source) |
---|
1572 | ,(lambda () |
---|
1573 | (run (,assembler ,@(pv assembler-options) ,(pv assembler-compile-option) |
---|
1574 | ,source ,(assembler-output obj)))))))))) |
---|
1575 | |
---|
1576 | ;; rules for program objects |
---|
1577 | |
---|
1578 | (define program-compiler-flags |
---|
1579 | (cons (pv c-compiler-compile-option) |
---|
1580 | (append (pv c-compiler-options) (pv c-compiler-ptables-options) |
---|
1581 | (pv c-compiler-optimization-options) |
---|
1582 | (pv c-compiler-shared-options) (pv includes)))) |
---|
1583 | |
---|
1584 | (define program-objects-rules |
---|
1585 | (map (lambda (x) |
---|
1586 | (let ((obj (s+ x (pv O))) |
---|
1587 | (source (s+ x ".c"))) |
---|
1588 | `(,obj (,source "chicken.h" ,chicken_config_h-file) |
---|
1589 | ,(lambda () (run (,c-compiler ,@program-compiler-flags |
---|
1590 | ,(c-compiler-output obj) ,source)))))) |
---|
1591 | program-objects0)) |
---|
1592 | |
---|
1593 | |
---|
1594 | (define program-static-compiler-flags |
---|
1595 | (cons (pv c-compiler-compile-option) |
---|
1596 | (append (pv c-compiler-options) (pv c-compiler-ptables-options) |
---|
1597 | (pv c-compiler-optimization-options) |
---|
1598 | (pv includes)))) |
---|
1599 | |
---|
1600 | |
---|
1601 | (define program-static-objects-rules |
---|
1602 | (map (lambda (x) |
---|
1603 | (let ((obj (s+ x "-static" (pv O))) |
---|
1604 | (source (s+ x ".c"))) |
---|
1605 | `(,obj (,source "chicken.h" ,chicken_config_h-file) |
---|
1606 | ,(lambda () (run (,c-compiler ,@program-static-compiler-flags |
---|
1607 | ,(c-compiler-output obj) ,source)))))) |
---|
1608 | `(csi chicken-bug))) |
---|
1609 | |
---|
1610 | |
---|
1611 | ;; rules for libchicken |
---|
1612 | |
---|
1613 | (define libchicken_so-rule |
---|
1614 | `(,libchicken_so-file |
---|
1615 | (,@libchicken-shared-objects ,@pcre-shared-objects ,(pv apply-hack-object)) |
---|
1616 | ,(lambda () |
---|
1617 | (run (,linker ,@(pv linker-options) ,@(pv linker-link-shared-library-options) |
---|
1618 | ,@libchicken_so-linker-options ,@libchicken_so-libraries |
---|
1619 | ,(linker-output libchicken_so-file) |
---|
1620 | ,@libchicken-shared-objects ,@pcre-shared-objects ,(pv apply-hack-object) |
---|
1621 | )) |
---|
1622 | (if (pv soname-version) |
---|
1623 | (symlink libchicken_so-file (s+ "libchicken" (pv SO))))))) |
---|
1624 | |
---|
1625 | |
---|
1626 | (define libuchicken_so-rule |
---|
1627 | `(,libuchicken_so-file |
---|
1628 | (,@libuchicken-shared-objects ,@pcre-shared-objects ,(pv apply-hack-object)) |
---|
1629 | ,(lambda () |
---|
1630 | (run (,linker ,@(pv linker-options) ,@(pv linker-link-shared-library-options) |
---|
1631 | ,@libuchicken_so-linker-options ,@libuchicken_so-libraries |
---|
1632 | ,(linker-output libuchicken_so-file) |
---|
1633 | ,@libuchicken-shared-objects ,@pcre-shared-objects ,(pv apply-hack-object) |
---|
1634 | )) |
---|
1635 | (if (pv soname-version) |
---|
1636 | (symlink libuchicken_so-file (s+ "libuchicken" (pv SO))))))) |
---|
1637 | |
---|
1638 | (define cygchicken-0.dll-rule |
---|
1639 | `("cygchicken-0.dll" |
---|
1640 | (,@libuchicken-shared-objects ,@pcre-shared-objects ,(pv apply-hack-object)) |
---|
1641 | ,(lambda () |
---|
1642 | (run (,c-compiler -shared ,(c-compiler-output libchicken_so-file) |
---|
1643 | "-Wl,--dll" "-Wl,--add-stdcall-alias" |
---|
1644 | "-Wl,--enable-stdcall-fixup" "-Wl,--warn-unresolved-symbols" |
---|
1645 | "-Wl,--dll-search-prefix=cyg" "-Wl,--allow-multiple-definition" |
---|
1646 | "-Wl,--allow-shlib-undefined" "-Wl,--export-dynamic" |
---|
1647 | "-Wl,--out-implib=libchicken.dll.a" "-Wl,--export-all-symbols" |
---|
1648 | "-Wl,--enable-auto-import" |
---|
1649 | "-Wl,--whole-archive" ,@(pv libchicken-shared-objects) ,@(pv pcre-shared-objects) |
---|
1650 | ,(pv apply-hack-object) |
---|
1651 | "-Wl,--no-whole-archive" ,@(pv libchicken_so-libraries)))))) |
---|
1652 | |
---|
1653 | |
---|
1654 | (define cyguchicken-0.dll-rule |
---|
1655 | `("cygchicken-0.dll" |
---|
1656 | (,@libuchicken-shared-objects ,@pcre-shared-objects ,(pv apply-hack-object)) |
---|
1657 | ,(lambda () |
---|
1658 | (run (,c-compiler -shared ,(c-compiler-output libuchicken_so-file) |
---|
1659 | "-Wl,--dll" "-Wl,--add-stdcall-alias" |
---|
1660 | "-Wl,--enable-stdcall-fixup" "-Wl,--warn-unresolved-symbols" |
---|
1661 | "-Wl,--dll-search-prefix=cyg" "-Wl,--allow-multiple-definition" |
---|
1662 | "-Wl,--allow-shlib-undefined" "-Wl,--export-dynamic" |
---|
1663 | "-Wl,--out-implib=libchicken.dll.a" "-Wl,--export-all-symbols" |
---|
1664 | "-Wl,--enable-auto-import" |
---|
1665 | "-Wl,--whole-archive" ,@(pv libuchicken-shared-objects) ,@(pv pcre-shared-objects) |
---|
1666 | ,(pv apply-hack-object) |
---|
1667 | "-Wl,--no-whole-archive" ,@(pv libuchicken_so-libraries)))))) |
---|
1668 | |
---|
1669 | (define libchickengui-so-rule |
---|
1670 | `(,libchickengui_so-file |
---|
1671 | (,@libchickengui-shared-objects ,@pcre-shared-objects ,(pv apply-hack-object)) |
---|
1672 | ,(lambda () |
---|
1673 | (run (,linker ,@(pv linker-options) ,@(pv linker-link-shared-library-options) |
---|
1674 | ,libchickengui_so-linker-options ,@libchickengui-so-libraries |
---|
1675 | ,(linker-output libchickengui_so-file) |
---|
1676 | ,@libchickengui-shared-objects ,@pcre-shared-objects ,(pv apply-hack-object) |
---|
1677 | ))))) |
---|
1678 | |
---|
1679 | (define libchicken_a-rule |
---|
1680 | (let ((target (s+ "libchicken" (pv A)))) |
---|
1681 | `(,target (,@libchicken-static-objects ,@pcre-static-objects ,(pv apply-hack-object) ) |
---|
1682 | ,(lambda () |
---|
1683 | (run (,librarian ,@(librarian-options) |
---|
1684 | ,(librarian-output target) ,(pv apply-hack-object) |
---|
1685 | ,@libchicken-static-objects ,@pcre-static-objects |
---|
1686 | )))))) |
---|
1687 | |
---|
1688 | (define libuchicken_a-rule |
---|
1689 | (let ((target (s+ "libuchicken" (pv A)))) |
---|
1690 | `(,target (,@libuchicken-static-objects ,@pcre-static-objects ,(pv apply-hack-object) ) |
---|
1691 | ,(lambda () |
---|
1692 | (run (,librarian ,@(librarian-options) |
---|
1693 | ,(librarian-output target) ,(pv apply-hack-object) |
---|
1694 | ,@libuchicken-static-objects ,@pcre-static-objects |
---|
1695 | )))))) |
---|
1696 | |
---|
1697 | (define libchickengui_a-rule |
---|
1698 | (let ((target (s+ "libchickengui" (pv A)))) |
---|
1699 | `(,target (,@libchickengui-static-objects ,@pcre-static-objects ,(pv apply-hack-object)) |
---|
1700 | ,(lambda () |
---|
1701 | (run (,librarian ,@(librarian-options) |
---|
1702 | ,(librarian-output target) ,(pv apply-hack-object) |
---|
1703 | ,@libchickengui-static-objects ,@pcre-static-objects )))))) |
---|
1704 | |
---|
1705 | (define libs-rule |
---|
1706 | `("libs" ,libs-target)) |
---|
1707 | |
---|
1708 | ;; rules for executables |
---|
1709 | |
---|
1710 | (define chicken-shared-executable-rule |
---|
1711 | `(,chicken-shared-executable (,@compiler-objects ,primary-libchicken) |
---|
1712 | ,(lambda () |
---|
1713 | (run (,linker ,@(pv linker-options) ,@(pv linker-executable-options) |
---|
1714 | ,@(pv linker-link-shared-program-options) ,@(pv libraries) |
---|
1715 | ,(s+ (pv linker-library-prefix) "chicken" (linker-library-suffix) ) |
---|
1716 | ,@compiler-objects |
---|
1717 | ,(linker-output chicken-shared-executable) ))))) |
---|
1718 | |
---|
1719 | |
---|
1720 | (define csi-shared-executable-rule |
---|
1721 | (let ((obj (s+ "csi" (pv O)))) |
---|
1722 | `(,csi-shared-executable (,obj ,primary-libchicken) |
---|
1723 | ,(lambda () |
---|
1724 | (run (,linker ,@(pv linker-options) ,@(pv linker-executable-options) |
---|
1725 | ,@(pv linker-link-shared-program-options) ,@(pv libraries) |
---|
1726 | ,(s+ (pv linker-library-prefix) "chicken" (linker-library-suffix)) |
---|
1727 | ,obj ,(linker-output csi-shared-executable) )))))) |
---|
1728 | |
---|
1729 | |
---|
1730 | (define chicken-setup-program-rule |
---|
1731 | (let ((obj (s+ "chicken-setup" (pv O)))) |
---|
1732 | `(,chicken-setup-program (,obj ,primary-libchicken) |
---|
1733 | ,(lambda () |
---|
1734 | (run (,linker ,@(pv linker-options) ,@(pv linker-executable-options) |
---|
1735 | ,@(pv linker-link-shared-program-options) ,@(pv libraries) |
---|
1736 | ,(s+ (pv linker-library-prefix) "chicken" (linker-library-suffix)) |
---|
1737 | ,obj ,(linker-output chicken-setup-program) )))))) |
---|
1738 | |
---|
1739 | |
---|
1740 | (define chicken-profile-program-rule |
---|
1741 | (let ((target (s+ "chicken-profile" (pv EXE))) |
---|
1742 | (obj (s+ "chicken-profile" (pv O)))) |
---|
1743 | `(,target (,obj ,primary-libchicken) |
---|
1744 | ,(lambda () |
---|
1745 | (run (,linker ,@(pv linker-options) ,@(pv linker-executable-options) |
---|
1746 | ,@(pv linker-link-shared-program-options) ,@(pv libraries) |
---|
1747 | ,(s+ (pv linker-library-prefix) "chicken" (linker-library-suffix)) |
---|
1748 | ,obj ,(linker-output target))))))) |
---|
1749 | |
---|
1750 | |
---|
1751 | (define csc-program-rule |
---|
1752 | (let ((target (s+ "csc" (pv EXE))) |
---|
1753 | (obj (s+ "csc" (pv O)))) |
---|
1754 | `(,target (,obj ,primary-libchicken) |
---|
1755 | ,(lambda () |
---|
1756 | (run (,linker ,@(pv linker-options) ,@(pv linker-executable-options) |
---|
1757 | ,@(pv linker-link-shared-program-options) ,@(pv libraries) |
---|
1758 | ,(s+ (pv linker-library-prefix) "chicken" (linker-library-suffix)) |
---|
1759 | ,obj ,(linker-output target))))))) |
---|
1760 | |
---|
1761 | ;; rules for static executables |
---|
1762 | |
---|
1763 | (define chicken-static-executable-rule |
---|
1764 | (let ((source `(,@compiler-static-objects ,(s+ "libchicken" (pv A))))) |
---|
1765 | `(,chicken-static-executable ,source |
---|
1766 | ,(lambda () |
---|
1767 | (run (,linker ,@(pv linker-options) ,@(pv linker-static-options) |
---|
1768 | ,@(pv libraries) ,@source |
---|
1769 | ,(linker-output chicken-static-executable))))))) |
---|
1770 | |
---|
1771 | (define csi-static-executable-rule |
---|
1772 | (let ((source `(,(s+ "csi" "-static" (pv O)) ,(s+ "libchicken" (pv A))))) |
---|
1773 | `(,csi-static-executable ,source |
---|
1774 | ,(lambda () |
---|
1775 | (run (,linker ,@(pv linker-options) ,@(pv linker-static-options) |
---|
1776 | ,@(pv libraries) ,@source |
---|
1777 | ,(linker-output csi-static-executable))))))) |
---|
1778 | |
---|
1779 | |
---|
1780 | (define chicken-bug-program-rule |
---|
1781 | (let ((target (s+ "chicken-bug" (pv EXE))) |
---|
1782 | (source `(,(s+ "chicken-bug" "-static" (pv O)) ,(s+ "libchicken" (pv A))))) |
---|
1783 | `(,target ,source |
---|
1784 | ,(lambda () |
---|
1785 | (run (,linker ,@(pv linker-options) ,@(pv linker-static-options) |
---|
1786 | ,@(pv libraries) ,@source |
---|
1787 | ,(linker-output target))))))) |
---|
1788 | |
---|
1789 | |
---|
1790 | ;; info documentation |
---|
1791 | |
---|
1792 | (define chicken_info-rule |
---|
1793 | `("chicken.info" (,(source-path "chicken.texi")) |
---|
1794 | ,(lambda () |
---|
1795 | (run (,makeinfo ,@(pv makeinfo-options) ,(source-path "chicken.texi")))))) |
---|
1796 | |
---|
1797 | |
---|
1798 | ;; installation rules |
---|
1799 | |
---|
1800 | (define (install opt f dest) |
---|
1801 | (run (,install-command ,@(pv opt) ,f ,dest))) |
---|
1802 | |
---|
1803 | (define install-libs-rule |
---|
1804 | `("install-libs" () |
---|
1805 | ,(lambda () |
---|
1806 | (if (not (zero? (string-length dest-dir))) (mkdir dest-dir)) |
---|
1807 | |
---|
1808 | (mkdir (dest-path (pv lib-dir))) |
---|
1809 | (mkdir (dest-path (pv chicken-lib-dir))) |
---|
1810 | (mkdir (dest-path (pv egg-dir))) |
---|
1811 | (mkdir (dest-path (pv inc-dir))) |
---|
1812 | (mkdir (dest-path (pv bin-dir))) |
---|
1813 | |
---|
1814 | (install install-program-static-library-options |
---|
1815 | (s+ "libchicken" (pv A)) (dest-path (pv lib-dir))) |
---|
1816 | (install install-program-static-library-options |
---|
1817 | (s+ "libuchicken" (pv A)) (dest-path (pv lib-dir))) |
---|
1818 | |
---|
1819 | (if libchicken-import-library |
---|
1820 | (install install-program-static-library-options |
---|
1821 | libchicken-import-library (dest-path (pv lib-dir)))) |
---|
1822 | (if libuchicken-import-library |
---|
1823 | (install install-program-static-library-options |
---|
1824 | libuchicken-import-library (dest-path (pv lib-dir)))) |
---|
1825 | |
---|
1826 | (case platform |
---|
1827 | ((mingw mingw-msys cygwin) |
---|
1828 | (begin |
---|
1829 | (install install-program-static-library-options |
---|
1830 | (s+ "libchickengui" (pv A)) (dest-path (pv lib-dir))) |
---|
1831 | (if libchickengui-import-library |
---|
1832 | (install install-program-static-library-options |
---|
1833 | libchickengui-import-library (dest-path (pv lib-dir))))))) |
---|
1834 | |
---|
1835 | (if (pv postinstall-static-library) |
---|
1836 | (run (,(pv postinstall-program) ,@(pv postinstall-program-flags) |
---|
1837 | ,(make-pathname (pv lib-dir) (s+ "libchicken" (pv A)))) |
---|
1838 | (,(pv postinstall-program) ,@(pv postinstall-program-flags) |
---|
1839 | ,(make-pathname (pv lib-dir) (s+ "libuchicken" (pv A)))))) |
---|
1840 | |
---|
1841 | |
---|
1842 | (install install-program-file-options |
---|
1843 | "chicken.h" |
---|
1844 | (dest-path (pv inc-dir))) |
---|
1845 | |
---|
1846 | |
---|
1847 | (install install-program-file-options |
---|
1848 | chicken_config_h-file (dest-path (pv inc-dir))) |
---|
1849 | |
---|
1850 | (if (not (pv static-build?)) |
---|
1851 | (begin |
---|
1852 | (if (pv dlls-in-path?) |
---|
1853 | (begin |
---|
1854 | (install install-program-shared-library-options |
---|
1855 | libchicken_so-file (dest-path (pv bin-dir))) |
---|
1856 | (install install-program-shared-library-options |
---|
1857 | libuchicken_so-file (dest-path (pv bin-dir)))) |
---|
1858 | (begin |
---|
1859 | (install install-program-shared-library-options |
---|
1860 | libchicken_so-file (dest-path (pv lib-dir))) |
---|
1861 | (install install-program-shared-library-options |
---|
1862 | libuchicken_so-file (dest-path (pv lib-dir))))) |
---|
1863 | |
---|
1864 | (if (pv soname-version) |
---|
1865 | (let ((libdir (dest-path (pv lib-dir)))) |
---|
1866 | (symlink libchicken_so-file (s+ "libchicken" (pv SO))) |
---|
1867 | (symlink libuchicken_so-file (s+ "libuchicken" (pv SO))))) |
---|
1868 | |
---|
1869 | |
---|
1870 | (case platform |
---|
1871 | ((mingw mingw-msys cygwin) |
---|
1872 | (install install-program-shared-library-options |
---|
1873 | (s+ "libchickengui" (pv SO)) (dest-path (pv bin-dir))))) |
---|
1874 | )) |
---|
1875 | ))) |
---|
1876 | |
---|
1877 | |
---|
1878 | (define (make-install-rule needs-relinking?) |
---|
1879 | (if needs-relinking? |
---|
1880 | |
---|
1881 | `("install" () |
---|
1882 | ,(lambda () |
---|
1883 | (for-each |
---|
1884 | (lambda (x) |
---|
1885 | (run (,remove-command ,@(pv remove-command-options) ,(s+ x (pv EXE))))) |
---|
1886 | `(,chicken-program ,csi-program ,csc-program |
---|
1887 | ,chicken-profile-program ,chicken-setup-program)) |
---|
1888 | (runtime-linker-path (pv lib-dir) ) |
---|
1889 | (make/proc (cons (make-install-rule #f) (get-rules)) "install" ) |
---|
1890 | (for-each |
---|
1891 | (lambda (x) |
---|
1892 | (run (,(pv make-writable-command) |
---|
1893 | ,(dest-path (s+ (make-pathname (pv bin-dir) x) (pv EXE)))))) |
---|
1894 | `(,chicken-program ,csi-program ,csc-program |
---|
1895 | ,chicken-profile-program ,chicken-setup-program)) |
---|
1896 | (if (not (pv static-build?)) |
---|
1897 | (run (,(pv make-writable-command) |
---|
1898 | ,(dest-path (s+ (make-pathname (pv bin-dir) chicken-setup-program) (pv EXE)))))) |
---|
1899 | )) |
---|
1900 | |
---|
1901 | `("install" ,(append targets (list "install-libs" )) |
---|
1902 | ,(lambda () |
---|
1903 | |
---|
1904 | (if (not (zero? (string-length dest-dir))) |
---|
1905 | (mkdir dest-dir)) |
---|
1906 | |
---|
1907 | (for-each |
---|
1908 | (lambda (x) (mkdir (dest-path (pv x)))) |
---|
1909 | `(,bin-dir ,top-man-dir ,man-dir ,info-dir ,doc-dir)) |
---|
1910 | |
---|
1911 | (for-each |
---|
1912 | (lambda (x) |
---|
1913 | (install install-program-executable-options |
---|
1914 | (s+ x (pv EXE)) (dest-path (pv bin-dir)))) |
---|
1915 | `(,chicken-program ,csi-program ,csc-program |
---|
1916 | ,chicken-profile-program ,chicken-bug-program)) |
---|
1917 | |
---|
1918 | (if (pv postinstall-program) |
---|
1919 | (let ((bdir (dest-path (pv bin-dir)))) |
---|
1920 | (for-each |
---|
1921 | (lambda (x) |
---|
1922 | (run (,(pv postinstall-program) ,@(pv postinstall-program-flags) |
---|
1923 | ,(make-pathname bdir x)))) |
---|
1924 | `(,chicken-program ,csi-program ,csc-program |
---|
1925 | ,chicken-profile-program ,chicken-bug-program)))) |
---|
1926 | |
---|
1927 | (if (not (pv static-build?)) |
---|
1928 | (let ((bdir (dest-path (pv bin-dir)))) |
---|
1929 | (install install-program-executable-options (s+ chicken-setup-program (pv EXE)) bdir) |
---|
1930 | (if (pv postinstall-program) |
---|
1931 | (run (,(pv postinstall-program) ,@(pv postinstall-program-flags) |
---|
1932 | ,(make-pathname bdir chicken-setup-program)))))) |
---|
1933 | |
---|
1934 | (let ((mdir (dest-path (pv man-dir)))) |
---|
1935 | (for-each |
---|
1936 | (lambda (x) (install install-program-file-options (s+ src-dir x) mdir)) |
---|
1937 | `("chicken.1" "csi.1" "csc.1" "chicken-setup.1" "chicken-profile.1" "chicken-bug.1"))) |
---|
1938 | |
---|
1939 | (let ((hdir (make-pathname (dest-path (pv doc-dir)) "html"))) |
---|
1940 | (mkdir hdir) |
---|
1941 | (run* (,install-command ,@(pv install-program-file-options) |
---|
1942 | ,(make-pathname (source-path "html") "*.html") |
---|
1943 | ,hdir))) |
---|
1944 | |
---|
1945 | (run* (,install-command ,@(pv install-program-file-options) "chicken.pdf" |
---|
1946 | ,(dest-path (pv doc-dir)))) |
---|
1947 | |
---|
1948 | (let ((ddir (dest-path (pv doc-dir)))) |
---|
1949 | (for-each |
---|
1950 | (lambda (x) (install install-program-file-options (source-path x) ddir)) |
---|
1951 | `("README" "LICENSE"))) |
---|
1952 | |
---|
1953 | (let ((ddir (dest-path (pv data-dir)))) |
---|
1954 | (for-each |
---|
1955 | (lambda (x) (install install-program-file-options (source-path x) ddir)) |
---|
1956 | `("chicken-more-macros.scm" "chicken-ffi-macros.scm" "chicken-sys-macros.scm")) |
---|
1957 | (run (,install-command ,@(pv install-program-file-options) |
---|
1958 | "*.exports" ,ddir))) |
---|
1959 | |
---|
1960 | |
---|
1961 | (run* (,install-command ,@(pv install-program-file-options) "chicken.info" |
---|
1962 | ,(dest-path (pv info-dir)))) |
---|
1963 | |
---|
1964 | (run* (,install-info-command ,(s+ "--info-dir=" (dest-path (pv info-dir))) |
---|
1965 | "chicken.info")) |
---|
1966 | |
---|
1967 | (case platform |
---|
1968 | ((mingw mingw-msys cygwin) |
---|
1969 | (install install-program-executable-options |
---|
1970 | (source-path "csibatch.bat") |
---|
1971 | (dest-path (pv bin-dir))))) |
---|
1972 | )))) |
---|
1973 | |
---|
1974 | |
---|
1975 | (define install-rule (make-install-rule (pv needs-relinking?))) |
---|
1976 | |
---|
1977 | (define uninstall-rule |
---|
1978 | `("uninstall" () |
---|
1979 | ,(lambda () |
---|
1980 | (let ((bdir (dest-path (pv bin-dir))) |
---|
1981 | (ldir (dest-path (pv lib-dir))) |
---|
1982 | (mdir (dest-path (pv man-dir))) |
---|
1983 | (idir (dest-path (pv inc-dir)))) |
---|
1984 | (for-each |
---|
1985 | (lambda (x) |
---|
1986 | (run (,remove-command ,@(pv remove-command-options) ,(make-pathname bdir (s+ x (pv EXE)))))) |
---|
1987 | `(,chicken-program ,csi-program ,csc-program ,chicken-bug-program |
---|
1988 | ,chicken-profile-program ,chicken-setup-program)) |
---|
1989 | |
---|
1990 | (run (,remove-command ,@(pv remove-command-options) |
---|
1991 | ,@(map (lambda (x) (make-pathname ldir (s+ x "*.*"))) |
---|
1992 | `("libchicken" "libuchicken")))) |
---|
1993 | |
---|
1994 | (run (,remove-command ,@(pv remove-command-options) |
---|
1995 | ,@(map (lambda (x) (make-pathname bdir (s+ x "*.*"))) |
---|
1996 | `("libchicken" "libuchicken")))) |
---|
1997 | |
---|
1998 | (case platform |
---|
1999 | ((cygwin) |
---|
2000 | (run (,remove-command ,@(pv remove-command-options) |
---|
2001 | ,@(map (lambda (x) (make-pathname bdir (s+ x "*.*"))) |
---|
2002 | `("cygchicken" "cyguchicken")))))) |
---|
2003 | |
---|
2004 | (run (,remove-command ,@(pv remove-command-options) |
---|
2005 | ,@(map (lambda (x) (make-pathname mdir (s+ x ".1"))) |
---|
2006 | `(chicken csi csc chicken-profile chicken-setup chicken-bug)))) |
---|
2007 | |
---|
2008 | (run (,remove-command ,@(pv remove-command-options) |
---|
2009 | ,@(map (lambda (x) (make-pathname idir (s+ x ".h"))) |
---|
2010 | `(chicken chicken-config )))) |
---|
2011 | |
---|
2012 | (run (,remove-command ,@(pv remove-command-recursive-options) |
---|
2013 | ,(dest-path (pv data-dir)))) |
---|
2014 | |
---|
2015 | (run* (,uninstall-info-command ,(s+ "--infodir=" (dest-path (pv info-dir))) "chicken.info")) |
---|
2016 | |
---|
2017 | (run* (,remove-command ,@(pv remove-command-options) |
---|
2018 | ,(make-pathname (dest-path (pv info-dir)) "chicken.info"))) |
---|
2019 | |
---|
2020 | |
---|
2021 | (case platform |
---|
2022 | ((cygwin mingw mingw-msys) |
---|
2023 | (run (,remove-command ,@(pv remove-command-options) |
---|
2024 | ,(make-pathname bdir "csibatch.bat"))))) |
---|
2025 | |
---|
2026 | )))) |
---|
2027 | |
---|
2028 | ;; rules for C sources |
---|
2029 | |
---|
2030 | (define library-c-sources-private `(data-structures ports files extras srfi-69)) |
---|
2031 | (define library-c-sources-other `(eval lolevel tcp srfi-1 srfi-4 srfi-13 srfi-14 srfi-18 |
---|
2032 | utils posixunix posixwin scheduler profiler stub match)) |
---|
2033 | |
---|
2034 | (define library_c-rule |
---|
2035 | (let ((target "library.c") |
---|
2036 | (source (map source-path (list "library.scm" "version.scm" "banner.scm")))) |
---|
2037 | `(,target ,source |
---|
2038 | ,(lambda () |
---|
2039 | (run (,(pv chicken-bootstrap) ,(car source) ,@(pv chicken-library-options) |
---|
2040 | ,(s+ "-output-file " target))))))) |
---|
2041 | |
---|
2042 | |
---|
2043 | (define regex_c-rule |
---|
2044 | (let ((target "regex.c") |
---|
2045 | (source (map source-path (list "regex.scm" "version.scm" "banner.scm")))) |
---|
2046 | `(,target ,source |
---|
2047 | ,(lambda () |
---|
2048 | (run (,(pv chicken-bootstrap) ,(car source) |
---|
2049 | ,@(pv chicken-library-options) ,@(pv chicken-pcre-library-options) |
---|
2050 | ,(s+ "-output-file " target))))))) |
---|
2051 | |
---|
2052 | |
---|
2053 | (define library-c-source-private-rules |
---|
2054 | (map (lambda (x) |
---|
2055 | (let ((target (s+ x ".c")) |
---|
2056 | (source (map source-path (list (s+ x ".scm") "private-namespace.scm")))) |
---|
2057 | `(,target ,source |
---|
2058 | ,(lambda () |
---|
2059 | (run (,(pv chicken-bootstrap) ,(car source) ,@(pv chicken-library-options) |
---|
2060 | ,(s+ "-extend " "private-namespace.scm") |
---|
2061 | ,(s+ "-output-file " target))))))) |
---|
2062 | library-c-sources-private)) |
---|
2063 | |
---|
2064 | |
---|
2065 | (define library-c-source-other-rules |
---|
2066 | (map (lambda (x) |
---|
2067 | (let ((target (s+ x ".c")) |
---|
2068 | (source (list (source-path (s+ x ".scm") )))) |
---|
2069 | `(,target ,source |
---|
2070 | ,(lambda () |
---|
2071 | (run (,(pv chicken-bootstrap) ,(car source ) |
---|
2072 | ,@(pv chicken-library-options) |
---|
2073 | ,(s+ "-output-file " target))))))) |
---|
2074 | library-c-sources-other)) |
---|
2075 | |
---|
2076 | |
---|
2077 | (define ulibrary_c-rule |
---|
2078 | (let ((target "ulibrary.c") |
---|
2079 | (source (map source-path (list "library.scm" "version.scm" "banner.scm")))) |
---|
2080 | `(,target ,source |
---|
2081 | ,(lambda () |
---|
2082 | (run (,(pv chicken-bootstrap) ,(car source ) |
---|
2083 | ,@(pv chicken-library-options) ,@(pv chicken-unsafe-options) |
---|
2084 | ,(s+ "-output-file " target))))))) |
---|
2085 | |
---|
2086 | |
---|
2087 | (define uregex_c-rule |
---|
2088 | (let ((target "uregex.c") |
---|
2089 | (source (map source-path (list "regex.scm" "version.scm" "banner.scm")))) |
---|
2090 | `(,target ,source |
---|
2091 | ,(lambda () |
---|
2092 | (run (,(pv chicken-bootstrap) ,(car source ) |
---|
2093 | ,@(pv chicken-library-options) ,@(pv chicken-unsafe-options) |
---|
2094 | ,@(pv chicken-pcre-library-options) |
---|
2095 | ,(s+ "-output-file " target))))))) |
---|
2096 | |
---|
2097 | |
---|
2098 | (define library-c-source-private-unsafe-rules |
---|
2099 | (map (lambda (x) |
---|
2100 | (let ((target (s+ "u" x ".c")) |
---|
2101 | (source (map source-path (list (s+ x ".scm") "private-namespace.scm")))) |
---|
2102 | `(,target ,source |
---|
2103 | ,(lambda () |
---|
2104 | (run (,(pv chicken-bootstrap) ,(car source ) |
---|
2105 | ,@(pv chicken-library-options) ,@(pv chicken-unsafe-options) |
---|
2106 | ,(s+ "-extend " "private-namespace.scm") |
---|
2107 | ,(s+ "-output-file " target))))))) |
---|
2108 | library-c-sources-private)) |
---|
2109 | |
---|
2110 | |
---|
2111 | (define library-c-source-other-unsafe-rules |
---|
2112 | (map (lambda (x) |
---|
2113 | (let ((target (s+ "u" x ".c")) |
---|
2114 | (source (list (source-path (s+ x ".scm") )))) |
---|
2115 | `(,target ,source |
---|
2116 | ,(lambda () |
---|
2117 | (run (,(pv chicken-bootstrap) ,(car source ) |
---|
2118 | ,@(pv chicken-library-options) ,@(pv chicken-unsafe-options) |
---|
2119 | ,(s+ "-output-file " target))))))) |
---|
2120 | library-c-sources-other)) |
---|
2121 | |
---|
2122 | (define chicken-c-sources |
---|
2123 | `(support compiler optimizer batch-driver c-platform c-backend )) |
---|
2124 | |
---|
2125 | (define chicken_c-rule |
---|
2126 | (let ((target "chicken.c") |
---|
2127 | (source (map source-path |
---|
2128 | (list "chicken.scm" "chicken-more-macros.scm" "chicken-ffi-macros.scm" |
---|
2129 | "private-namespace.scm")))) |
---|
2130 | `(,target ,source |
---|
2131 | ,(lambda () |
---|
2132 | (run (,(pv chicken-bootstrap) ,(car source ) |
---|
2133 | ,@(pv chicken-compiler-options) |
---|
2134 | ,(s+ "-output-file " target))))))) |
---|
2135 | |
---|
2136 | (define chicken-c-source-rules |
---|
2137 | (map (lambda (x) |
---|
2138 | (let ((target (s+ x ".c")) |
---|
2139 | (source (map source-path |
---|
2140 | ((lambda (lst) |
---|
2141 | (case x |
---|
2142 | ((support) (append lst (list "banner.scm"))) |
---|
2143 | (else lst))) |
---|
2144 | (list (s+ x ".scm") "private-namespace.scm"))))) |
---|
2145 | `(,target ,source |
---|
2146 | ,(lambda () |
---|
2147 | (run (,(pv chicken-bootstrap) ,(car source) ,@(pv chicken-compiler-options) |
---|
2148 | ,(s+ "-output-file " target))))))) |
---|
2149 | chicken-c-sources)) |
---|
2150 | |
---|
2151 | (define csi_c-rule |
---|
2152 | (let ((target "csi.c") |
---|
2153 | (source (map source-path |
---|
2154 | (list "csi.scm" "banner.scm" "chicken-more-macros.scm" |
---|
2155 | "private-namespace.scm")))) |
---|
2156 | `(,target ,source |
---|
2157 | ,(lambda () |
---|
2158 | (run (,(pv chicken-bootstrap) ,(car source ) |
---|
2159 | ,@(pv chicken-program-options) ,(s+ "-extend " "private-namespace.scm") |
---|
2160 | ,(s+ "-output-file " target))))))) |
---|
2161 | |
---|
2162 | |
---|
2163 | (define chicken-setup_c-rule |
---|
2164 | (let ((target "chicken-setup.c") |
---|
2165 | (source (map source-path (list "chicken-setup.scm" "chicken-more-macros.scm" )))) |
---|
2166 | `(,target ,source |
---|
2167 | ,(lambda () |
---|
2168 | (run (,(pv chicken-bootstrap) ,(car source ) |
---|
2169 | ,@(pv chicken-program-options) |
---|
2170 | ,(s+ "-output-file " target))))))) |
---|
2171 | |
---|
2172 | |
---|
2173 | (define chicken-program-c-sources `(chicken-profile csc chicken-bug)) |
---|
2174 | |
---|
2175 | (define chicken-program-c-source-rules |
---|
2176 | (map (lambda (x) |
---|
2177 | (let ((target (s+ x ".c")) |
---|
2178 | (source (map source-path (list (s+ x ".scm") )))) |
---|
2179 | `(,target ,source |
---|
2180 | ,(lambda () |
---|
2181 | (run (,(pv chicken-bootstrap) ,(car source) ,@(pv chicken-program-options) |
---|
2182 | ,(s+ "-output-file " target))))))) |
---|
2183 | chicken-program-c-sources)) |
---|
2184 | |
---|
2185 | ;; distribution files |
---|
2186 | |
---|
2187 | (define distfiles-rule |
---|
2188 | `("distfiles" |
---|
2189 | ,(cons "buildsvnrevision" |
---|
2190 | (map (lambda (x) (s+ x ".c")) |
---|
2191 | `(library eval data-structures ports files extras lolevel |
---|
2192 | utils tcp srfi-1 srfi-4 srfi-13 srfi-14 srfi-18 srfi-69 posixunix |
---|
2193 | posixwin regex scheduler profiler stub match ulibrary ueval |
---|
2194 | udata-structures uports ufiles uextras ulolevel uutils utcp usrfi-1 |
---|
2195 | usrfi-4 usrfi-13 usrfi-14 usrfi-18 usrfi-69 uposixunix uposixwin |
---|
2196 | uregex chicken-profile chicken-setup csc csi chicken batch-driver |
---|
2197 | compiler optimizer support c-platform c-backend chicken-bug))) |
---|
2198 | ,(lambda () (call-with-output-file "distfiles" (lambda (out) (display "" out)))))) |
---|
2199 | |
---|
2200 | ;; cleaning up |
---|
2201 | |
---|
2202 | (define clean-rule |
---|
2203 | `("clean" () |
---|
2204 | ,(lambda () |
---|
2205 | (run* (,remove-command |
---|
2206 | ,@(pv remove-command-options) |
---|
2207 | ,@(filter identity |
---|
2208 | (let ((lst (append pcre-objects0 |
---|
2209 | `(runtime uruntime |
---|
2210 | library eval data-structures ports files |
---|
2211 | extras lolevel utils tcp srfi-1 srfi-4 srfi-13 srfi-14 srfi-18 srfi-69 |
---|
2212 | posixunix posixwin regex scheduler profiler stub match ulibrary ueval |
---|
2213 | udata-structures uports ufiles uextras ulolevel uutils utcp usrfi-1 |
---|
2214 | usrfi-4 usrfi-13 usrfi-14 usrfi-18 usrfi-69 uposixunix uposixwin |
---|
2215 | uregex chicken-profile chicken-setup chicken-bug csc csi chicken |
---|
2216 | batch-driver compiler optimizer support c-platform c-backend)))) |
---|
2217 | (append |
---|
2218 | (list libchicken_so-file libuchicken_so-file libchickengui_so-file |
---|
2219 | "bootstrap.tar.gz" "chicken.info" (pv apply-hack-object)) |
---|
2220 | (pv clean-mingw-libs) |
---|
2221 | (map (lambda (x) (s+ x (pv EXE))) |
---|
2222 | `(chicken csi csc chicken-setup chicken-boot |
---|
2223 | chicken-profile csi-static csc-static |
---|
2224 | chicken-static chicken-bug)) |
---|
2225 | (map (lambda (x) (s+ x (pv A))) `(libchicken libuchicken libchickengui)) |
---|
2226 | (map (lambda (x) (s+ x (pv O))) lst) |
---|
2227 | (map (lambda (x) (s+ x "-static" (pv O))) lst) |
---|
2228 | )))))))) |
---|
2229 | |
---|
2230 | (define confclean-rule |
---|
2231 | `("confclean" () |
---|
2232 | ,(lambda () |
---|
2233 | (run* (,remove-command ,@(pv remove-command-options) |
---|
2234 | "chicken-config.h" "chicken-defaults.h" "buildsvnrevision"))))) |
---|
2235 | |
---|
2236 | (define spotless-rule |
---|
2237 | `("spotless" ("distclean") |
---|
2238 | ,(lambda () |
---|
2239 | (run* (,remove-command ,@(pv remove-command-options) |
---|
2240 | ,@(cons* "*.exports" "distfiles" |
---|
2241 | (map (lambda (x) (s+ x ".c")) |
---|
2242 | `(library eval data-structures ports files |
---|
2243 | extras lolevel utils tcp srfi-1 srfi-4 srfi-13 srfi-14 srfi-18 srfi-69 |
---|
2244 | posixunix posixwin regex scheduler profiler stub match ulibrary ueval |
---|
2245 | udata-structures uports ufiles uextras ulolevel uutils utcp usrfi-1 |
---|
2246 | usrfi-4 usrfi-13 usrfi-14 usrfi-18 usrfi-69 uposixunix uposixwin |
---|
2247 | uregex chicken-profile chicken-setup chicken-bug csc csi chicken |
---|
2248 | batch-driver compiler optimizer support c-platform c-backend)))))))) |
---|
2249 | |
---|
2250 | (define distclean-rule |
---|
2251 | `("distclean" ("clean" "confclean") )) |
---|
2252 | |
---|
2253 | ;; run tests |
---|
2254 | |
---|
2255 | (define check-rule |
---|
2256 | `("check" ("all") |
---|
2257 | ,(lambda () (run (cd tests "; " sh runtests.sh))))) |
---|
2258 | |
---|
2259 | |
---|
2260 | ;; Only for UNIX, yet: |
---|
2261 | |
---|
2262 | (define fullcheck-rule |
---|
2263 | `("fullcheck" ("check" "compiler-check"))) |
---|
2264 | |
---|
2265 | (define compiler-check-rule |
---|
2266 | `("compiler-check" () |
---|
2267 | ,(lambda () |
---|
2268 | (print "======================================== packing ...") |
---|
2269 | (make/proc (get-rules) "dist" ) |
---|
2270 | (run (,(pv remove-command) ,@(pv remove-command-recursive-options) |
---|
2271 | "tests/chicken-*") |
---|
2272 | (tar "-C tests" -zxf "`ls -t chicken-*.tar.gz | head -1`")) |
---|
2273 | |
---|
2274 | (print "======================================== building stage 1 ...") |
---|
2275 | (let* ((cwd (current-directory)) |
---|
2276 | (options1 (cons '(static-build . #t) options)) |
---|
2277 | (rules1 (compute-rules options1))) |
---|
2278 | (current-directory (ipipe read-line (sh -c "\"ls tests/chicken-*\""))) |
---|
2279 | (compute-rules (cons '(static-build . #t) options))) |
---|
2280 | (make/proc rules1 "confclean") |
---|
2281 | (make/proc rules1 "all") |
---|
2282 | (run (sh -c "\"touch *.scm\"")) |
---|
2283 | (current-directory cwd) |
---|
2284 | |
---|
2285 | (print "======================================== building stage 2 ...") |
---|
2286 | (let ((cwd (current-directory))) |
---|
2287 | (current-directory (ipipe read-line (ls "tests/chicken-*"))) |
---|
2288 | (make/proc (get-rules) "confclean") |
---|
2289 | (make/proc (get-rules) "all") |
---|
2290 | (current-directory cwd) |
---|
2291 | (run (cat "tests/chicken-*/*.c" > "tests/stage2.out"))) |
---|
2292 | |
---|
2293 | (print "======================================== building stage 3 ...") |
---|
2294 | (let ((cwd (current-directory))) |
---|
2295 | (current-directory (ipipe read-line (ls -l "tests/chicken-*"))) |
---|
2296 | (make/proc (get-rules) "confclean") |
---|
2297 | (make/proc (get-rules) "all") |
---|
2298 | (current-directory cwd) |
---|
2299 | (run (cat "tests/chicken-*/*.c" > "tests/stage3.out")) |
---|
2300 | (run (diff "tests/stage2.out" "tests/stage3.out" > "tests/stages.diff")) |
---|
2301 | (run (,(pv remove-command) ,@(pv remove-command-recursive-options) "tests/chicken-*")))))) |
---|
2302 | |
---|
2303 | |
---|
2304 | ;; bootstrap from C source tarball |
---|
2305 | |
---|
2306 | (define bootstrap-rule |
---|
2307 | (let ((archive "bootstrap.tar.gz")) |
---|
2308 | `("bootstrap" (,archive) |
---|
2309 | ,(lambda () |
---|
2310 | (run (gzip -d ,(s+ "-c " archive) "|" tar xvf -)) |
---|
2311 | (run (touch "*.c")) |
---|
2312 | (make/proc (compute-rules (cons '(static-build . #t) options)) (s+ "chicken" (pv EXE))) |
---|
2313 | (run (cp ,(s+ "chicken" (pv EXE)) ,(s+ "chicken-boot" (pv EXE)))) |
---|
2314 | (run (sh -c "\"touch *.scm\"")) |
---|
2315 | )))) |
---|
2316 | |
---|
2317 | (define bootstrap_tar_gz-rule |
---|
2318 | (let ((target "bootstrap.tar.gz")) |
---|
2319 | `(,target ("distfiles") |
---|
2320 | ,(lambda () |
---|
2321 | (run (tar cfz ,target |
---|
2322 | ,@(map (lambda (x) (s+ x ".c")) |
---|
2323 | (append `(library eval data-structures ports files extras |
---|
2324 | lolevel utils tcp srfi-1 srfi-4 srfi-13 srfi-14 srfi-18 srfi-69 |
---|
2325 | posixunix posixwin regex scheduler profiler stub match) |
---|
2326 | compiler-objects0)))))))) |
---|
2327 | |
---|
2328 | |
---|
2329 | (define rules |
---|
2330 | (append |
---|
2331 | `( |
---|
2332 | ,all-rule |
---|
2333 | ,buildsvnrevision-rule |
---|
2334 | ,chicken-config_h-rule |
---|
2335 | ,chicken-defaults_h-rule |
---|
2336 | ,chicken_h-rule |
---|
2337 | ,libchicken_so-rule |
---|
2338 | ,libuchicken_so-rule |
---|
2339 | ,cygchicken-0.dll-rule |
---|
2340 | ,cyguchicken-0.dll-rule |
---|
2341 | ,libchickengui-so-rule |
---|
2342 | ,libchicken_a-rule |
---|
2343 | ,libuchicken_a-rule |
---|
2344 | ,libchickengui_a-rule |
---|
2345 | ,libs-rule |
---|
2346 | ,chicken-shared-executable-rule |
---|
2347 | ,csi-shared-executable-rule |
---|
2348 | ,chicken-setup-program-rule |
---|
2349 | ,chicken-profile-program-rule |
---|
2350 | ,csc-program-rule |
---|
2351 | ,chicken-static-executable-rule |
---|
2352 | ,csi-static-executable-rule |
---|
2353 | ,chicken-bug-program-rule |
---|
2354 | ,chicken_info-rule |
---|
2355 | ,install-libs-rule |
---|
2356 | ,install-rule |
---|
2357 | ,uninstall-rule |
---|
2358 | ,library_c-rule |
---|
2359 | ,regex_c-rule |
---|
2360 | ,ulibrary_c-rule |
---|
2361 | ,uregex_c-rule |
---|
2362 | ,chicken_c-rule |
---|
2363 | ,csi_c-rule |
---|
2364 | ,chicken-setup_c-rule |
---|
2365 | ,distfiles-rule |
---|
2366 | ,clean-rule |
---|
2367 | ,confclean-rule |
---|
2368 | ,spotless-rule |
---|
2369 | ,distclean-rule |
---|
2370 | ,check-rule |
---|
2371 | ,fullcheck-rule |
---|
2372 | ,compiler-check-rule |
---|
2373 | ,bootstrap-rule |
---|
2374 | ,bootstrap_tar_gz-rule |
---|
2375 | ) |
---|
2376 | apply-hack-object-rules |
---|
2377 | library-objects-rules |
---|
2378 | library-unsafe-objects-rules |
---|
2379 | library-static-objects-rules |
---|
2380 | library-unsafe-static-objects-rules |
---|
2381 | compiler-objects-rules |
---|
2382 | compiler-static-objects-rules |
---|
2383 | pcre-objects-rules |
---|
2384 | pcre-static-objects-rules |
---|
2385 | program-objects-rules |
---|
2386 | program-static-objects-rules |
---|
2387 | library-c-source-private-rules |
---|
2388 | library-c-source-other-rules |
---|
2389 | library-c-source-private-unsafe-rules |
---|
2390 | library-c-source-other-unsafe-rules |
---|
2391 | chicken-c-source-rules |
---|
2392 | chicken-program-c-source-rules |
---|
2393 | )) |
---|
2394 | |
---|
2395 | (define (get-rules) (filter (lambda (x) (car x)) rules)) |
---|
2396 | |
---|
2397 | (get-rules)) |
---|
2398 | |
---|
2399 | (define (main options operands) |
---|
2400 | (if (print-rules) |
---|
2401 | (begin (pretty-print rules) |
---|
2402 | (exit 1))) |
---|
2403 | (if (null? operands) (usage)) |
---|
2404 | (for-each (lambda (target) (make/proc (compute-rules options) (->string target ))) operands)) |
---|
2405 | |
---|
2406 | |
---|
2407 | (main options operands) |
---|
2408 | |
---|