parent
ea0aa680b2
commit
b72e787e47
@ -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
|
@ -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)
|
Reference in new issue