Skip to content

Commit

Permalink
Prevent error on 'make clean'; prevent '#t' when using 'build-runtime…
Browse files Browse the repository at this point in the history
….rkt'
  • Loading branch information
pdarragh committed Dec 6, 2023
1 parent d6fbb58 commit 7f55e4f
Show file tree
Hide file tree
Showing 23 changed files with 52 additions and 35 deletions.
3 changes: 2 additions & 1 deletion langs/abscond/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ runtime.o: $(objs)
cat $< | racket -t compile-stdin.rkt -m > $@

clean:
rm *.o *.s *.run
@$(RM) *.o *.s *.run ||:
@echo "$(shell basename $(shell pwd)): cleaned!"

%.test: %.run %.rkt
@test "$(shell ./$(<))" = "$(shell racket $(word 2,$^))"
3 changes: 2 additions & 1 deletion langs/blackmail/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ runtime.o: $(objs)
cat $< | racket -t compile-stdin.rkt -m > $@

clean:
rm *.o *.s *.run
@$(RM) *.o *.s *.run ||:
@echo "$(shell basename $(shell pwd)): cleaned!"

%.test: %.run %.rkt
@test "$(shell ./$(<))" = "$(shell racket $(word 2,$^))"
3 changes: 2 additions & 1 deletion langs/con/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ runtime.o: $(objs)
cat $< | racket -t compile-stdin.rkt -m > $@

clean:
rm *.o *.s *.run
@$(RM) *.o *.s *.run ||:
@echo "$(shell basename $(shell pwd)): cleaned!"

%.test: %.run %.rkt
@test "$(shell ./$(<))" = "$(shell racket $(word 2,$^))"
3 changes: 2 additions & 1 deletion langs/dodger/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ runtime.o: $(objs)
cat $< | racket -t compile-stdin.rkt -m > $@

clean:
rm *.o *.s *.run
@$(RM) *.o *.s *.run ||:
@echo "$(shell basename $(shell pwd)): cleaned!"

%.test: %.run %.rkt
@test "$(shell ./$(<))" = "$(shell racket $(word 2,$^))"
3 changes: 2 additions & 1 deletion langs/dupe/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ runtime.o: $(objs)
cat $< | racket -t compile-stdin.rkt -m > $@

clean:
rm *.o *.s *.run
@$(RM) *.o *.s *.run ||:
@echo "$(shell basename $(shell pwd)): cleaned!"

%.test: %.run %.rkt
@test "$(shell ./$(<))" = "$(shell racket $(word 2,$^))"
3 changes: 2 additions & 1 deletion langs/evildoer/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ runtime.o: $(objs)
cat $< | racket -t compile-stdin.rkt -m > $@

clean:
rm *.o *.s *.run
@$(RM) *.o *.s *.run ||:
@echo "$(shell basename $(shell pwd)): cleaned!"

%.test: %.run %.rkt
@test "$(shell ./$(<))" = "$(shell racket $(word 2,$^))"
3 changes: 2 additions & 1 deletion langs/extort/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ runtime.o: $(objs)
cat $< | racket -t compile-stdin.rkt -m > $@

clean:
rm *.o *.s *.run
@$(RM) *.o *.s *.run ||:
@echo "$(shell basename $(shell pwd)): cleaned!"

%.test: %.run %.rkt
@test "$(shell ./$(<))" = "$(shell racket $(word 2,$^))"
3 changes: 2 additions & 1 deletion langs/fraud/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ runtime.o: $(objs)
cat $< | racket -t compile-stdin.rkt -m > $@

clean:
rm *.o *.s *.run
@$(RM) *.o *.s *.run ||:
@echo "$(shell basename $(shell pwd)): cleaned!"

%.test: %.run %.rkt
@test "$(shell ./$(<))" = "$(shell racket $(word 2,$^))"
7 changes: 4 additions & 3 deletions langs/fraud/build-runtime.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
(require racket/runtime-path)
(define-runtime-path here ".")

