aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2024-12-06 18:43:40 +0100
committerThomas Voss <mail@thomasvoss.com> 2024-12-06 18:43:40 +0100
commit4225b181d04ee82ae8365a6303fe0adf916308f7 (patch)
tree4fd20ed3fa09d4964f2a0cccd4045417d41e8881
parentd1b4d95b6f4be5115843752a522eb3ddd77b12a8 (diff)
Update Makefiles
-rw-r--r--Makefiles/c.mk26
-rw-r--r--Makefiles/go.mk18
-rw-r--r--Makefiles/lex.mk11
3 files changed, 30 insertions, 25 deletions
diff --git a/Makefiles/c.mk b/Makefiles/c.mk
index d4af730..e890ad0 100644
--- a/Makefiles/c.mk
+++ b/Makefiles/c.mk
@@ -1,19 +1,21 @@
.POSIX:
-CC = cc
-CFLAGS = -Wall -Wextra -Wpedantic -Werror \
- -march=native -mtune=native -O3 -flto \
- -pipe
+CC = cc
+CFLAGS = \
+ -Wall -Wextra -Wpedantic -Werror \
+ -march=native -mtune=native -O3 -flto \
+ -pipe
-ALL = ${CC} ${CFLAGS} ${CPPFLAGS} ${LDLIBS} ${LDFLAGS}
+ALL = ${CC} ${CFLAGS} ${CPPFLAGS} ${LDLIBS}
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
+ if [ -f puzzles.c ]; \
+ then \
+ ${ALL} -DPART1=1 -o puzzle-1 puzzles.c; \
+ ${ALL} -DPART2=1 -o puzzle-2 puzzles.c; \
+ fi
+ if [ -f puzzle-1.c ]; then ${ALL} -o puzzle-1 puzzle-1.c; fi
+ if [ -f puzzle-2.c ]; then ${ALL} -o puzzle-2 puzzle-2.c; fi
clean:
- rm -f puzzle-[12]
+ rm -f puzzle-[12] \ No newline at end of file
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
diff --git a/Makefiles/lex.mk b/Makefiles/lex.mk
index a11b1e6..3c6802f 100644
--- a/Makefiles/lex.mk
+++ b/Makefiles/lex.mk
@@ -1,11 +1,12 @@
.POSIX:
-CC = cc
-CFLAGS = -Wall -Wextra -Wpedantic -Werror \
- -march=native -mtune=native -O3 -flto \
+CC = cc
+CFLAGS = \
+ -Wall -Wextra -Wpedantic -Werror \
+ -march=native -mtune=native -O3 -flto \
-pipe
-ALL = ${CC} ${CFLAGS} ${CPPFLAGS} ${LDLIBS} ${LDFLAGS}
+ALL = ${CC} ${CFLAGS} ${CPPFLAGS} ${LDLIBS}
all:
flex -f -DYY_NO_INPUT --nounput puzzles.l
@@ -14,4 +15,4 @@ all:
rm lex.yy.c
clean:
- rm -f puzzle-[12]
+ rm -f puzzle-[12] \ No newline at end of file