From b0cc0eac66fce61a21cd0567e7721cc877e2599e Mon Sep 17 00:00:00 2001 From: mo khan Date: Mon, 29 Jun 2020 13:26:52 -0600 Subject: Create a separate executable for manually running the program --- src/01/01a/Makefile | 22 ++++++++++++++++------ src/01/01a/main.c | 8 ++++++++ src/01/01a/priority_queue.c | 1 - 3 files changed, 24 insertions(+), 7 deletions(-) create mode 100644 src/01/01a/main.c (limited to 'src/01') diff --git a/src/01/01a/Makefile b/src/01/01a/Makefile index 7952e21..43a68da 100644 --- a/src/01/01a/Makefile +++ b/src/01/01a/Makefile @@ -2,20 +2,27 @@ SHELL=/bin/sh CC=gcc -LIBS = -lcgreen +TEST_LIBS = -lcgreen BUILDDIR := build -OBJS := $(addprefix $(BUILDDIR)/,priority_queue.o priority_queue_test.o) +OBJS := $(addprefix $(BUILDDIR)/,priority_queue.o) +TEST_OBJS := $(addprefix $(BUILDDIR)/,priority_queue_test.o) $(BUILDDIR)/%.o : %.c $(COMPILE.c) $(OUTPUT_OPTION) $< .PHONY: all -all: $(OBJS) - $(CC) $(OBJS) $(LIBS) -o $(BUILDDIR)/program +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) @@ -23,5 +30,8 @@ $(BUILDDIR): clean: rm -fr build -test : all - cgreen-runner -c -v $(BUILDDIR)/program +run : all + ./build/program + +run_test : test + cgreen-runner -c -v $(BUILDDIR)/test diff --git a/src/01/01a/main.c b/src/01/01a/main.c new file mode 100644 index 0000000..9f50782 --- /dev/null +++ b/src/01/01a/main.c @@ -0,0 +1,8 @@ +#include +#include "priority_queue.h" + +int main(int argc, char *argv[]) +{ + printf("hello world\n"); + return 0; +} diff --git a/src/01/01a/priority_queue.c b/src/01/01a/priority_queue.c index f6e3364..2d0670d 100644 --- a/src/01/01a/priority_queue.c +++ b/src/01/01a/priority_queue.c @@ -65,4 +65,3 @@ void destroy(PriorityQueue *queue) { } free(queue); } - -- cgit v1.2.3