ifeq ("$(origin CC)", "default")
CC := cc
endif
+.ONESHELL:
+.SHELLFLAGS := -ec
LOGLEVELS := LL_DEBUG,LL_INFO,LL_NOTICE,LL_WARNING,LL_ERROR,LL_CRIT,LL_EMERG
vardir := /var/paraslash
$(object_dir) $(man_dir) $(dep_dir) $(m4depdir) $(lls_suite_dir) \
$(yy_build_dir):
- $(Q) $(MKDIR_P) $@
+ @$(MKDIR_P) $@
CPPFLAGS += -DBINDIR='"$(bindir)"'
CPPFLAGS += -DCOPYRIGHT_YEAR='"$(COPYRIGHT_YEAR)"'
# To put more focus on warnings, be less verbose as default
# Use 'make V=1' to see the full commands
ifeq ("$(origin V)", "command line")
- Q :=
+ SAY =
else
- Q := @
+ SAY = @echo '$(strip $(1))'
endif
audiod_commands := $(addprefix $(lls_suite_dir)/, \
$(man_dir)/para_%.1: $(lls_suite_dir)/%.lsg.man \
$(lls_m4_dir)/copyright.m4 | $(man_dir)
- @[ -z "$(Q)" ] || echo 'LLSMAN $<'
- $(Q) cat $< $(all_commands) > $@
- $(Q) $(M4) -D COPYRIGHT_YEAR=$(COPYRIGHT_YEAR) $(lls_m4_dir)/copyright.m4 >> $@
+ $(call SAY, LLSMAN $<)
+ cat $< $(all_commands) > $@
+ $(M4) -D COPYRIGHT_YEAR=$(COPYRIGHT_YEAR) $(lls_m4_dir)/copyright.m4 >> $@
$(object_dir)/%.o: %.c | $(object_dir)
$(object_dir)/compress_filter.o: CFLAGS += -O3
$(object_dir)/%.o: %.c | $(object_dir) $(dep_dir) $(lsg_h) $(yy_h)
- @[ -z "$(Q)" ] || echo 'CC $<'
- $(Q) $(CC) -c -o $@ -MMD -MF $(dep_dir)/$(*F).d -MT $@ $(CPPFLAGS) \
+ $(call SAY, CC $<)
+ $(CC) -c -o $@ -MMD -MF $(dep_dir)/$(*F).d -MT $@ $(CPPFLAGS) \
$(STRICT_CFLAGS) $(CFLAGS) $<
para_recv para_afh para_play para_server: LDFLAGS += $(id3tag_ldflags)
$(foreach exe,$(executables),$(eval para_$(exe): $$($(exe)_objs)))
$(prefixed_executables):
- @[ -z "$(Q)" ] || echo 'LD $@'
- $(Q) $(CC) $^ -o $@ $(LDFLAGS)
+ $(call SAY, LD $@)
+ $(CC) $^ -o $@ $(LDFLAGS)
mostlyclean:
- @[ -z "$(Q)" ] || echo 'MOSTLYCLEAN'
- $(Q) rm -f para_*
- $(Q) rm -rf $(object_dir)
+ $(call SAY, MOSTLYCLEAN)
+ rm -f para_*
+ rm -rf $(object_dir)
clean: mostlyclean
- @[ -z "$(Q)" ] || echo 'CLEAN'
- $(Q) rm -rf $(build_dir)
+ $(call SAY, CLEAN)
+ rm -rf $(build_dir)
distclean: clean
- @[ -z "$(Q)" ] || echo 'DISTCLEAN'
- $(Q) rm -f Makefile autoscan.log config.status config.log
- $(Q) rm -f config.h configure config.h.in
+ $(call SAY, DISTCLEAN)
+ rm -f Makefile autoscan.log config.status config.log
+ rm -f config.h configure config.h.in
maintainer-clean: distclean
- @[ -z "$(Q)" ] || echo 'MAINTAINER-CLEAN'
- $(Q) rm -f *.tar.bz2 *.tar.xz
- $(Q) rm -f GPATH GRTAGS GSYMS GTAGS
+ $(call SAY, MAINTAINER-CLEAN)
+ rm -f *.tar.bz2 *.tar.xz
+ rm -f GPATH GRTAGS GSYMS GTAGS
INSTALL ?= install
INSTALL_PROGRAM ?= $(INSTALL)
$(MKDIR_P) $(DESTDIR)$(vardir) >/dev/null 2>&1 || true # not fatal, so don't complain
$(tarball) dist tarball:
- $(Q) rm -rf $(tarball) $(tarball_pfx)
- $(Q) git archive --format=tar --prefix=$(tarball_pfx)/ HEAD \
- | tar --delete $(tarball_delete) > $(tarball_pfx).tar
- $(Q) $(MKDIR_P) $(tarball_pfx)
- $(Q) ./GIT-VERSION-GEN > $(tarball_pfx)/VERSION
- $(Q) cp $(autocrap) $(tarball_pfx)
- $(Q) tar rf $(tarball_pfx).tar $(tarball_pfx)/*
- $(Q) xz -9 $(tarball_pfx).tar
- $(Q) ls -l $(tarball)
- $(Q) ln -sf $(tarball) paraslash-git.tar.xz
- $(Q) rm -rf $(tarball_pfx)
+ $(call SAY, DIST)
+ rm -rf $(tarball) $(tarball_pfx)
+ git archive --format=tar --prefix=$(tarball_pfx)/ HEAD \
+ | tar --delete $(tarball_delete) > $(tarball_pfx).tar
+ $(MKDIR_P) $(tarball_pfx)
+ ./GIT-VERSION-GEN > $(tarball_pfx)/VERSION
+ cp $(autocrap) $(tarball_pfx)
+ tar rf $(tarball_pfx).tar $(tarball_pfx)/*
+ xz -9 $(tarball_pfx).tar
+ ls -l $(tarball)
+ ln -sf $(tarball) paraslash-git.tar.xz
+ rm -rf $(tarball_pfx)
lls_m4_include_dir := $(lls_m4_dir)/include
$(lls_suite_dir)/%.m4d: $(lls_m4_dir)/%.suite.m4 | $(lls_suite_dir)
- @[ -z "$(Q)" ] || echo 'M4D $<'
- $(Q) $(M4) -Pg -I $(lls_m4_include_dir) -s $< \
+ $(call SAY, M4D $<)
+ $(M4) -Pg -I $(lls_m4_include_dir) -s $< \
| awk '{if ($$1 ~ /#line/) {gsub(/"/, "", $$3); if ($$3 != "$<") \
print "$(lls_suite_dir)/$(*F).suite: " $$3}}' | sort | uniq > $@
$(lls_suite_dir)/%.suite: $(lls_m4_dir)/%.suite.m4 | $(lls_suite_dir)
- @[ -z "$(Q)" ] || echo 'M4 $<'
- $(Q) $(M4) -Pg -I $(lls_m4_include_dir) -D GIT_VERSION=$(GIT_VERSION) \
+ $(call SAY, M4 $<)
+ $(M4) -Pg -I $(lls_m4_include_dir) -D GIT_VERSION=$(GIT_VERSION) \
-D COPYRIGHT_YEAR=$(COPYRIGHT_YEAR) -D LOGLEVELS=$(LOGLEVELS) \
$< > $@
$(lls_suite_dir)/%.lsg.c: $(lls_suite_dir)/%.suite
- @[ -z "$(Q)" ] || echo 'LSGC $<'
- $(Q) $(LOPSUBGEN) --gen-c --output-dir $(lls_suite_dir) < $<
+ $(call SAY, LSGC $<)
+ $(LOPSUBGEN) --gen-c --output-dir $(lls_suite_dir) < $<
$(lls_suite_dir)/%.lsg.h: $(lls_suite_dir)/%.suite
- @[ -z "$(Q)" ] || echo 'LSGH $<'
- $(Q) $(LOPSUBGEN) --gen-header --output-dir $(lls_suite_dir) < $<
+ $(call SAY, LSGH $<)
+ $(LOPSUBGEN) --gen-header --output-dir $(lls_suite_dir) < $<
$(lls_suite_dir)/%.lsg.man: $(lls_suite_dir)/%.suite
- @[ -z "$(Q)" ] || echo 'LSGM $<'
- $(Q) $(LOPSUBGEN) --gen-man --output-dir $(lls_suite_dir) < $<
+ $(call SAY, LSGM $<)
+ $(LOPSUBGEN) --gen-man --output-dir $(lls_suite_dir) < $<
$(object_dir)/%.o: $(lls_suite_dir)/%.c | $(object_dir)
- @[ -z "$(Q)" ] || echo 'CC $<'
- $(Q) $(CC) -c -o $@ $(CPPFLAGS) $(STRICT_CFLAGS) $<
+ $(call SAY, CC $<)
+ $(CC) -c -o $@ $(CPPFLAGS) $(STRICT_CFLAGS) $<