aboutsummaryrefslogtreecommitdiff
path: root/makefile
diff options
context:
space:
mode:
Diffstat (limited to 'makefile')
-rw-r--r--makefile27
1 files changed, 27 insertions, 0 deletions
diff --git a/makefile b/makefile
new file mode 100644
index 0000000..ef4d837
--- /dev/null
+++ b/makefile
@@ -0,0 +1,27 @@
+# INCLUDE is where you find the headerfiles for the libs you're using. They are used during compilation.
+INCLUDE=-I /usr/include/boost/
+
+# LIBDIR is where you can find the linkable objects or whatever. They are used for the linking stage.
+LIBDIR=-L /usr/lib/x86_64-linux-gnu/
+
+# LIBS are the libs you are using written with a -l and then ignoring the lib-part at the beginning of the file's name.
+# So "libboost_date_time.a" will be just "-lboost_date_time"
+LIBS=-lboost_date_time
+
+# Sources are the source code files. Only the .cpp files, becuase the .h files are included into them during pre-processing.
+SOURCES=$(wildcard src/*.cpp)
+OBJDIR=obj/
+OBJECTS=$(patsubst src/%.cpp, $(OBJDIR)%.o, $(SOURCES))
+# This last line creates an identical list of objects based on the list of .cpp files.
+
+a.out: $(OBJECTS)
+ g++ $(LIBDIR) $(LIBS) $(OBJECTS)
+
+$(OBJECTS): obj/%.o : src/%.cpp
+ g++ $(INCLUDE) -c $< -o $@
+
+clean:
+ rm obj/*.o
+
+cleanall:
+ rm obj/*.o a.out