(system (string-append "make -C '"
(path->string (normalize-path here))
"' runtime.o"))
(unless (system (string-append "make -C '"
(path->string (normalize-path here))
"' runtime.o"))
(error 'build-runtime "could not build runtime"))

(define runtime-path
(normalize-path (build-path here "runtime.o")))
Expand Down
13 changes: 4 additions & 9 deletions langs/fraud/compile.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,7 @@

;; Op0 -> Asm
(define (compile-prim0 p)
(compile-op0 p))

;; Op1 Expr CEnv -> Asm
(compile-op0 p));; Op1 Expr CEnv -> Asm
(define (compile-prim1 p e c)
(seq (compile-e e c)
(compile-op1 p)))
Expand All @@ -65,9 +63,7 @@
(seq (compile-e e1 c)
(Push rax)
(compile-e e2 (cons #f c))
(compile-op2 p)))

;; Expr Expr Expr CEnv -> Asm
(compile-op2 p)));; Expr Expr Expr CEnv -> Asm
(define (compile-if e1 e2 e3 c)
(let ((l1 (gensym 'if))
(l2 (gensym 'if)))
Expand All @@ -78,9 +74,7 @@
(Jmp l2)
(Label l1)
(compile-e e3 c)
(Label l2))))

;; Expr Expr CEnv -> Asm
(Label l2))));; Expr Expr CEnv -> Asm
(define (compile-begin e1 e2 c)
(seq (compile-e e1 c)
(compile-e e2 c)))
Expand All @@ -100,3 +94,4 @@
(match (eq? x y)
[#t 0]
[#f (+ 8 (lookup x rest))])]))

3 changes: 2 additions & 1 deletion langs/hoax/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ runtime.o: $(objs)
cat $< | racket -t compile-stdin.rkt -m > $@

clean:
rm *.o *.s *.run
@$(RM) *.o *.s *.run ||:
@echo "$(shell basename $(shell pwd)): cleaned!"

%.test: %.run %.rkt
@test "$(shell ./$(<))" = "$(shell racket $(word 2,$^))"
3 changes: 2 additions & 1 deletion langs/hustle/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ runtime.o: $(objs)
cat $< | racket -t compile-stdin.rkt -m > $@

clean:
rm *.o *.s *.run
@$(RM) *.o *.s *.run ||:
@echo "$(shell basename $(shell pwd)): cleaned!"

%.test: %.run %.rkt
@test "$(shell ./$(<))" = "$(shell racket $(word 2,$^))"
3 changes: 2 additions & 1 deletion langs/iniquity-gc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ runtime.o: $(objs)
cat $< | racket -t compile-stdin.rkt -m > $@

clean:
rm *.o *.s *.run
@$(RM) *.o *.s *.run ||:
@echo "$(shell basename $(shell pwd)): cleaned!"

%.test: %.run %.rkt
@test "$(shell ./$(<))" = "$(shell racket $(word 2,$^))"
3 changes: 2 additions & 1 deletion langs/iniquity/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ runtime.o: $(objs)
cat $< | racket -t compile-stdin.rkt -m > $@

clean:
rm *.o *.s *.run
@$(RM) *.o *.s *.run ||:
@echo "$(shell basename $(shell pwd)): cleaned!"

%.test: %.run %.rkt
@test "$(shell ./$(<))" = "$(shell racket $(word 2,$^))"
3 changes: 2 additions & 1 deletion langs/jig/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ runtime.o: $(objs)
cat $< | racket -t compile-stdin.rkt -m > $@

clean:
rm *.o *.s *.run
@$(RM) *.o *.s *.run ||:
@echo "$(shell basename $(shell pwd)): cleaned!"

%.test: %.run %.rkt
@test "$(shell ./$(<))" = "$(shell racket $(word 2,$^))"
3 changes: 2 additions & 1 deletion langs/knock/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ runtime.o: $(objs)
cat $< | racket -t compile-stdin.rkt -m > $@

clean:
rm *.o *.s *.run
@$(RM) *.o *.s *.run ||:
@echo "$(shell basename $(shell pwd)): cleaned!"

%.test: %.run %.rkt
@test "$(shell ./$(<))" = "$(shell racket $(word 2,$^))"
3 changes: 2 additions & 1 deletion langs/loot/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ runtime.o: $(objs)
cat $< | racket -t compile-stdin.rkt -m > $@

clean:
rm *.o *.s *.run
@$(RM) *.o *.s *.run ||:
@echo "$(shell basename $(shell pwd)): cleaned!"

%.test: %.run %.rkt
@test "$(shell ./$(<))" = "$(shell racket $(word 2,$^))"
3 changes: 2 additions & 1 deletion langs/modules-in-progress/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ runtime.o: $(objs)
make $@

clean:
-rm *.o *.s *.run $(BUILD_DIR)/*.make
@$(RM) *.o *.s *.run $(BUILD_DIR)/*.make ||:
@echo "$(shell basename $(shell pwd)): cleaned!"

-include $(wildcard $(BUILD_DIR)/*.make)
3 changes: 2 additions & 1 deletion langs/mountebank/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ runtime.o: $(objs)
cat $< | racket -t compile-stdin.rkt -m > $@

clean:
rm *.o *.s *.run
@$(RM) *.o *.s *.run ||:
@echo "$(shell basename $(shell pwd)): cleaned!"

%.test: %.run %.rkt
@test "$(shell ./$(<))" = "$(shell racket $(word 2,$^))"
3 changes: 2 additions & 1 deletion langs/mug/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ runtime.o: $(objs)
cat $< | racket -t compile-stdin.rkt -m > $@

clean:
rm *.o *.s *.run
@$(RM) *.o *.s *.run ||:
@echo "$(shell basename $(shell pwd)): cleaned!"

%.test: %.run %.rkt
@test "$(shell ./$(<))" = "$(shell racket $(word 2,$^))"
3 changes: 2 additions & 1 deletion langs/neerdowell/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ runtime.o: $(objs)
cat $< | racket -t compile-stdin.rkt -m > $@

clean:
rm *.o *.s *.run
@$(RM) *.o *.s *.run ||:
@echo "$(shell basename $(shell pwd)): cleaned!"

%.test: %.run %.rkt
@test "$(shell ./$(<))" = "$(shell racket $(word 2,$^))"
3 changes: 2 additions & 1 deletion langs/outlaw/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ stdlib.s: stdlib.rkt
cat $< | racket -t compile-stdin.rkt -m > $@

clean:
rm *.o *.s *.run outlaw.rkt
@$(RM) *.o *.s *.run outlaw.rkt ||:
@echo "$(shell basename $(shell pwd)): cleaned!"

outlaw2.s: outlaw.rkt outlaw.run
cat outlaw.rkt | ./outlaw.run > outlaw2.s
Expand Down
7 changes: 4 additions & 3 deletions ziggy/src/build-runtime.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
(require racket/runtime-path)
(define-runtime-path here ".")

(system (string-append "make -C '"
(path->string (normalize-path here))
"' runtime.o"))
(unless (system (string-append "make -C '"
(path->string (normalize-path here))
"' runtime.o"))
(error 'build-runtime "could not build runtime"))

(define runtime-path
(normalize-path (build-path here "runtime.o")))

0 comments on commit 7f55e4f

Please sign in to comment.