From 4a5b0b716368d5d1056b87a64b8e8d0cfa6ca64a Mon Sep 17 00:00:00 2001
From: Anton Tetov <anton@tetov.se>
Date: Fri, 10 Jun 2022 12:02:57 +0200
Subject: [PATCH] new Makefile to clone submodule and make darknet with LIBSO=1

---
 Makefile  | 14 ++++++++++++++
 README.md | 13 +++++--------
 2 files changed, 19 insertions(+), 8 deletions(-)
 create mode 100644 Makefile

diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..22b2866
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,14 @@
+.DEFAULT_GOAL := default
+
+LIBSO=1
+export LIBSO
+
+darknet: 
+	git submodule init
+	git submodule update
+
+default: darknet
+	$(MAKE) -C darknet
+
+.PHONY: default
+
diff --git a/README.md b/README.md
index c70a027..2620539 100644
--- a/README.md
+++ b/README.md
@@ -9,7 +9,7 @@ Darknet is a deep learning framework created by the author of YOLO. It is writte
 ### Detector Training
 Check the [instruction](https://github.com/AlexeyAB/darknet#how-to-train-to-detect-your-custom-objects) for how to train the YOLO detector.
 
-## Camera Calibartion
+## Camera Calibration
 Think YOLO as a black box, it consumes photos that contains objects or not and outputs objects' positions in the pixel coordinate. However, we want to know their positions on the planting bed, namely global coordinate. That is why we need camera calibration. This step was done seperately on MATLAB and offered us the intrinsic matrix of the camera. You **do not need to redo** this unless you want to change to a new model of camera. Check MATLAB [instruction](https://ww2.mathworks.cn/help/vision/ug/using-the-single-camera-calibrator-app.html;jsessionid=1a474c11e3e6063620885c4ae708) for how to use the camera calibration app.
 
 **Note**: The result have to be transferred to `struct`, a MATLAB data type, before saving.  
@@ -33,19 +33,16 @@ $$
 $$ 
 
 ## Install, Compile
-1. `git clone *link* --recurse-submodules` this repo along with the submodule, Darknet;
-2. Go to the path of the submodule `cd ./darknet`;
-3. 
-3. Change Makefile;
-4. Compile Darknet;
-5. Go back to the main path and `conda create --name <env> --file requirements.txt`, this will install all relied python packages. Change the enviroment name to whatever you like. 
+1. `git clone git@gitlab.control.lth.se:alexp/farmbot`
+2. `make` to download darknet and compile
+3. `conda create --name farm --file requirements.txt`, this will install all required python packages. Change the enviroment name to whatever you like. 
 
 **Note**: I assume conda, a package management software, has been installed before.
 
 ### Compile Darknet
 Check the [instruction](https://github.com/AlexeyAB/darknet#how-to-compile-on-linux-using-make) for how to use `Make` to compile on Linux. 
 
-**Note**: Change `LIBSO=1` in Makefile. This will ensure libdarknet.so be generated, which will be used in darknet.py.
+In the top Makefile `LIBSO=1` is set before the Makefile in darknet is run. This will ensure libdarknet.so be generated, which will be used in darknet.py.
 
 ## Before starting the system
 **Always calibrate the position before using!**  
-- 
GitLab