summaryrefslogtreecommitdiffstats
path: root/04_exercise/Makefile
diff options
context:
space:
mode:
Diffstat (limited to '04_exercise/Makefile')
-rw-r--r--04_exercise/Makefile34
1 files changed, 34 insertions, 0 deletions
diff --git a/04_exercise/Makefile b/04_exercise/Makefile
new file mode 100644
index 0000000..064ec4b
--- /dev/null
+++ b/04_exercise/Makefile
@@ -0,0 +1,34 @@
+#!/usr/bin/make
+.SUFFIXES:
+.PHONY: all run pack clean
+
+SRC = $(wildcard *.c)
+OBJ = $(SRC:%.c=%.o)
+TAR = threadpool
+PCK = lab-4.zip
+
+CFLAGS = -std=gnu11 -c -g -Os -Wall -MMD -MP
+LFLAGS = -pthread
+
+DEP = $(OBJ:%.o=%.d)
+-include $(DEP)
+
+%.o: %.c
+ $(CC) $(CFLAGS) $< -o $@
+
+$(TAR): $(filter-out quicksort.o,$(OBJ))
+ $(CC) $(LFLAGS) -o $@ $^
+
+all: $(TAR)
+
+bench: $(filter-out main.o,$(OBJ))
+ $(CC) $(LFLAGS) -o $@ $^
+
+run: all
+ ./$(TAR)
+
+pack: clean
+ zip $(PCK) $(SRC) $(wildcard *.h) $(wildcard *.pdf) $(wildcard *.txt) Makefile
+
+clean:
+ $(RM) $(RMFILES) $(OBJ) $(TAR) bench $(DEP) $(PCK)