diff --git a/.gitignore b/.gitignore index d18dd37..e99c1a3 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ exe build *.o *.bkp +resource/* diff --git a/bstart.sh b/bstart.sh new file mode 100755 index 0000000..554ea66 --- /dev/null +++ b/bstart.sh @@ -0,0 +1,20 @@ + +if [ "$1" = "-rbuild" ] || [ "$1" = "-rb" ] +then + make clean #on clean pour pouvoir tout rebuild aprés +fi + +#si le build est passé sans soucis +if make; then + #on prépare les fichiers de stockage si ils existent pas + if [[ ! -d "stockage" ]] + then + echo "le dossier 'stockage' n'existe pas, un jeux de données préfait à été collé à l'interrieur afin de faciliter l'utilisation da l'application" + mkdir stockage + cp jdd/* stockage + echo + fi + + #on lance + ./app +fi diff --git a/makefile b/makefile new file mode 100644 index 0000000..652680e --- /dev/null +++ b/makefile @@ -0,0 +1,26 @@ +SRC_DIR = src +GCCFLAGS = -Wall -Wextra -I $(SRC_DIR) -Wno-unused-parameter -Wno-unused-but-set-variable +BUILD_DIR = build +SOURCES = $(shell find src -name '*.c') +TARGETS = $(patsubst %.c, %.o, $(SOURCES)) +TARGETS := $(addprefix $(BUILD_DIR)/, $(TARGETS)) + +APP_NAME = app + +GREEN = '\033[32;1m' +RESET = '\033[0;22m' + +all: $(APP_NAME) + +$(APP_NAME): $(TARGETS) + @gcc $(GCCFLAGS) -o $(APP_NAME) $(TARGETS) + @echo -e $(GREEN)build done.$(RESET) + +$(TARGETS): $(SOURCES) + @mkdir -p $(@D) + @gcc $(GCCFLAGS) -c $(patsubst %.o, %.c, $(@:$(BUILD_DIR)/%=%)) -o $@ + + +clean: + @rm -r $(BUILD_DIR) $(APP_NAME) + @echo -e $(GREEN)clean done.$(RESET)