Rename function build target

This commit is contained in:
Benson Chu 2026-04-04 15:57:01 -05:00
parent 665acffffb
commit 16c218cc25
7 changed files with 15 additions and 14 deletions

View file

@ -32,19 +32,20 @@
(require 'use-package) (require 'use-package)
(use-package realgud-lldb) (use-package realgud-lldb)
;; =========================== LLVM Rebuild ========================== ;; =========================== Rebuild ==========================
(defvar llvm-core-count (defvar comp-dev/default-parallelism
(nprocs)) (nprocs))
(defun lls/run-build-command (build-dir targets &optional verbose) (defun comp-dev/build-target (build-dir targets &optional verbose)
(let ((cmake-make-program (let ((cmake-make-program
(if (string= "Makefile" (car (directory-files build-dir nil "^\\(build\\.ninja$\\|Makefile\\)$"))) (if (string= "Makefile" (car (directory-files build-dir nil
(rx line-start (or "build.ninja" "Makefile") line-end))))
"make" "make"
"ninja"))) "ninja")))
(format "set -o pipefail && CLICOLOR_FORCE=1 %s -C %s -j %d %s %s 2>&1 | tee ninja.log" (format "set -o pipefail && CLICOLOR_FORCE=1 %s -C %s -j %d %s %s 2>&1 | tee ninja.log"
cmake-make-program cmake-make-program
build-dir llvm-core-count build-dir comp-dev/default-parallelism
(if verbose "-v" "") (if verbose "-v" "")
(string-join targets " ")))) (string-join targets " "))))

View file

@ -38,7 +38,7 @@
(defun ll/ensure-clang-binary-built (dir) (defun ll/ensure-clang-binary-built (dir)
;; TODO: assumed build-dir constant, should take as argument and prompt ;; TODO: assumed build-dir constant, should take as argument and prompt
;; further up ;; further up
(lls/run-build-command dir '("clang"))) (comp-dev/build-target dir '("clang")))
(defun ll/get-c-action-map () (defun ll/get-c-action-map ()
(append (append
@ -122,7 +122,7 @@
(call-interactively #'recompile))))) (call-interactively #'recompile)))))
(defun ll/diff-on-optionset (file action) (defun ll/diff-on-optionset (file action)
(let ((comm (ll/build-clang-command (lls/un-trampify file) action)) (let ((comm (ll/build-clang-command file action))
(extra-option (read-string "Extra option? ")) (extra-option (read-string "Extra option? "))
(pipe (if (y-or-n-p "Diff assembly (y) or debug (n)? ") (pipe (if (y-or-n-p "Diff assembly (y) or debug (n)? ")
">" "2>"))) ">" "2>")))

View file

@ -36,7 +36,7 @@
(let ((dir (lls/get-llvm-build-dir))) (let ((dir (lls/get-llvm-build-dir)))
(--> file (--> file
(list (format "touch %s" it) (list (format "touch %s" it)
(lls/run-build-command dir (list (concat it "^")) t)) (comp-dev/build-target dir (list (concat it "^")) t))
(string-join it " && ") (string-join it " && ")
(compilation-start it nil (compilation-start it nil
(lambda (_) (lambda (_)

View file

@ -72,7 +72,7 @@
;; further up ;; further up
(let ((dir (lls/get-llvm-build-dir)) (let ((dir (lls/get-llvm-build-dir))
(tools (ll/get-required-binaries-for-test file))) (tools (ll/get-required-binaries-for-test file)))
(lls/run-build-command dir tools))) (comp-dev/build-target dir tools)))
(defun ll/build-lit-command (file action) (defun ll/build-lit-command (file action)
(format "%s %s %s" (format "%s %s %s"
@ -164,7 +164,7 @@
(when tools (when tools
(--> (-->
;; TODO: Assuming debug folder, (lls/get-llvm-build-dir) doesn't work ;; TODO: Assuming debug folder, (lls/get-llvm-build-dir) doesn't work
(lls/run-build-command "/scratch/benson/tools3/llvm_cgt/build/Debug/llvm" (seq-uniq tools)) (comp-dev/build-target "/scratch/benson/tools3/llvm_cgt/build/Debug/llvm" (seq-uniq tools))
(compilation-start (compilation-start
it it
nil nil

View file

@ -37,7 +37,7 @@
(compilation-start (--> (compilation-start (-->
(list (list
(format "touch %s" file) (format "touch %s" file)
(lls/run-build-command (comp-dev/build-target
build-dir (list (format "%s^" file)) t)) build-dir (list (format "%s^" file)) t))
(string-join it " && ")) (string-join it " && "))
nil nil

View file

@ -42,7 +42,7 @@
;; "llc"))))) ;; "llc")))))
;; (let* ((buffer-name (funcall lls/name-llvm-build-buffer directory tools))) ;; (let* ((buffer-name (funcall lls/name-llvm-build-buffer directory tools)))
;; (compilation-start ;; (compilation-start
;; (lls/run-build-command (lls/un-trampify directory) tools) ;; (comp-dev/build-target directory tools)
;; nil ;; nil
;; (lambda (_) buffer-name)))) ;; (lambda (_) buffer-name))))
@ -56,7 +56,7 @@
"llc"))))) "llc")))))
(name (funcall lls/name-llvm-build-buffer directory tools)) (name (funcall lls/name-llvm-build-buffer directory tools))
(lls/run-build-command (lls/un-trampify directory) tools)) (comp-dev/build-target directory tools))
(provide 'llvm-build-tool) (provide 'llvm-build-tool)
;;; llvm-build-tool.el ends here ;;; llvm-build-tool.el ends here

@ -1 +1 @@
Subproject commit 5e5d4984816ace917f78190e04936b038c43365b Subproject commit 9475fc97631749af237b5fcda503a0b945c16eab