Changed Makefile.md -> Makefile.mk and used find-system-path for Home directory.

This commit is contained in:
2026-08-31 14:46:21 +02:00
parent 3f7b613273
commit fd1cac18aa
3 changed files with 21 additions and 10 deletions
+1
View File
@@ -7,6 +7,7 @@
*.rkt.bak *.rkt.bak
\#*.rkt# \#*.rkt#
\#*.rkt#*# \#*.rkt#*#
*.bak
# Compiled racket bytecode # Compiled racket bytecode
compiled/ compiled/
+19 -9
View File
@@ -2,28 +2,38 @@
(require racket-makefile) (require racket-makefile)
(define test-install #f)
(makefile 'skill (makefile 'skill
(target 'all (target 'all
(displayln "Use (make 'install)")) (displayln "Use (make 'install)"))
(target 'install (target 'install
(let ((home (getenv "HOME"))) (let ((home (find-system-path 'home-dir)))
(when (eq? home #f) (when (eq? home #f)
(error "No $HOME environment variable, cannot find place of .codex")) (error "No home directory?, cannot find place of .codex"))
(let* ((pwd (current-directory)) (let* ((pwd (current-directory))
(skilld (build-path home ".codex" "skills")) (skilld (build-path home ".codex" "skills"))
(racket-skilld (build-path skilld "racket-skill")) (racket-skilld (build-path skilld "racket-skill"))
(js-skilld (build-path skilld "javascript-skill")) (js-skilld (build-path skilld "javascript-skill"))
(cp (lambda (to-dir file) (cp (lambda (to-dir file)
(let ((from (build-path pwd file)) (let ((from (build-path pwd file))
(to (build-path to-dir "SKILL.md"))) (to (build-path to-dir "SKILL.md")))
(unless (directory-exists? to-dir) (unless (directory-exists? to-dir)
(make-directory to-dir)) (make-directory to-dir))
(displayln (format "cp ~a -> ~a" from to)) (displayln (format "cp ~a -> ~a" from to))
(copy-file from to #:exists-ok? #t)))) (unless test-install
) (copy-file from to #:exists-ok? #t)))))
)
(cp racket-skilld "racket-skill.md") (cp racket-skilld "racket-skill.md")
(cp js-skilld "javascript-skill.md") (cp js-skilld "javascript-skill.md")
))) )))
)
(target 'test-install
(set! test-install #t)
(make 'install)
(set! test-install #f))
)
+1 -1
View File
@@ -1,2 +1,2 @@
#!/bin/bash #!/bin/bash
racket -e "(enter! \"Makefile.md\") (make 'install)" racket -e "(enter! \"Makefile.mk\") (make 'install)"