summaryrefslogtreecommitdiff
path: root/main.lisp
diff options
context:
space:
mode:
authormRnea <[email protected]>2024-08-19 21:37:24 +0300
committermRnea <[email protected]>2024-08-19 21:37:24 +0300
commit4367febcd70e9bb7538cd168917ec3c7d3b0a6f3 (patch)
treeb399f89c5cc90c793b2ef50bce9307e4d7befb09 /main.lisp
parent86dbe8eb0abe2a2d5f0f687ff190c4e9f547d126 (diff)
add target option to command line, fix | when its last char on line
Diffstat (limited to 'main.lisp')
-rw-r--r--main.lisp23
1 files changed, 18 insertions, 5 deletions
diff --git a/main.lisp b/main.lisp
index 6b0d08c..8e9e719 100644
--- a/main.lisp
+++ b/main.lisp
@@ -61,7 +61,13 @@
:filepath
:description "Kaynak dosyasını belirt."
:short-name #\k
- :key :kaynak)))
+ :key :kaynak)
+ (clingon:make-option
+ :string
+ :initial-value "nasm"
+ :description "Derleme hedefini belirt."
+ :short-name #\h
+ :key :hedef)))
(defun subcommands ()
(list (clingon:make-command
@@ -69,10 +75,17 @@
:description "Dosyadaki programı derle"
:usage "<dosya-ismi>"
:options (comp-options)
- :handler (lambda (cmd) (generate-program
- (make-program
- (clingon:getopt cmd :kaynak))
- :compile t)))
+ :handler
+ (lambda (cmd) (let ((hedef (clingon:getopt cmd :hedef)))
+ (generate-program
+ (make-program
+ (clingon:getopt cmd :kaynak))
+ :path
+ (format nil "output.~a"
+ (cond ((string-equal "nasm" hedef) "asm")
+ ((string-equal "c" hedef) "c")))
+ :compile t
+ :target (intern (string-upcase hedef) :keyword)))))
(clingon:make-command
:name "test"
:description "Testleri çalıştır."