commit 64da71212ce18d3288514dac0a0477df5a5b2d75
parent 95752fee2b8b9ee983d8cb79a7bc1c224aaefea9
Author: superpozycja <anna@superpozycja.net>
Date: Sun, 1 Sep 2024 19:35:40 +0200
fix makefile so it * actually * works
Diffstat:
1 file changed, 20 insertions(+), 5 deletions(-)
diff --git a/makefile b/makefile
@@ -4,12 +4,24 @@ LIB_OBJS=0xdeadbabe
all: lib challs
-challs: $(CHALLS_OBJS) dirs
- $(foreach file,$(CHALLS_SRC),$(CC) -o bin/$(subst src/,,$(basename $(file))) $(file) $(LIB_OBJS);)
-
lib: $(LIB_SRC) dirs
- $(foreach file,$(LIB_SRC),$(CC) -c -o bin/$(basename $(file)).o $(file);)
- $(eval override LIB_OBJS=$(shell find bin/lib -name '*.o'))
+ $(foreach file,$(LIB_SRC),$(CC) -c -shared \
+ -o bin/lib/lib$(notdir $(subst .c,, $(file))).so $(file);)
+
+
+lib_objs: lib dirs
+ $(eval override LIB_OBJS=$(shell find bin/lib -name '*.so'))
+ find bin/lib -name '*.so'
+ echo $(LIB_OBJS)
+
+challs: $(CHALLS_SRC) dirs lib lib_objs
+ $(foreach file,$(CHALLS_SRC),\
+ $(CC) -o \
+ bin/$(subst src/,,$(basename $(file))) $(file) \
+ -Ilib/\
+ -Lbin/lib\
+ $(foreach lib_name,$(LIB_OBJS),\
+ -l$(subst lib,,$(subst .so,,$(notdir $(lib_name)))));)
dirs:
mkdir -p bin
@@ -22,3 +34,6 @@ dirs:
mkdir -p bin/s6
mkdir -p bin/s7
mkdir -p bin/s8
+
+clean:
+ rm -rf bin