Make manual-build-maker.lisp generate Makefile instead of shell script

This commit is contained in:
John Lorentzson 2025-04-10 22:51:45 +02:00
parent 4003931ed9
commit d19f37cfed

View file

@ -75,21 +75,27 @@
(defun make-compile-command (file) (defun make-compile-command (file)
(let ((str (let ((str
(format nil "g++ -O2 -c ~A -o ~A" (format nil "g++ -O2 -c $< -o $@"
(namestring (make-relative file)) ;(namestring (make-relative file))
(get-build-path file)))) ;(get-build-path file)
)))
(when (string-equal "Bitmap" (pathname-name file)) (when (string-equal "Bitmap" (pathname-name file))
(setf str (format nil "~A -I./fakes/" str))) (setf str (format nil "~A -I./fakes/" str)))
(format nil "echo ~A~%~A~%" str str))) (format nil "~A: ~A~%~C~A~%~%"
(get-build-path file)
(namestring (make-relative file))
#\Tab
str)))
(defun make-link-command (sources) (defun make-link-command (sources)
(format nil "echo Linking.~%g++ -O2 -o CSE2 ~{~A ~}-lX11 -lm~%" (format nil "CSE2: ~{~A ~}~%~Cg++ -O2 -o $@ $^ -lX11 -lXext -lm~%"
(mapcar 'get-build-path sources))) (mapcar 'get-build-path sources)
#\Tab))
(defun make-build-script (output-path) (defun make-build-script (output-path)
(with-open-file (stream output-path :direction :output :if-exists :supersede :if-does-not-exist :create) (with-open-file (stream output-path :direction :output :if-exists :supersede :if-does-not-exist :create)
(setf *root-dir* (make-pathname :directory '(:relative))) (setf *root-dir* (make-pathname :directory '(:relative)))
(format stream "#!/bin/sh~%~%") ;;(format stream "#!/bin/sh~%~%")
(let ((sources (get-sources))) (let ((sources (get-sources)))
(loop :for file :in sources (loop :for file :in sources
:for build-path := (get-build-path file) :for build-path := (get-build-path file)