From 58c58a97afb84d8fe4f859c6874ac735d33b5d93 Mon Sep 17 00:00:00 2001 From: Cory Date: Sun, 24 Sep 2023 15:39:37 +0200 Subject: [PATCH] Create Makefiles for easier compilation --- Makefile | 12 +++++++++++ README.md | 56 ++++++++++++++++++++++++++++++++++++++++++++++---- latex/Makefile | 5 +++++ src/Makefile | 6 +++++- 4 files changed, 74 insertions(+), 5 deletions(-) create mode 100644 Makefile create mode 100644 latex/Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..e430866 --- /dev/null +++ b/Makefile @@ -0,0 +1,12 @@ +MAKE=make + +.PHONY: code latex docs + +code: + $(MAKE) -C src + +latex: + $(MAKE) -C latex + +docs: + $(MAKE) -C src doxygen diff --git a/README.md b/README.md index 95ac081..6d8b69b 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ - [Project](https://anderkve.github.io/FYS3150/book/projects/project2.html) -## Compile and run +## Compile and run C++ programs Compiling and linking is done using Make, make sure you are in the root folder. To create executable files, run shell commands @@ -18,13 +18,61 @@ To run `script-name` ./main ``` +There are two ways of compiling the code. + +The first way is to go into the src directory and compile + +```shell + cd src && make +``` + +or you could use make in the project directory + +```shell + make code +``` + +and it will compile everything with you needing to move into **src**. + +You can run any of the compiled programs by going into the src directory +and then doing + +```shell + ./program-name +``` + ## Generate plots -To generate plots, the Python scripts is run using +To generate plots, you can do ```shell -python3 +python3 plot.py ``` -The plots will be saved inside [latex/images](../blob/main/latex/images). +and the plots will be saved inside [latex/images](latex/images). + + +## Generate documentation + +For this project, we have used Doxygen to generate some nice and readable +documentation for the C++ code. + +If you want to generate the documentation you can do + +```shell + make docs +``` + +in the project root, and the documentation will be made into the **docs** +directory. + +## Generate project document + +If you want to recompile the Pdf file, you can do + +```shell + make latex +``` + +and a Pdf file will be produced inside the **latex** directory. diff --git a/latex/Makefile b/latex/Makefile new file mode 100644 index 0000000..4e509aa --- /dev/null +++ b/latex/Makefile @@ -0,0 +1,5 @@ + +.PHONY: latex + +latex: + pdflatex assignment-2.tex diff --git a/src/Makefile b/src/Makefile index daddb06..5b4b6d3 100644 --- a/src/Makefile +++ b/src/Makefile @@ -16,7 +16,7 @@ else endif -.PHONY: clean +.PHONY: doxygen clean all: test_suite main @@ -31,6 +31,10 @@ test_suite: test_suite.o $(LIBOBJS) %.o: %.cpp $(CC) -c $^ -o $@ $(DBGFLAG) -I$(INCLUDE) +# Make documentation +doxygen: + doxygen + clean: rm *.o rm test_suite