summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authortron <tron@openttd.org>2005-03-06 12:56:02 +0000
committertron <tron@openttd.org>2005-03-06 12:56:02 +0000
commit3e142a6297778edcd32cc0820115e9530bca1327 (patch)
treed138ee95699c3542346e338d721ab6772e8ffe97 /Makefile
parentaee2b0c50a38a1bfdd4fdc3d24a38b038fbc21d3 (diff)
downloadopenttd-3e142a6297778edcd32cc0820115e9530bca1327.tar.xz
(svn r1939) Revert part of r1938 which accidently crept in
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile44
1 files changed, 32 insertions, 12 deletions
diff --git a/Makefile b/Makefile
index 892c28369..46af1ccba 100644
--- a/Makefile
+++ b/Makefile
@@ -687,14 +687,39 @@ LANGS = $(LANG_TXT:%.txt=%.lng)
#
# If we are verbose, we will show commands prefixed by $(Q) (which acts as
-# @ in the non-verbose mode)
+# @ in the non-verbose mode), and we will show the "real" cmds instead of
+# their quiet versions (which are used in the non-verbose mode).
# Inspired by the Linux kernel build system.
ifdef VERBOSE
Q =
+ quiet =
else
Q = @
+ quiet = quiet_
endif
+# Show the command (quiet or non-quiet version based on the assignment
+# just above) and then execute it.
+cmd = @$(if $($(quiet)cmd_$(1)),echo $($(quiet)cmd_$(1)) &&) $(cmd_$(1))
+
+
+# The build commands themselves. Note that if you omit the quiet version,
+# nothing will be shown in the non-verbose mode.
+
+quiet_cmd_compile_link = '===> Compiling and Linking $@'
+ cmd_compile_link = $(CC) $(BASECFLAGS) $(CDEFS) $< -o $@
+
+quiet_cmd_ttd_link = '===> Linking $@'
+ cmd_ttd_link = $(CC) $(LDFLAGS) $(TTDLDFLAGS) $(OBJS) $(LIBS) -o $@
+
+COMPILE_PARAMS=$(CFLAGS) $(CDEFS) -MD -c $< -o $@
+
+quiet_cmd_c_compile = '===> Compiling $<'
+ cmd_c_compile = $(CC) $(COMPILE_PARAMS)
+
+quiet_cmd_cxx_compile = '===> Compiling $<'
+ cmd_cxx_compile = $(CXX) $(COMPILE_PARAMS)
+
##############################################################################
#
@@ -717,13 +742,11 @@ endian.h: $(ENDIAN_CHECK)
$(Q)./$(ENDIAN_CHECK) > $@
$(ENDIAN_CHECK): endian_check.c
- @echo '===> Compiling and Linking $@'
- $(Q)$(CC) $(BASECFLAGS) $(CDEFS) $< -o $@
+ $(call cmd,compile_link)
$(TTD): table/strings.h $(OBJS) $(MAKE_CONFIG)
- @echo '===> Linking $@'
- $(Q)$(CC) $(LDFLAGS) $(TTDLDFLAGS) $(OBJS) $(LIBS) -o $@
+ $(call cmd,ttd_link)
$(OSX): $(TTD)
$(Q)rm -fr "$(OSXAPP)"
@@ -749,8 +772,7 @@ $(64_bit_warnings):
$(warning If you see any bugs, include in your bug report that you use a 64 bit CPU)
$(STRGEN): strgen/strgen.c endian.h
- @echo '===> Compiling and Linking $@'
- $(Q)$(CC) $(BASECFLAGS) $(CDEFS) $< -o $@
+ $(call cmd,compile_link)
table/strings.h: lang/english.txt $(STRGEN)
@echo '===> Generating $@'
@@ -935,13 +957,11 @@ DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :)
# therefore we do not need to watch deps.
%.o: %.c $(MAKE_CONFIG) endian.h table/strings.h
- @echo '===> Compiling $<'
- $(Q)$(CC) $(CFLAGS) $(CDEFS) -MD -c $< -o $@
+ $(call cmd,c_compile)
@mv $(<:%.c=%.d) $(<:%.c=.deps/%.d)
%.o: %.cpp $(MAKE_CONFIG) endian.h table/strings.h
- @echo '===> Compiling $<'
- $(Q)$(CXX) $(CFLAGS) $(CDEFS) -MD -c $< -o $@
+ $(call cmd,cxx_compile)
@mv $(<:%.c=%.d) $(<:%.c=.deps/%.d)
# Silence stale header dependencies
@@ -950,6 +970,6 @@ DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :)
info:
- @echo 'CFLAGS = $(CFLAGS) $(CDEFS)'
+ @echo 'CFLAGS = $(CFLAGS)'
@echo 'LDFLAGS = $(LDFLAGS)'
@echo 'LIBS = $(LIBS)'