;;; -*-lisp-*- (cl:defpackage #:bench-defsystem (:use #:common-lisp)) (cl:in-package #:bench-defsystem) (defclass c-source-file (asdf:source-file) ((type :initform "c"))) (defmethod asdf:output-files ((o asdf:compile-op) (c c-source-file)) (mapcar (lambda (f) (make-pathname :type "O" :case :common :defaults f)) (asdf:input-files o c))) (defmethod asdf:perform ((o asdf:load-op) (c c-source-file)) #| nothing to do |#) (defmethod asdf:perform ((o asdf:compile-op) (c c-source-file)) (mapc (lambda (in out) (uiop:run-program (list "gcc" "-c" "-O2" "-g" "-Wall" "-fPIC" #+cmu "-m32" "-o" (uiop:native-namestring out) (uiop:native-namestring in)))) (asdf:input-files o c) (asdf:output-files o c))) (defclass c-shared-lib (asdf:module) ((soname :initarg :soname :initform nil))) (defmethod asdf:output-files ((o asdf:compile-op) (c c-shared-lib)) (list (make-pathname :name (or (slot-value c 'soname) (asdf:component-name c)) :type "so"))) (defmethod asdf:perform ((o asdf:compile-op) (c c-shared-lib)) (let ((out (asdf:output-files o c))) (assert (and out (null (cdr out)))) (uiop:run-program (list* "gcc" #+cmu "-m32" "-o" (uiop:native-namestring (car out)) "-shared" (mapcan (lambda (kid) (mapcar #'uiop:native-namestring (asdf:output-files o kid))) (asdf:component-children c)))))) (asdf:defsystem "bench" :version "0.1.0" :pathname "/home/mdw/src/bench/" :depends-on ("cffi") :components ((c-shared-lib "benchspt" :soname "libbenchspt" :pathname "" :components ((c-source-file "benchspt"))) (:file "bench" :depends-on ("benchspt"))))