scsh-make/examples/makefile-common-rules.scm

82 lines
2.9 KiB
Scheme
Raw Normal View History

(define clean-files
(list "wildio.o" "mymath.o"
"libwildio.so.1.0" "libmymath.so.1.0"
"libwildio.so.1" "libmymath.so.1"
"libwildio.so" "libmymath.so"
"show-sqrt"
2005-03-07 12:37:46 -05:00
"manual.dvi" "manual.pdf" "manual.ps" "manual.log" "manual.aux"
"a-manual.dvi" "a-manual.pdf" "a-manual.ps" "a-manual.log" "a-manual.aux"
"b-manual.dvi" "b-manual.pdf" "b-manual.ps" "b-manual.log" "b-manual.aux"
"c-manual.dvi" "c-manual.pdf" "c-manual.ps" "c-manual.log" "c-manual.aux"
"d-manual.dvi" "d-manual.pdf" "d-manual.ps" "d-manual.log" "d-manual.aux"
"e-manual.dvi" "e-manual.pdf" "e-manual.ps" "e-manual.log" "e-manual.aux"
"f-manual.dvi" "f-manual.pdf" "f-manual.ps" "f-manual.log" "f-manual.aux"
"g-manual.dvi" "g-manual.pdf" "g-manual.ps" "g-manual.log" "g-manual.aux"
"h-manual.dvi" "h-manual.pdf" "h-manual.ps" "h-manual.log" "h-manual.aux"
"i-manual.dvi" "i-manual.pdf" "i-manual.ps" "i-manual.log" "i-manual.aux"
"j-manual.dvi" "j-manual.pdf" "j-manual.ps" "j-manual.log" "j-manual.aux"
"another-manual.dvi" "another-manual.pdf" "another-manual.ps"
"another-manual.log" "another-manual.aux"))
2005-03-07 12:37:46 -05:00
;(string-append ($*) ".c") (string-append ($*) ".h")
(define file-set
(makefile
2005-03-07 12:37:46 -05:00
(common-rx
(file (rx (: (submatch "") (submatch (+ any)) (submatch ".o")))
("%.c" "%.h")
(run (gcc -fPIC -c ,(string-append ($*) ".c")))))
(common-%
(file "lib%.so.1.0"
("%.o")
(run
(gcc -shared ,(string-append "-Wl,-soname," ($=*) ".so.1")
-o ,($@) ,($<))))
(file "lib%.so.1"
("lib%.so.1.0")
(create-symlink ($<) ($@)))
(file "lib%.so"
("lib%.so.1")
(create-symlink ($<) ($@)))
(file "%.dvi"
("%.tex")
(run (latex ,($<))))
(file "%.pdf"
("%.dvi")
(run (dvipdfm -o ,($@) ,($<))))
(file "%.ps"
("%.dvi")
(run (dvips -o ,($@) ,($<)))))
;;
;; build the program
;;
(file "show-sqrt"
("main.c" "libmymath.so.1" "libwildio.so.1" "wildio.h" "mymath.h")
(run (gcc -L ,(cwd) -rdynamic
-o ,($@) ,($<) ,"libwildio.so.1" ,"libmymath.so.1" -ldl)))
;;
;; fake install
;;
(always "install"
2005-03-07 12:37:46 -05:00
("show-sqrt" "manual.ps" "manual.pdf"
"another-manual.pdf" "another-manual.ps"
"a-manual.dvi" "a-manual.pdf" "a-manual.ps"
"b-manual.dvi" "b-manual.pdf" "b-manual.ps"
"c-manual.dvi" "c-manual.pdf" "c-manual.ps"
"d-manual.dvi" "d-manual.pdf" "d-manual.ps"
"e-manual.dvi" "e-manual.pdf" "e-manual.ps"
"f-manual.dvi" "f-manual.pdf" "f-manual.ps"
"g-manual.dvi" "g-manual.pdf" "g-manual.ps"
"h-manual.dvi" "h-manual.pdf" "h-manual.ps"
"i-manual.dvi" "i-manual.pdf" "i-manual.ps"
"j-manual.dvi" "j-manual.pdf" "j-manual.ps")
(for-each (lambda (f) (display ">>> ") (display f) (newline)) ($+))
(display "install done.\n"))
;;
;; clean files
;;
(always "clean"
()
(for-each (lambda (f)
(delete-filesys-object (expand-file-name f (cwd))))
clean-files))))