-#Makefile for nbody program
+# Makefile to build all programs
-CXX = gcc
-LIBRARIES = -lm -lGL -lglut -lGLU -lpthread
-FLAGS = --std=c99 -Wall -pedantic -g
-PREPROCESSOR_FLAGS = -fopenmp
-LINK_OBJ = main.o nbody.o graphics.o
+all : single-thread/nbody mthread/nbody openmp/nbody
-BIN = nbody
+single-thread/nbody :
+ make -C single-thread
-$(BIN) : $(LINK_OBJ)
- $(CXX) -o $(BIN) $(LINK_OBJ) $(LIBRARIES)
+mthread/nbody :
+ make -C mthread
-%.o : %.c
- $(CXX) $(FLAGS) $(PREPROCESSOR_FLAGS) -c $<
+openmp/nbody :
+ make -C openmp
clean :
- $(RM) $(BIN) $(OBJ) $(LINK_OBJ)
-
-clean_full: #cleans up all backup files
- $(RM) $(BIN) $(OBJ) $(LINK_OBJ)
- $(RM) *.*~
- $(RM) *~
+ make -C single-thread clean_full
+ make -C mthread clean_full
+ make -C openmp clean_full
+ rm *~