summaryrefslogtreecommitdiff
path: root/src/01/01b/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'src/01/01b/Makefile')
-rw-r--r--src/01/01b/Makefile37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/01/01b/Makefile b/src/01/01b/Makefile
new file mode 100644
index 0000000..008c82c
--- /dev/null
+++ b/src/01/01b/Makefile
@@ -0,0 +1,37 @@
+#!/usr/bin/make -f
+SHELL=/bin/sh
+
+CC=clang
+TEST_LIBS = -lcgreen
+
+BUILDDIR := build
+OBJS := $(addprefix $(BUILDDIR)/,stack.o)
+TEST_OBJS := $(addprefix $(BUILDDIR)/,stack_test.o)
+
+$(BUILDDIR)/%.o : %.c
+ $(COMPILE.c) $(OUTPUT_OPTION) $<
+
+.PHONY: all
+all: $(OBJS) $(BUILDDIR)/main.o
+ $(CC) $(OBJS) $(BUILDDIR)/main.o -o $(BUILDDIR)/program
+
+.PHONY: test
+test: $(OBJS) $(TEST_OBJS)
+ $(CC) $(OBJS) $(TEST_OBJS) $(TEST_LIBS) -o $(BUILDDIR)/test
+
+$(OBJS): | $(BUILDDIR)
+
+$(TEST_OBJS): | $(BUILDDIR)
+
+$(BUILDDIR):
+ mkdir $(BUILDDIR)
+
+.PHONY: clean
+clean:
+ rm -fr build
+
+run : all
+ ./build/program
+
+run_test : test
+ cgreen-runner -c -v $(BUILDDIR)/test