aboutsummaryrefslogtreecommitdiff
path: root/src/cljcc/driver.clj
diff options
context:
space:
mode:
authorShagun Agrawal <agrawalshagun07@gmail.com>2024-10-30 00:34:36 +0530
committerShagun Agrawal <agrawalshagun07@gmail.com>2024-10-30 00:34:36 +0530
commita94b482b001d99ecffdb31067319773cbde4501e (patch)
tree65e53f128b7e63f1e8392e447d113d9dc827e7b4 /src/cljcc/driver.clj
parent40da421300b14e4766718984e0787550aadb9319 (diff)
Add emission for functions
Able to execute "hello, world" program. Some segmentation faults in specific test steps. Executables not exiting on their own.
Diffstat (limited to 'src/cljcc/driver.clj')
-rw-r--r--src/cljcc/driver.clj7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/cljcc/driver.clj b/src/cljcc/driver.clj
index 8485574..14b9e18 100644
--- a/src/cljcc/driver.clj
+++ b/src/cljcc/driver.clj
@@ -9,7 +9,8 @@
[clojure.pprint :as pp]
[cljcc.log :as log]
[cljcc.util :refer [get-os handle-sh mac-aarch64? make-file-name]]
- [cljcc.parser :as p]))
+ [cljcc.parser :as p]
+ [clojure.string :as str]))
(defn- validate-os []
(let [os (get-os)]
@@ -44,7 +45,9 @@
assembly-out-file-path (make-file-name directory (remove-extension filename) "s")
_ (println assembly-output)
_ (spit assembly-out-file-path assembly-output)
- output-file (str directory "/" file-without-ext)
+ output-file (if (:generate-object-file options)
+ (str directory "/" (str file-without-ext ".o"))
+ (str directory "/" file-without-ext))
output (if (:generate-object-file options)
(handle-sh "gcc" "-c" assembly-file "-o" output-file)
(handle-sh "gcc" assembly-file "-o" output-file))]