summaryrefslogtreecommitdiffstats
path: root/02_exercise/Makefile
diff options
context:
space:
mode:
Diffstat (limited to '02_exercise/Makefile')
-rw-r--r--02_exercise/Makefile32
1 files changed, 32 insertions, 0 deletions
diff --git a/02_exercise/Makefile b/02_exercise/Makefile
new file mode 100644
index 0000000..c43966f
--- /dev/null
+++ b/02_exercise/Makefile
@@ -0,0 +1,32 @@
+#!/usr/bin/make
+.SUFFIXES:
+.PHONY: all run pack clean
+TAR = shell prog
+SRC = $(wildcard *.c)
+OBJ = $(SRC:%.c=%.o)
+PCK = lab-2.zip
+
+CFLAGS = -std=gnu11 -c -g -Os -Wall -Werror -MMD -MP
+
+DEP = $(OBJ:%.o=%.d)
+-include $(DEP)
+
+%.o: %.c
+ $(CC) $(CFLAGS) $< -o $@
+
+all: $(TAR)
+
+prog: prog.o
+ $(CC) -o $@ $^
+
+shell: $(filter-out prog.o,$(OBJ))
+ $(CC) -o $@ $^
+
+run: all
+ ./shell
+
+pack:
+ zip $(PCK) $(SRC) $(wildcard *.h) Makefile
+
+clean:
+ $(RM) $(RMFILES) $(TAR) $(OBJ) $(DEP) $(PCK)