ECL - dump c source for every compilation unit and its dependencies?
Asked Answered
G

1

7

I have the following package definition. How do I compile all the components recursively, as well as their dependencies to C source? In other words, I want to preserve all C files that go into building the native executable.

Currently, i use (asdf:make-build :example but that doesnt leave any C files around.

I'm expecting to see

simple.c
simple.h
simple.data
cl-opengl.c
cl-opengl.h
...

example.asd:

(defsystem :example
  :depends-on (:cl-opengl :cl-glu :cl-glut)
  :serial t
  :components ((:file "simple")))

cl-opengl.asd:

(defsystem cl-opengl
  :description "Common Lisp bindings to OpenGL."
  :depends-on (cffi alexandria)
  :components
  ((:module "gl"
    :components
    ((:file "bindings-package")
     (:file "constants" :depends-on ("bindings-package"))
     (:file "library" :depends-on ("bindings-package"))
     (:file "bindings" :depends-on ("bindings-package" "constants" "library"))
     ...
Ginny answered 1/3, 2013 at 17:57 Comment(1)
did you manage to compile the resulting .c files into a standalone executable? (what i'm trying to achieve is to cross-compile the generated .c files with a cross-compiling gcc)Ogdon
H
10

As explained in the ECL mailing list, setting c::*delete-files* to NIL will prevent the compiler from deleting the intermediate C files. They have extensions *.c, *.eclh (header) and *.data (text definitions of objects), but their names are massaged by ASDF (they get some ASDF- prefix IIRC) and they are not created where the lisp sources live, but rather at ASDF's cache directory (typically ~/.cache/common-lisp/ecl-...)

Holsinger answered 2/3, 2013 at 10:48 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.