check if size is ok for API8

This commit is contained in:
Mylloon 2023-05-03 14:18:21 +02:00
parent aeed60cef4
commit 158cf5446b
Signed by: Anri
GPG key ID: A82D63DFF8D1317F

View file

@ -15,6 +15,10 @@ CHMOD = chmod
CP = rsync -R CP = rsync -R
MINIFIER = minifier MINIFIER = minifier
CURL = curl -s CURL = curl -s
DU = du --block-size=1K --human-readable
TAIL = tail
GREP = grep
AWK = awk
# Déclaration des options du compilateur # Déclaration des options du compilateur
CFLAGS = -Wall -O3 CFLAGS = -Wall -O3
@ -35,6 +39,8 @@ VSCFILES = $(PROGNAME).vcxproj $(PROGNAME).sln
EXTRAFILES = COPYING $(wildcard shaders/*.?s images/*.png) $(VSCFILES) EXTRAFILES = COPYING $(wildcard shaders/*.?s images/*.png) $(VSCFILES)
DISTFILES = $(SOURCES) Makefile $(HEADERS) $(DOXYFILE) $(EXTRAFILES) DISTFILES = $(SOURCES) Makefile $(HEADERS) $(DOXYFILE) $(EXTRAFILES)
MAXSIZE = 64
# Traitements automatiques pour ajout de chemins et options (ne pas modifier) # Traitements automatiques pour ajout de chemins et options (ne pas modifier)
ifneq (,$(shell ls -d /usr/local/include 2>/dev/null | tail -n 1)) ifneq (,$(shell ls -d /usr/local/include 2>/dev/null | tail -n 1))
CPPFLAGS += -I/usr/local/include CPPFLAGS += -I/usr/local/include
@ -111,9 +117,22 @@ clean:
distminified: distdirminified dist distminified: distdirminified dist
# Remove all unnecessary extra files # Remove all unnecessary extra files
distdirminified: EXTRAFILES := $(filter-out $(VSCFILES) $(DOXYFILE),$(EXTRAFILES)) distdirminified: EXTRAFILES := $(filter-out $(VSCFILES),$(EXTRAFILES))
distdirminified: DISTFILES := $(filter-out $(DOXYFILE),$(DISTFILES)) distdirminified: DISTFILES := $(filter-out $(DOXYFILE),$(DISTFILES))
distdirminified: distdir distdirminified: distdir
@$(CURL) https://raw.githubusercontent.com/BaseMax/C-Minifier/main/Minifier.c | $(CC) -o $(MINIFIER) $(CFLAGS) -x c - @$(CURL) https://raw.githubusercontent.com/BaseMax/C-Minifier/main/Minifier.c | $(CC) -o $(MINIFIER) $(CFLAGS) -x c -
$(foreach f,$(SOURCES),./$(MINIFIER) $(f) $(distdir)/$(f);) $(foreach f,$(SOURCES),./$(MINIFIER) $(f) $(distdir)/$(f);)
@$(RM) $(MINIFIER) @$(RM) $(MINIFIER)
size: $(PROGNAME)
size:
@$(DU) --total $(PROGNAME) $(filter-out $(VSCFILES) $(DOXYFILE) COPYING,$(EXTRAFILES)) | \
$(TAIL) -n 1 | \
$(GREP) -o '[0-9]*K'| \
$(AWK) 'BEGIN{ \
if($$1 < $(MAXSIZE)) { \
print "> Taille conforme" \
} else { \
print "> Fichiers trop lourd" \
} \
}'