Makefile: add a SILENT flag

This makes it print nothing to stdout.

Also fixed some irregularities.
This commit is contained in:
James R 2021-02-18 07:03:25 -08:00
parent 3d32f3145c
commit 747c278bc2
2 changed files with 28 additions and 12 deletions

View File

@ -81,9 +81,16 @@
#
#############################################################################
,=,
ifeq (,$(filter-out cleandep clean distclean,$(or $(MAKECMDGOALS),all)))
CLEANONLY=1
else ifndef SILENT
echo=@echo "$(1)"
ifndef MAKE_RESTARTS
print=$(info $(1))
endif
endif
ALL_SYSTEMS=\
PANDORA\
@ -104,7 +111,7 @@ ALL_SYSTEMS=\
ifeq (,$(filter $(ALL_SYSTEMS),$(.VARIABLES)))
ifeq ($(OS),Windows_NT) # all windows are Windows_NT...
$(call print,Detected a Windows system, compiling for 32-bit MinGW SDL2...)
$(call print,Detected a Windows system$(,) compiling for 32-bit MinGW SDL2...)
# go for a 32-bit sdl mingw exe by default
MINGW=1
@ -243,6 +250,12 @@ endif
MSGFMT?=msgfmt
ifdef WINDOWSHELL
COMPTIME=-..\comptime.bat
else
COMPTIME=-../comptime.sh
endif
ifndef ECHO
NASM:=@$(NASM)
REMOVE:=@$(REMOVE)
@ -257,6 +270,7 @@ ifndef ECHO
MSGFMT:=@$(MSGFMT)
UPX:=@$(UPX)
UPX_OPTS+=-q
COMPTIME:=@$(COMPTIME)
endif
ifdef NONET
@ -543,6 +557,7 @@ OBJS:=$(i_main_o) \
DEPS:=$(patsubst $(OBJDIR)/%.o,$(DEPDIR)/%.d,$(OBJS))
OBJS+=$(OBJDIR)/comptime.o
ifndef SILENT
ifndef ECHO
ifndef NOECHOFILENAMES
define echoName =
@ -550,6 +565,7 @@ define echoName =
endef
endif
endif
endif
# List of languages to compile.
# For reference, this is the command I use to build a srb2.pot file from the source code.
@ -603,11 +619,11 @@ asm:
$(BIN)/$(EXENAME): $(POS) $(OBJS)
-$(MKDIR) $(BIN)
@echo Linking $(EXENAME)...
$(call echo,Linking $(EXENAME)...)
$(LD) $(LDFLAGS) $(OBJS) -o $(BIN)/$(EXENAME) $(LIBS)
ifndef VALGRIND
ifndef NOOBJDUMP
@echo Dumping debugging info
$(call echo,Dumping debugging info)
$(OBJDUMP) $(OBJDUMP_OPTS) $(BIN)/$(EXENAME) > $(BIN)/$(DBGNAME).txt
ifdef WINDOWSHELL
-$(GZIP) $(GZIP_OPTS) $(BIN)/$(DBGNAME).txt
@ -626,10 +642,10 @@ ifndef NOUPX
-$(UPX) $(UPX_OPTS) $(BIN)/$(EXENAME)
endif
endif
@echo Build is done, please look for $(EXENAME) in $(BIN), \(checking for post steps\)
$(call echo,Build is done$(,) please look for $(EXENAME) in $(BIN)$(,) (checking for post steps))
reobjdump:
@echo Redumping debugging info
$(call echo,Redumping debugging info)
$(OBJDUMP) $(OBJDUMP_OPTS) $(BIN)/$(DBGNAME) > $(BIN)/$(DBGNAME).txt
ifdef WINDOWSHELL
-$(GZIP) $(GZIP_OPTS) $(BIN)/$(DBGNAME).txt
@ -666,7 +682,7 @@ endif
#dependecy made by gcc itself !
ifndef DUMMY
ifneq (,$(filter-out cleandep clean distclean,$(or $(MAKECMDGOALS),all)))
ifndef CLEANONLY
$(call print,Checking dependency files...)
-include $(DEPS)
endif
@ -675,7 +691,7 @@ endif
$(DEPDIR)/%.d: %.c
# windows makes it too hard !
ifndef WINDOWSHELL
ifndef ECHO
ifdef echoName
@printf "%-20.20s\r" $<
endif
endif
@ -688,11 +704,10 @@ $(OBJDIR)/z_zone.o: z_zone.c
endif
$(OBJDIR)/comptime.o::
ifdef WINDOWSHELL
-..\comptime.bat .
else
-../comptime.sh .
ifdef echoName
@echo -- comptime.c ...
endif
$(COMPTIME) .
$(CC) $(CFLAGS) $(WFLAGS) -c comptime.c -o $@
$(BIN)/%.mo: locale/%.po

View File

@ -47,7 +47,8 @@ ifdef MACOSX
endif
# Automatically set version flag, but not if one was manually set
ifeq (,$(filter GCC%,$(.VARIABLES)))
# And don't bother if this is a clean only run
ifeq (,$(filter GCC% CLEANONLY,$(.VARIABLES)))
version:=$(shell $(CC) --version)
# check if this is in fact GCC
ifneq (,$(or $(findstring gcc,$(version)),$(findstring GCC,$(version))))