From 7e2160f8e5693e3cf22200a721ba204b506f709e Mon Sep 17 00:00:00 2001 From: Axel CHEMIN Date: Fri, 20 Nov 2020 23:12:00 +0100 Subject: [PATCH] Ajout du mode debug --- Makefile | 6 +++--- README.md | 2 ++ src/main.c | 3 +++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 386ae4c..c9c967f 100644 --- a/Makefile +++ b/Makefile @@ -12,12 +12,12 @@ gcc := "/mnt/c/Program Files (x86)/mingw-w64/i686-8.1.0-posix-dwarf-rt_v6-rev0/m VERBOSE_THRESHOLD?=3 -RELEASE?=0 -ifeq ($(RELEASE), 1) +DEBUG?=0 +ifeq ($(DEBUG), 0) CFLAGS = -W -Wall VERBOSE_THRESHOLD = 0 else - CFLAGS = -W -Wall -g -O0 + CFLAGS = -W -Wall -g -O0 -DDEBUG endif diff --git a/README.md b/README.md index 87a835a..17fc45c 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,8 @@ Dossier src/ contenant les sources Il faut installer les dépendances : libusb avec `apt-get install libusb-1.0` Pour compiler il faut lancer la commande `make` +Pour avoir un niveau haut de verbosité, on peut lancer la commande `make DEBUG=1` + ## Utiliser diff --git a/src/main.c b/src/main.c index dd6eb3b..9393193 100644 --- a/src/main.c +++ b/src/main.c @@ -7,6 +7,9 @@ int main(int argc, char *argv[]){ libusb_context *context; usbinit(&context); + #ifdef DEBUG + libusb_set_option(context, LIBUSB_OPTION_LOG_LEVEL, LIBUSB_LOG_LEVEL_DEBUG); + #endif if(argc>1){ //command mode -- libgit2 0.21.2