3 (cl:defpackage #:bench-defsystem
5 (cl:in-package #:bench-defsystem)
7 (defclass c-source-file (asdf:source-file)
8 ((type :initform "c")))
10 (defmethod asdf:output-files ((o asdf:compile-op) (c c-source-file))
12 (make-pathname :type "O" :case :common :defaults f))
13 (asdf:input-files o c)))
15 (defmethod asdf:perform ((o asdf:load-op) (c c-source-file))
18 (defmethod asdf:perform ((o asdf:compile-op) (c c-source-file))
19 (mapc (lambda (in out)
20 (uiop:run-program (list "gcc" "-c" "-O2" "-g" "-Wall" "-fPIC"
22 "-o" (uiop:native-namestring out)
23 (uiop:native-namestring in))))
24 (asdf:input-files o c)
25 (asdf:output-files o c)))
27 (defclass c-shared-lib (asdf:module)
28 ((soname :initarg :soname :initform nil)))
30 (defmethod asdf:output-files ((o asdf:compile-op) (c c-shared-lib))
31 (list (make-pathname :name (or (slot-value c 'soname)
32 (asdf:component-name c))
35 (defmethod asdf:perform ((o asdf:compile-op) (c c-shared-lib))
36 (let ((out (asdf:output-files o c)))
37 (assert (and out (null (cdr out))))
38 (uiop:run-program (list* "gcc"
40 "-o" (uiop:native-namestring (car out))
43 (mapcar #'uiop:native-namestring
44 (asdf:output-files o kid)))
45 (asdf:component-children c))))))
47 (asdf:defsystem "bench"
49 :pathname "/home/mdw/src/bench/"
52 ((c-shared-lib "benchspt"
56 ((c-source-file "benchspt")))
57 (:file "bench" :depends-on ("benchspt"))))