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

View File

@ -47,7 +47,8 @@ ifdef MACOSX
endif endif
# Automatically set version flag, but not if one was manually set # 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) version:=$(shell $(CC) --version)
# check if this is in fact GCC # check if this is in fact GCC
ifneq (,$(or $(findstring gcc,$(version)),$(findstring GCC,$(version)))) ifneq (,$(or $(findstring gcc,$(version)),$(findstring GCC,$(version))))