simple/sample makefile for common-rules
This commit is contained in:
parent
181825c8b9
commit
208f3b47bc
|
@ -0,0 +1,55 @@
|
||||||
|
(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"
|
||||||
|
"manual.dvi" "manual.pdf" "manual.log" "manual.aux"))
|
||||||
|
|
||||||
|
(define file-set
|
||||||
|
(makefile
|
||||||
|
(common-file "%.o"
|
||||||
|
("%.c" "%.h")
|
||||||
|
(run (gcc -fPIC -c ,($<))))
|
||||||
|
(common-file "lib%.so.1.0"
|
||||||
|
("%.o")
|
||||||
|
(run
|
||||||
|
(gcc -shared ,(string-append "-Wl,-soname," ($=*) ".so.1")
|
||||||
|
-o ,($@) ,($<))))
|
||||||
|
(common-file "lib%.so.1"
|
||||||
|
("lib%.so.1.0")
|
||||||
|
(create-symlink ($<) ($@)))
|
||||||
|
(common-file "lib%.so"
|
||||||
|
("lib%.so.1")
|
||||||
|
(create-symlink ($<) ($@)))
|
||||||
|
(common-file "%.dvi"
|
||||||
|
("%.tex")
|
||||||
|
(run (latex ,($<))))
|
||||||
|
(common-file "%.pdf"
|
||||||
|
("%.dvi")
|
||||||
|
(run (dvipdfm -o ,($@) ,($<))))
|
||||||
|
(common-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"
|
||||||
|
("show-sqrt" "manual.ps" "manual.dvi" "manual.pdf")
|
||||||
|
(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))))
|
Loading…
Reference in New Issue