Commit ea68116

mo khan <mo.khan@gmail.com>
2020-06-28 23:15:18
Clean up makefile
1 parent 0a11c21
Changed files (3)
src/01/01.mk
@@ -1,25 +0,0 @@
-#test : build/main
-	#cgreen-runner -c main
-
-#main : main.o priority_queue_test.o stack_test.o swap_singly_linked_list_test.o swap_doubly_linked_list_test.o min_stack_test.o
-	#$(CC) main.o priority_queue_test.o stack_test.o swap_singly_linked_list_test.o swap_doubly_linked_list_test.o min_stack_test.o -lcgreen -o main
-
-#main.o : src/01/main.c
-	#$(CC) -c main.c
-
-all : build/priority_queue_test.o build/stack_test.o build/min_stack_test.o build/swap_singly_linked_list_test.o build/swap_doubly_linked_list_test.o
-
-build/priority_queue_test.o : src/01/priority_queue_test.c
-	$(CC) -c src/01/priority_queue_test.c
-
-build/stack_test.o : src/01/stack_test.c
-	$(CC) -c src/01/stack_test.c
-
-build/min_stack_test.o : src/01/min_stack_test.c
-	$(CC) -c src/01/min_stack_test.c
-
-build/swap_singly_linked_list_test.o : src/01/swap_singly_linked_list_test.c
-	$(CC) -c src/01/swap_singly_linked_list_test.c
-
-build/swap_doubly_linked_list_test.o : src/01/swap_doubly_linked_list_test.c
-	$(CC) -c src/01/swap_doubly_linked_list_test.c
Doxyfile
@@ -58,7 +58,7 @@ PROJECT_LOGO           =
 # entered, it will be relative to the location where doxygen was started. If
 # left blank the current directory will be used.
 
-OUTPUT_DIRECTORY       = doc
+OUTPUT_DIRECTORY       = build
 
 # If the CREATE_SUBDIRS tag is set to YES then doxygen will create 4096 sub-
 # directories (in 2 levels) under the output directory of each output format and
Makefile
@@ -1,33 +1,36 @@
+#!/usr/bin/make -f
+SHELL=/bin/sh
+
 CC=gcc
-OBJDIR := build
-objects = build/*.o
-OBJS := $(addprefix $(OBJDIR)/,priority_queue_test.o stack_test.o min_stack_test.o swap_singly_linked_list_test.o swap_doubly_linked_list_test.o)
+LIBS = -lcgreen
 
-include src/**/*.mk
+BUILDDIR := build
+OBJS := $(addprefix $(BUILDDIR)/,priority_queue_test.o stack_test.o min_stack_test.o swap_singly_linked_list_test.o swap_doubly_linked_list_test.o main.o)
 
-#test : build/main
-	#cgreen-runner -c main
+#doc : doc/
+#doxygen Doxyfile
 
-#ci : build/main
-	#mkdir -p junit
-	#cgreen-runner -c --xml=build/junit/ main
+$(BUILDDIR)/%.o : src/01/%.c
+	$(COMPILE.c) $(OUTPUT_OPTION) $<
 
-#doc : doc/
-	#doxygen Doxyfile
+test : all
+	cgreen-runner -c $(BUILDDIR)/main
 
-#build/main : $(objects)
-	#$(CC) -o build/main $(CFLAGS) $(objects)
-	#$(CC) main.o priority_queue_test.o stack_test.o swap_singly_linked_list_test.o swap_doubly_linked_list_test.o min_stack_test.o -lcgreen -o main
+ci : all
+	cgreen-runner -c --xml=$(BUILDDIR)/ $(BUILDDIR)/main
 
-$(OBJDIR)/%.o : %.c
-	$(COMPILE.c) $(OUTPUT_OPTION) $<
+.PHONY: all
+all: $(OBJS) $(BUILDDIR)/html
+	$(CC) $(OBJS) $(LIBS) -o $(BUILDDIR)/main
 
-all: $(OBJS)
+$(OBJS): | $(BUILDDIR)
 
-$(OBJS): | $(OBJDIR)
+$(BUILDDIR):
+	mkdir $(BUILDDIR)
 
-$(OBJDIR):
-	mkdir $(OBJDIR)
+$(BUILDDIR)/html :
+	doxygen Doxyfile
 
+.PHONY: clean
 clean:
 	rm -fr build