aboutsummaryrefslogtreecommitdiff
path: root/Makefiles/go.mk
diff options
context:
space:
mode:
Diffstat (limited to 'Makefiles/go.mk')
-rw-r--r--Makefiles/go.mk18
1 files changed, 10 insertions, 8 deletions
diff --git a/Makefiles/go.mk b/Makefiles/go.mk
index b5e95cd..a0c7c23 100644
--- a/Makefiles/go.mk
+++ b/Makefiles/go.mk
@@ -1,13 +1,15 @@
.POSIX:
all:
- sed '/START PART 2/,/END PART 2/d' puzzles.go >tmp1.go
- sed '/START PART 1/,/END PART 1/d' puzzles.go >tmp2.go
- go build tmp1.go
- go build tmp2.go
- mv tmp1 puzzle-1
- mv tmp2 puzzle-2
- rm -f tmp[12].go
+ f() { \
+ n=$$(expr \( $$1 - 1 \| 2 \)); \
+ sed "/START PART $$n/,/END PART $$n/d" puzzles.go >tmp$$1.go; \
+ go build tmp$$1.go; \
+ mv tmp$$1 puzzle-$$1; \
+ rm -f tmp$$1; \
+ }; \
+ f 1; \
+ f 2;
clean:
- rm -f puzzle-[12]
+ rm -f puzzle-[12] \ No newline at end of file