Add Makefile for building on Solaris
Previously Makefiles were made on the spot and just sorta thrown onto the target via FTP. A real canonical Makefile will make building from scratch not a nightmare.
This commit is contained in:
parent
d43a683018
commit
c7e02b4fd0
2 changed files with 40 additions and 26 deletions
10
Makefile
Normal file
10
Makefile
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
objects = build/src/Backends/Rendering/Software.o build/src/Backends/Audio/SoftwareMixer.o build/src/Backends/Audio/SoftwareMixer/Mixer.o build/src/Backends/Platform/X11.o build/src/Backends/Controller/Null.o build/src/Backends/Rendering/Window/Software/X11.o build/src/Backends/Audio/SoftwareMixer/Solaris.o build/src/ArmsItem.o build/src/Back.o build/src/Bitmap.o build/src/Boss.o build/src/BossAlmo1.o build/src/BossAlmo2.o build/src/BossBallos.o build/src/BossFrog.o build/src/BossIronH.o build/src/BossLife.o build/src/BossOhm.o build/src/BossPress.o build/src/BossTwinD.o build/src/BossX.o build/src/BulHit.o build/src/Bullet.o build/src/Caret.o build/src/Config.o build/src/Draw.o build/src/Ending.o build/src/Escape.o build/src/Fade.o build/src/File.o build/src/Flags.o build/src/Flash.o build/src/Font.o build/src/Frame.o build/src/Game.o build/src/Generic.o build/src/GenericLoad.o build/src/Input.o build/src/KeyControl.o build/src/Main.o build/src/Map.o build/src/MapName.o build/src/MiniMap.o build/src/MyChar.o build/src/MycHit.o build/src/MycParam.o build/src/NpChar.o build/src/NpcAct000.o build/src/NpcAct020.o build/src/NpcAct040.o build/src/NpcAct060.o build/src/NpcAct080.o build/src/NpcAct100.o build/src/NpcAct120.o build/src/NpcAct140.o build/src/NpcAct160.o build/src/NpcAct180.o build/src/NpcAct200.o build/src/NpcAct220.o build/src/NpcAct240.o build/src/NpcAct260.o build/src/NpcAct280.o build/src/NpcAct300.o build/src/NpcAct320.o build/src/NpcAct340.o build/src/NpcHit.o build/src/NpcTbl.o build/src/Organya.o build/src/PixTone.o build/src/Profile.o build/src/Random.o build/src/Resource.o build/src/SelStage.o build/src/Shoot.o build/src/Sound.o build/src/Stage.o build/src/Star.o build/src/TextScr.o build/src/Triangle.o build/src/ValueView.o
|
||||||
|
|
||||||
|
all: CSE2
|
||||||
|
optlevel = -O2
|
||||||
|
|
||||||
|
%.o: %.cpp
|
||||||
|
g++ $(optlevel) -c $< -o $@ -I./fakes/
|
||||||
|
|
||||||
|
CSE2: $(objects)
|
||||||
|
g++ $(optlevel) -o $@ $^ -lX11 -lXext -lm
|
|
@ -45,10 +45,15 @@
|
||||||
:type "cpp")))
|
:type "cpp")))
|
||||||
|
|
||||||
(defun software-mixer ()
|
(defun software-mixer ()
|
||||||
(get-source-paths
|
(append
|
||||||
(make-pathname :directory '(:relative "src" "Backends" "Audio")
|
(get-source-paths
|
||||||
:name "SoftwareMixer"
|
(make-pathname :directory '(:relative "src" "Backends" "Audio")
|
||||||
:type "cpp")))
|
:name "SoftwareMixer"
|
||||||
|
:type "cpp"))
|
||||||
|
(get-source-paths
|
||||||
|
(make-pathname :directory '(:relative "src" "Backends" "Audio" "SoftwareMixer")
|
||||||
|
:name "Mixer"
|
||||||
|
:type "cpp"))))
|
||||||
|
|
||||||
(defun null-controller ()
|
(defun null-controller ()
|
||||||
(get-source-paths
|
(get-source-paths
|
||||||
|
@ -59,11 +64,11 @@
|
||||||
(defun get-sources ()
|
(defun get-sources ()
|
||||||
(append
|
(append
|
||||||
(software-renderer)
|
(software-renderer)
|
||||||
;;(software-mixer)
|
(software-mixer)
|
||||||
(x11-platform)
|
(x11-platform)
|
||||||
(null-controller)
|
(null-controller)
|
||||||
(x11-window)
|
(x11-window)
|
||||||
(null-audio)
|
(solaris-audio)
|
||||||
(default-files)))
|
(default-files)))
|
||||||
|
|
||||||
(defun get-build-path (path)
|
(defun get-build-path (path)
|
||||||
|
@ -73,33 +78,32 @@
|
||||||
:type "o"
|
:type "o"
|
||||||
:defaults path)))
|
:defaults path)))
|
||||||
|
|
||||||
(defun make-compile-command (file)
|
(defun make-objects-list (sources)
|
||||||
|
(format nil "objects =~{ ~A~}" (mapcar 'get-build-path sources)))
|
||||||
|
|
||||||
|
(defun make-compile-command ()
|
||||||
(let ((str
|
(let ((str
|
||||||
(format nil "g++ -O2 -c $< -o $@"
|
(format nil "g++ $(optlevel) -c $< -o $@")))
|
||||||
;(namestring (make-relative file))
|
(setf str (format nil "~A -I./fakes/" str))
|
||||||
;(get-build-path file)
|
(format nil "%.o: %.cpp~%~C~A~%~%"
|
||||||
)))
|
|
||||||
(when (string-equal "Bitmap" (pathname-name file))
|
|
||||||
(setf str (format nil "~A -I./fakes/" str)))
|
|
||||||
(format nil "~A: ~A~%~C~A~%~%"
|
|
||||||
(get-build-path file)
|
|
||||||
(namestring (make-relative file))
|
|
||||||
#\Tab
|
#\Tab
|
||||||
str)))
|
str)))
|
||||||
|
|
||||||
(defun make-link-command (sources)
|
(defun make-boilerplate ()
|
||||||
(format nil "CSE2: ~{~A ~}~%~Cg++ -O2 -o $@ $^ -lX11 -lXext -lm~%"
|
(format nil "all: CSE2~%optlevel = -O2~%"))
|
||||||
(mapcar 'get-build-path sources)
|
|
||||||
|
(defun make-link-command ()
|
||||||
|
(format nil "CSE2: $(objects)~%~Cg++ $(optlevel) -o $@ $^ -lX11 -lXext -lm~%"
|
||||||
#\Tab))
|
#\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~%~%")
|
|
||||||
(let ((sources (get-sources)))
|
(let ((sources (get-sources)))
|
||||||
(loop :for file :in sources
|
(write-string (make-objects-list sources) stream)
|
||||||
:for build-path := (get-build-path file)
|
(terpri stream)
|
||||||
)
|
(terpri stream)
|
||||||
(dolist (file sources)
|
(write-string (make-boilerplate) stream)
|
||||||
(write-string (make-compile-command file) stream))
|
(terpri stream)
|
||||||
(write-string (make-link-command sources) stream))))
|
(write-string (make-compile-command) stream)
|
||||||
|
(write-string (make-link-command) stream))))
|
||||||
|
|
Loading…
Add table
Reference in a new issue