From: Ben H. <bh...@us...> - 2002-01-02 04:41:51
|
Update of /cvsroot/thinlisp/thinlisp-1.0/src/tlt/lisp In directory usw-pr-cvs1:/tmp/cvs-serv11291/tlt/lisp Modified Files: system.lisp makefiles.lisp Log Message: Autoconf style makefiles work on at least mac os x, and probably most other things too. Index: system.lisp =================================================================== RCS file: /cvsroot/thinlisp/thinlisp-1.0/src/tlt/lisp/system.lisp,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -r1.18 -r1.19 *** system.lisp 2001/05/30 03:13:50 1.18 --- system.lisp 2002/01/02 04:41:47 1.19 *************** *** 402,414 **** (defun system-makefile (system &optional port-name) ! (make-system-file-pathname ! (if port-name ! (intern (format nil "makefile~a~a" ! (if (string= port-name "config") ! "." ! "-") ! port-name)) ! 'makefile) ! nil nil (system-c-dir system))) (defun system-temporary-makefile (system) --- 402,414 ---- (defun system-makefile (system &optional port-name) ! (let ((autoconf-p (string= "autoconf" port-name))) ! (make-system-file-pathname ! (if port-name ! (intern ! (format nil "makefile~a~a" ! (if autoconf-p "." "-") ! (if autoconf-p "in" port-name))) ! 'makefile) ! nil nil (system-c-dir system)))) (defun system-temporary-makefile (system) Index: makefiles.lisp =================================================================== RCS file: /cvsroot/thinlisp/thinlisp-1.0/src/tlt/lisp/makefiles.lisp,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -r1.16 -r1.17 *** makefiles.lisp 2001/06/09 22:20:32 1.16 --- makefiles.lisp 2002/01/02 04:41:47 1.17 *************** *** 96,102 **** (archive . "ar -r -c -u")) ! (("config") ! (cc . "@CC@") (cc-flags . "@CFLAGS@ -pipe -ansi -pedantic -W -Wall -c") ) --- 96,104 ---- (archive . "ar -r -c -u")) ! (("autoconf") ! (cc . "@CC@ -o") (cc-flags . "@CFLAGS@ -pipe -ansi -pedantic -W -Wall -c") + (link . "@CC@ -o") + (exe-postfix . "$(EXEEXT)") ) *************** *** 126,134 **** finally (return-from portalist (append port-alist alist))) do ! (generate-makefile system verbose port-name))) ;;; The function generate-makefiles takes a system, and uses information from ;;; the system and from the makefile-ports file to generate a set of makefiles --- 128,138 ---- finally (return-from portalist (append port-alist alist))) do ! (generate-makefile system verbose port-name)) ! (generate-autoconf-input system verbose)) + ;;; The function generate-makefiles takes a system, and uses information from ;;; the system and from the makefile-ports file to generate a set of makefiles *************** *** 136,158 **** (defun generate-makefile (system verbose port-name) ! (let ((path (system-makefile system port-name)) ! (temp-path (system-temporary-makefile system)) ! (bin-dir (system-bin-dir system)) ! (optimized-bin-dir (system-optimized-bin-dir system)) ! (current-year ! (sixth (multiple-value-list ! (decode-universal-time (get-universal-time))))) ! (target (if (system-is-library-p system) ! (format nil "~a~(~a~)~a" ! (makeup 'lib-prefix) ! (system-name system) ! (makeup 'lib-postfix)) ! (format nil "~a~(~a~)~a" ! (makeup 'exe-prefix) ! (system-name system) ! (makeup 'exe-postfix)))) ! (obj (makeup 'obj-postfix)) ! (pattern (makeup 'wild)) ! (files-per-line 5)) (with-open-file (output temp-path :direction :output :if-exists :supersede) (format output "#~%# ~a ~a Makefile~%#~%# Copyright (c) ~a The ThinLisp Group~%~%" --- 140,166 ---- (defun generate-makefile (system verbose port-name) ! (let* ((path (system-makefile system port-name)) ! (makefile-name ! (if (string= port-name "autoconf") ! "../c/makefile" ;; bogus ! (pathname-name path))) ! (temp-path (system-temporary-makefile system)) ! (bin-dir (system-bin-dir system)) ! (optimized-bin-dir (system-optimized-bin-dir system)) ! (current-year ! (sixth (multiple-value-list ! (decode-universal-time (get-universal-time))))) ! (target (if (system-is-library-p system) ! (format nil "~a~(~a~)~a" ! (makeup 'lib-prefix) ! (system-name system) ! (makeup 'lib-postfix)) ! (format nil "~a~(~a~)~a" ! (makeup 'exe-prefix) ! (system-name system) ! (makeup 'exe-postfix)))) ! (obj (makeup 'obj-postfix)) ! (pattern (makeup 'wild)) ! (files-per-line 5)) (with-open-file (output temp-path :direction :output :if-exists :supersede) (format output "#~%# ~a ~a Makefile~%#~%# Copyright (c) ~a The ThinLisp Group~%~%" *************** *** 214,218 **** (format output "-( if [ -f ~a ] ; then rm ~a ; fi )~%~%" target target) ! (format output "~a : ~a $(OBJECTS) $(LIBS)~%" target (pathname-name path)) (tlt-write-char #\tab output) (format output "-( if [ -f ~a ] ; then rm ~a ; fi )~%" target target) --- 222,226 ---- (format output "-( if [ -f ~a ] ; then rm ~a ; fi )~%~%" target target) ! (format output "~a : ~a $(OBJECTS) $(LIBS)~%" target makefile-name) (tlt-write-char #\tab output) (format output "-( if [ -f ~a ] ; then rm ~a ; fi )~%" target target) *************** *** 229,233 **** (format output "~a~a : ../c/~a.c ../c/~a.h ~a" ! pattern obj pattern pattern (pathname-name path)) (loop for file in (system-extra-h-files system) do (format output " ../c/~a.h" file)) --- 237,241 ---- (format output "~a~a : ../c/~a.c ../c/~a.h ~a" ! pattern obj pattern pattern makefile-name) (loop for file in (system-extra-h-files system) do (format output " ../c/~a.h" file)) *************** *** 276,277 **** --- 284,305 ---- do (write-line line output)))))))) + + (defun generate-autoconf-input (system verbose) + (let ((path + (make-system-file-pathname + 'CONFIGURE + "in" nil (system-c-dir system))) + (typical-c-file + (first (system-extra-c-files system)))) + (with-open-file (output path + :direction :output + :if-exists :supersede) + (format output "dnl File created by ThinLisp~%") + (format output "dnl autoconf input for ~a~%" + (system-name system)) + (format output "AC_PREREQ(2.13)~%") + (format output "AC_INIT(~a.c)~%" typical-c-file) + (format output "AC_PROG_CC~%") + (format output "AC_EXEEXT~%") + (format output "AC_OUTPUT(makefile)~%") + (format output "dnl End of file~%")))) |