aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefiles/awk.mk9
-rw-r--r--Makefiles/c.mk19
-rw-r--r--Makefiles/go.mk13
-rw-r--r--Makefiles/lex.mk17
-rw-r--r--Makefiles/py.mk9
5 files changed, 67 insertions, 0 deletions
diff --git a/Makefiles/awk.mk b/Makefiles/awk.mk
new file mode 100644
index 0000000..4d67974
--- /dev/null
+++ b/Makefiles/awk.mk
@@ -0,0 +1,9 @@
+.POSIX:
+
+all:
+ sed '/START PART 2/,/END PART 2/d' puzzles.awk >puzzle-1.awk
+ sed '/START PART 1/,/END PART 1/d' puzzles.awk >puzzle-2.awk
+ chmod +x puzzle-[12].awk
+
+clean:
+ rm -f puzzle-[12].awk
diff --git a/Makefiles/c.mk b/Makefiles/c.mk
new file mode 100644
index 0000000..d4af730
--- /dev/null
+++ b/Makefiles/c.mk
@@ -0,0 +1,19 @@
+.POSIX:
+
+CC = cc
+CFLAGS = -Wall -Wextra -Wpedantic -Werror \
+ -march=native -mtune=native -O3 -flto \
+ -pipe
+
+ALL = ${CC} ${CFLAGS} ${CPPFLAGS} ${LDLIBS} ${LDFLAGS}
+
+all:
+ [ -f puzzles.c ] && { \
+ ${ALL} -DPART1 -o puzzle-1 puzzles.c; \
+ ${ALL} -DPART2 -o puzzle-2 puzzles.c; \
+ }
+ [ -f puzzle-1.c ] && ${ALL} -o puzzle-1 puzzle-1.c || true
+ [ -f puzzle-2.c ] && ${ALL} -o puzzle-2 puzzle-2.c || true
+
+clean:
+ rm -f puzzle-[12]
diff --git a/Makefiles/go.mk b/Makefiles/go.mk
new file mode 100644
index 0000000..b5e95cd
--- /dev/null
+++ b/Makefiles/go.mk
@@ -0,0 +1,13 @@
+.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
+
+clean:
+ rm -f puzzle-[12]
diff --git a/Makefiles/lex.mk b/Makefiles/lex.mk
new file mode 100644
index 0000000..a11b1e6
--- /dev/null
+++ b/Makefiles/lex.mk
@@ -0,0 +1,17 @@
+.POSIX:
+
+CC = cc
+CFLAGS = -Wall -Wextra -Wpedantic -Werror \
+ -march=native -mtune=native -O3 -flto \
+ -pipe
+
+ALL = ${CC} ${CFLAGS} ${CPPFLAGS} ${LDLIBS} ${LDFLAGS}
+
+all:
+ flex -f -DYY_NO_INPUT --nounput puzzles.l
+ ${ALL} -lfl -DPART1 -o puzzle-1 lex.yy.c
+ ${ALL} -lfl -DPART2 -o puzzle-2 lex.yy.c
+ rm lex.yy.c
+
+clean:
+ rm -f puzzle-[12]
diff --git a/Makefiles/py.mk b/Makefiles/py.mk
new file mode 100644
index 0000000..e32992b
--- /dev/null
+++ b/Makefiles/py.mk
@@ -0,0 +1,9 @@
+.POSIX:
+
+all:
+ sed '/START PART 2/,/END PART 2/d' puzzles.py >puzzle-1.py
+ sed '/START PART 1/,/END PART 1/d' puzzles.py >puzzle-2.py
+ chmod +x puzzle-[12].py
+
+clean:
+ rm -f puzzle-[12].py