From 4742dd73046c53cff7fe54deee58358c3b193206 Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Wed, 30 Nov 2022 12:23:04 +0100 Subject: Add default Makefiles --- Makefiles/awk.mk | 9 +++++++++ Makefiles/c.mk | 19 +++++++++++++++++++ Makefiles/go.mk | 13 +++++++++++++ Makefiles/lex.mk | 17 +++++++++++++++++ Makefiles/py.mk | 9 +++++++++ 5 files changed, 67 insertions(+) create mode 100644 Makefiles/awk.mk create mode 100644 Makefiles/c.mk create mode 100644 Makefiles/go.mk create mode 100644 Makefiles/lex.mk create mode 100644 Makefiles/py.mk (limited to 'Makefiles') 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 -- cgit v1.2.3