makefile-targets and some other meta info functions added

This commit is contained in:
2026-08-18 02:15:33 +02:00
parent a21f4a4a39
commit 635d2d40d1
13 changed files with 538 additions and 251 deletions
+20 -16
View File
@@ -1,22 +1,26 @@
#lang racket-makefile
#lang racket
;; Ordinary Racket can generate targets and dependency lists.
(require racket-makefile)
(define sources '("foo.c" "bar.c" "baz.c"))
;; A makefile body is ordinary Racket. Target names that are expressions are
;; evaluated while the makefile is registered, so a loop can generate targets.
(define objects
(for/list ([src sources])
(define obj (path-replace-extension src #".o"))
(target obj
(deps src)
(run `(cc -c $< -o $target)))
obj))
(makefile 'stuff
(define sources '("foo.c" "bar.c" "baz.c"))
(default-target all)
(phony all clean)
(define objects
(for/list ([src sources])
(define obj (path-replace-extension src #".o"))
(target obj
(deps src)
(run `(cc -c $< -o $target)))
obj))
(target all
(deps objects))
(default-target 'all)
(phony 'all 'clean)
(target clean
(apply rm-f objects))
(target 'all
(deps objects))
(target 'clean
(apply rm-f objects)))