added automatic variables in (currently only) gnu style.
fixed a small bug: with-cwd and file-name-nondirectory was needed to build
This commit is contained in:
parent
62be1f7142
commit
12aa087ddf
|
@ -14,123 +14,102 @@
|
||||||
"show-sqrt"
|
"show-sqrt"
|
||||||
"manual.dvi" "manual.pdf" "manual.log" "manual.aux"))
|
"manual.dvi" "manual.pdf" "manual.log" "manual.aux"))
|
||||||
|
|
||||||
(define rule-set
|
(define file-set
|
||||||
(makefile
|
(makefile
|
||||||
;;
|
;;
|
||||||
|
;; create a configfile
|
||||||
|
;;
|
||||||
|
(md5 "config.h"
|
||||||
|
()
|
||||||
|
(let ((outport (open-output-file ($@))))
|
||||||
|
(with-current-output-port outport
|
||||||
|
(display "#ifndef MY_DELTA_MAX\n")
|
||||||
|
(display "#define MY_DELTA_MAX 0.000000001\n")
|
||||||
|
(display "#endif\n")
|
||||||
|
(close-output-port outport))))
|
||||||
|
;;
|
||||||
;; build libmymath.*
|
;; build libmymath.*
|
||||||
;;
|
;;
|
||||||
(md5 "mymath.o"
|
(file "mymath.o"
|
||||||
("config.h" "mymath.c")
|
("mymath.c" "config.h")
|
||||||
(lambda ()
|
(run (gcc -fPIC -c ,($<))))
|
||||||
(run (gcc -fPIC -c ,"mymath.c"))))
|
(file "libmymath.so.1.0"
|
||||||
(rule "libmymath.so.1.0"
|
|
||||||
("mymath.o")
|
("mymath.o")
|
||||||
(lambda ()
|
(run (gcc -shared ,"-Wl,-soname,libmymath.so.1" -o ,($@) ,($<))))
|
||||||
(run (gcc -shared ,"-Wl,-soname,libmymath.so.1"
|
|
||||||
-o ,"libmymath.so.1.0" ,"mymath.o"))))
|
|
||||||
;;
|
;;
|
||||||
;; build wildio.*
|
;; build wildio.*
|
||||||
;;
|
;;
|
||||||
(rule "wildio.o"
|
(file "wildio.o"
|
||||||
("wildio.c")
|
("wildio.c")
|
||||||
(lambda ()
|
(run (gcc -fPIC -c ,($<))))
|
||||||
(run (gcc -fPIC -c ,"wildio.c"))))
|
(file "libwildio.so.1.0"
|
||||||
(rule "libwildio.so.1.0"
|
|
||||||
("wildio.o")
|
("wildio.o")
|
||||||
(lambda ()
|
(run (gcc -shared "-Wl,-soname,libwildio.so.1" -o ,($@) ,($<))))
|
||||||
(run (gcc -shared "-Wl,-soname,libwildio.so.1"
|
|
||||||
-o ,"libwildio.so.1.0" ,"wildio.o"))))
|
|
||||||
;;
|
;;
|
||||||
;; build the program
|
;; build the program
|
||||||
;;
|
;;
|
||||||
(rule "show-sqrt"
|
(md5 "show-sqrt"
|
||||||
("libmymath.so.1" "libwildio.so.1" "main.c" "wildio.h" "mymath.h")
|
("main.c" "libmymath.so.1" "libwildio.so.1" "wildio.h" "mymath.h")
|
||||||
(lambda ()
|
(run (gcc -L ,(cwd) -L ,my-lib-dir -rdynamic
|
||||||
(run (gcc -L ,"." -L ,my-lib-dir -rdynamic
|
-o ,($@) ,($<) ,"libwildio.so.1" ,"libmymath.so.1" -ldl)))
|
||||||
-o ,(expand-file-name "show-sqrt" (cwd))
|
|
||||||
,(expand-file-name "main.c" (cwd))
|
|
||||||
,(expand-file-name "libwildio.so.1" (cwd))
|
|
||||||
,(expand-file-name "libmymath.so.1" (cwd)) -ldl))))
|
|
||||||
;;
|
;;
|
||||||
;; install libs
|
;; install libs
|
||||||
;;
|
;;
|
||||||
(rule "libmymath.so.1"
|
(file "libmymath.so.1"
|
||||||
("libmymath.so.1.0")
|
("libmymath.so.1.0")
|
||||||
(lambda ()
|
(create-symlink ($<) ($@)))
|
||||||
(create-symlink "libmymath.so.1.0" "libmymath.so.1")))
|
(file "libmymath.so"
|
||||||
(rule "libmymath.so"
|
|
||||||
("libmymath.so.1")
|
("libmymath.so.1")
|
||||||
(lambda ()
|
(create-symlink ($<) ($@)))
|
||||||
(create-symlink "libmymath.so.1" "libmymath.so")))
|
(file "libwildio.so.1"
|
||||||
(rule "libwildio.so.1"
|
|
||||||
("libwildio.so.1.0")
|
("libwildio.so.1.0")
|
||||||
(lambda ()
|
(create-symlink ($<) ($@)))
|
||||||
(create-symlink "libwildio.so.1.0" "libwildio.so.1")))
|
(file "libwildio.so"
|
||||||
(rule "libwildio.so"
|
|
||||||
("libwildio.so.1")
|
("libwildio.so.1")
|
||||||
(lambda ()
|
(create-symlink ($<) ($@)))
|
||||||
(create-symlink "libwildio.so.1" "libwildio.so")))
|
(file (string-append my-lib-dir "/" "libmymath.so.1")
|
||||||
(rule (string-append my-lib-dir "/" "libmymath.so.1")
|
|
||||||
((string-append my-lib-dir "/" "libmymath.so.1.0"))
|
((string-append my-lib-dir "/" "libmymath.so.1.0"))
|
||||||
(lambda ()
|
(with-cwd ($@/) (create-symlink (/$<) (/$@))))
|
||||||
(with-cwd my-lib-dir
|
(file (string-append my-lib-dir "/" "libmymath.so")
|
||||||
(create-symlink "libmymath.so.1.0" "libmymath.so.1"))))
|
|
||||||
(rule (string-append my-lib-dir "/" "libmymath.so")
|
|
||||||
((string-append my-lib-dir "/" "libmymath.so.1"))
|
((string-append my-lib-dir "/" "libmymath.so.1"))
|
||||||
(lambda ()
|
(with-cwd ($@/) (create-symlink (/$<) (/$@))))
|
||||||
(with-cwd my-lib-dir
|
(file (string-append my-lib-dir "/" "libwildio.so.1")
|
||||||
(create-symlink "libmymath.so.1" "libmymath.so"))))
|
|
||||||
(rule (string-append my-lib-dir "/" "libwildio.so.1")
|
|
||||||
((string-append my-lib-dir "/" "libwildio.so.1.0"))
|
((string-append my-lib-dir "/" "libwildio.so.1.0"))
|
||||||
(lambda ()
|
(with-cwd ($@/) (create-symlink (/$<) (/$@))))
|
||||||
(with-cwd my-lib-dir
|
(file (string-append my-lib-dir "/" "libwildio.so")
|
||||||
(create-symlink "libwildio.so.1.0" "libwildio.so.1"))))
|
|
||||||
(rule (string-append my-lib-dir "/" "libwildio.so")
|
|
||||||
((string-append my-lib-dir "/" "libwildio.so.1"))
|
((string-append my-lib-dir "/" "libwildio.so.1"))
|
||||||
(lambda ()
|
(with-cwd ($@/) (create-symlink (/$<) (/$@))))
|
||||||
(with-cwd my-lib-dir
|
(file (string-append my-lib-dir "/" "libwildio.so.1.0")
|
||||||
(create-symlink "libwildio.so.1" "libwildio.so"))))
|
("libwildio.so.1.0" my-lib-dir)
|
||||||
(rule (string-append my-lib-dir "/" "libwildio.so.1.0")
|
(run (cp ,($<) ,($@))))
|
||||||
(my-lib-dir "libwildio.so.1.0")
|
(file (string-append my-lib-dir "/" "libmymath.so.1.0")
|
||||||
(lambda ()
|
("libmymath.so.1.0" my-lib-dir)
|
||||||
(run (cp ,"libwildio.so.1.0"
|
(run (cp ,($<) ,($@))))
|
||||||
,(string-append my-lib-dir "/" "libwildio.so.1.0")))))
|
|
||||||
(rule (string-append my-lib-dir "/" "libmymath.so.1.0")
|
|
||||||
(my-lib-dir "libmymath.so.1.0")
|
|
||||||
(lambda ()
|
|
||||||
(run (cp ,"libmymath.so.1.0"
|
|
||||||
,(string-append my-lib-dir "/" "libmymath.so.1.0")))))
|
|
||||||
;;
|
;;
|
||||||
;; install the program
|
;; install the program
|
||||||
;;
|
;;
|
||||||
(rule (string-append my-bin-dir "/" "show-sqrt")
|
(file (string-append my-bin-dir "/" "show-sqrt")
|
||||||
(my-bin-dir "show-sqrt")
|
("show-sqrt" my-bin-dir)
|
||||||
(lambda ()
|
(run (cp ,($<) ,($@))))
|
||||||
(run (cp ,"show-sqrt"
|
|
||||||
,(string-append my-bin-dir "/" "show-sqrt")))))
|
|
||||||
;;
|
;;
|
||||||
;; build the manual
|
;; build the manual
|
||||||
;;
|
;;
|
||||||
(md5 "manual.dvi"
|
(md5 "manual.dvi"
|
||||||
("manual.tex")
|
("manual.tex")
|
||||||
(lambda ()
|
(run (latex ,($<))))
|
||||||
(run (latex ,"manual.tex"))))
|
(file "manual.pdf"
|
||||||
(rule "manual.pdf"
|
|
||||||
("manual.dvi")
|
("manual.dvi")
|
||||||
(lambda ()
|
(run (dvipdfm -o ,($@) ,($<))))
|
||||||
(run (dvipdfm -o ,"manual.pdf" ,"manual.dvi"))))
|
|
||||||
;;
|
;;
|
||||||
;; install the manual
|
;; install the manual
|
||||||
;;
|
;;
|
||||||
(rule (string-append my-install-doc-dir "/" "manual.pdf")
|
(file (string-append my-install-doc-dir "/" "manual.pdf")
|
||||||
(my-install-doc-dir "manual.pdf")
|
("manual.pdf" my-install-doc-dir)
|
||||||
(lambda ()
|
(run (cp ,($<) ,($@))))
|
||||||
(run (cp "manual.pdf"
|
|
||||||
,(string-append my-install-doc-dir "/" "manual.pdf")))))
|
|
||||||
;;
|
;;
|
||||||
;; install all
|
;; install all
|
||||||
;;
|
;;
|
||||||
(rule "install"
|
(always "install"
|
||||||
((string-append my-lib-dir "/" "libmymath.so.1.0")
|
((string-append my-lib-dir "/" "libmymath.so.1.0")
|
||||||
(string-append my-lib-dir "/" "libwildio.so.1.0")
|
(string-append my-lib-dir "/" "libwildio.so.1.0")
|
||||||
(string-append my-lib-dir "/" "libmymath.so.1")
|
(string-append my-lib-dir "/" "libmymath.so.1")
|
||||||
|
@ -139,56 +118,32 @@
|
||||||
(string-append my-lib-dir "/" "libwildio.so")
|
(string-append my-lib-dir "/" "libwildio.so")
|
||||||
(string-append my-bin-dir "/" "show-sqrt")
|
(string-append my-bin-dir "/" "show-sqrt")
|
||||||
(string-append my-install-doc-dir "/" "manual.pdf"))
|
(string-append my-install-doc-dir "/" "manual.pdf"))
|
||||||
(lambda ()
|
(display "install done.\n"))
|
||||||
(display "install done.\n")))
|
|
||||||
;;
|
;;
|
||||||
;; create checksums.md5
|
;; clean files
|
||||||
;;
|
|
||||||
(once "checksums.md5"
|
|
||||||
("manual.tex" "main.c" "mymath.c"
|
|
||||||
"mymath.h" "wildio.c" "wildio.h" "config.h")
|
|
||||||
(lambda ()
|
|
||||||
(let ((outport (open-output-file (expand-file-name "checksums.md5"
|
|
||||||
(cwd)))))
|
|
||||||
(with-current-output-port outport (display ""))
|
|
||||||
(close-output-port outport))))
|
|
||||||
(rule "config.h"
|
|
||||||
()
|
|
||||||
(lambda ()
|
|
||||||
(let ((outport (open-output-file
|
|
||||||
(expand-file-name "config.h" (cwd)))))
|
|
||||||
(with-current-output-port
|
|
||||||
outport
|
|
||||||
(display "#ifndef MY_DELTA_MAX\n")
|
|
||||||
(display "#define MY_DELTA_MAX 0.000000001\n")
|
|
||||||
(display "#endif\n")
|
|
||||||
(close-output-port outport)))))
|
|
||||||
;;
|
|
||||||
;; clean rules
|
|
||||||
;;
|
;;
|
||||||
(always "clean"
|
(always "clean"
|
||||||
()
|
()
|
||||||
(lambda ()
|
|
||||||
(for-each (lambda (f)
|
(for-each (lambda (f)
|
||||||
(delete-filesys-object (expand-file-name f (cwd))))
|
(delete-filesys-object (expand-file-name f (cwd))))
|
||||||
clean-files)))
|
clean-files))
|
||||||
;;
|
;;
|
||||||
;; clean rules
|
;; clean files
|
||||||
;;
|
;;
|
||||||
(always "mrproper"
|
(always "mrproper"
|
||||||
("clean")
|
("clean")
|
||||||
(lambda ()
|
|
||||||
(for-each (lambda (f)
|
(for-each (lambda (f)
|
||||||
(delete-filesys-object (expand-file-name f (cwd))))
|
(delete-filesys-object (expand-file-name f (cwd))))
|
||||||
(list "checksums.md5"))))
|
(list "checksums.md5")))
|
||||||
;;
|
;;
|
||||||
;; uninstall all
|
;; uninstall all
|
||||||
;;
|
;;
|
||||||
(always "uninstall"
|
(always "uninstall"
|
||||||
()
|
("clean")
|
||||||
(lambda ()
|
(begin
|
||||||
(display "uninstall: \n")
|
(display "uninstall: \n")
|
||||||
(for-each (lambda (f)
|
(for-each (lambda (f)
|
||||||
|
(display "remove: ") (display f) (newline)
|
||||||
(delete-filesys-object f))
|
(delete-filesys-object f))
|
||||||
(list (string-append my-lib-dir "/" "libmymath.so.1.0")
|
(list (string-append my-lib-dir "/" "libmymath.so.1.0")
|
||||||
(string-append my-lib-dir "/" "libwildio.so.1.0")
|
(string-append my-lib-dir "/" "libwildio.so.1.0")
|
||||||
|
@ -211,38 +166,30 @@
|
||||||
;;
|
;;
|
||||||
(once image-dir
|
(once image-dir
|
||||||
()
|
()
|
||||||
(lambda ()
|
(create-directory image-dir))
|
||||||
(create-directory image-dir)))
|
|
||||||
(once prefix
|
(once prefix
|
||||||
(image-dir)
|
(image-dir)
|
||||||
(lambda ()
|
(create-directory prefix))
|
||||||
(create-directory prefix)))
|
|
||||||
(once my-lib-dir
|
(once my-lib-dir
|
||||||
(prefix)
|
(prefix)
|
||||||
(lambda ()
|
(create-directory my-lib-dir))
|
||||||
(create-directory my-lib-dir)))
|
|
||||||
(once my-bin-dir
|
(once my-bin-dir
|
||||||
(prefix)
|
(prefix)
|
||||||
(lambda ()
|
(create-directory my-bin-dir))
|
||||||
(create-directory my-bin-dir)))
|
|
||||||
(once my-share-dir
|
(once my-share-dir
|
||||||
(prefix)
|
(prefix)
|
||||||
(lambda ()
|
(create-directory my-share-dir))
|
||||||
(create-directory my-share-dir)))
|
|
||||||
(once my-doc-dir
|
(once my-doc-dir
|
||||||
(my-share-dir)
|
(my-share-dir)
|
||||||
(lambda ()
|
(create-directory my-doc-dir))
|
||||||
(create-directory my-doc-dir)))
|
|
||||||
(once my-install-doc-dir
|
(once my-install-doc-dir
|
||||||
(my-doc-dir)
|
(my-doc-dir)
|
||||||
(lambda ()
|
(create-directory my-install-doc-dir))
|
||||||
(create-directory my-install-doc-dir)))
|
|
||||||
;;
|
;;
|
||||||
;; a small test
|
;; a small test
|
||||||
;;
|
;;
|
||||||
(always "test"
|
(always "test"
|
||||||
("install")
|
("install")
|
||||||
(lambda ()
|
|
||||||
(let ((proggy (expand-file-name "show-sqrt" my-bin-dir)))
|
(let ((proggy (expand-file-name "show-sqrt" my-bin-dir)))
|
||||||
(display "testing ") (display proggy) (newline)
|
(display "testing ") (display proggy) (newline)
|
||||||
(setenv "LD_LIBRARY_PATH" my-lib-dir)
|
(setenv "LD_LIBRARY_PATH" my-lib-dir)
|
||||||
|
@ -250,4 +197,4 @@
|
||||||
(run (,proggy ,"2.0"))
|
(run (,proggy ,"2.0"))
|
||||||
(display "# sqrt 5.0:\n")
|
(display "# sqrt 5.0:\n")
|
||||||
(run (,proggy ,"5.0"))
|
(run (,proggy ,"5.0"))
|
||||||
(display "ok.\n"))))))
|
(display "ok.\n")))))
|
||||||
|
|
Loading…
Reference in New Issue