[dvblast-devel] [PATCH] Makefile: Show what is being done not the full commands.

Georgi Chorbadzhiyski gf at unixsol.org
Fri Sep 9 11:28:42 CEST 2011


With this patch the DVBlast compilation output is not
cluttered with the full command lines and makes it easier to
spot warnings and errors. If you want to see what commands are
executed run make V=1 or export V=1 and then make.

The new "clean" output will look like this:

make all
  CC      dvblast.c
  CC      util.c
  CC      dvb.c
  CC      udp.c
  CC      asi.c
  CC      demux.c
  CC      output.c
  CC      en50221.c
  CC      comm.c
  CC      mrtg-cnt.c
  LINK    dvblast
  CC      dvblastctl.c
  LINK    dvblastctl

make install
  INSTALL dvblast.1 -> /usr/local/share/man/man1
  INSTALL dvblast dvblastctl dvblast_mmi.sh -> /usr/local/bin

make uninstall
  RM      /usr/local/bin/dvblast
  RM      /usr/local/bin/dvblastctl
  RM      /usr/local/bin/dvblast_mmi.sh
  RM      /usr/local/share/man/man1/dvblast.1

make clean
  CLEAN   dvblast dvblastctl dvblast.o util.o dvb.o udp.o asi.o demux.o output.o en50221.o comm.o mrtg-cnt.o util.o dvblastctl.o

make archive
  ARCHIVE dvblast-2.0.0.tar.bz2
  -rw-r--r-- 1 gf users 108030 Sep  9 12:12 dvblast-2.0.0.tar.bz2

Signed-off-by: Georgi Chorbadzhiyski <gf at unixsol.org>
---
 Makefile |   51 +++++++++++++++++++++++++++++++++++++++------------
 1 files changed, 39 insertions(+), 12 deletions(-)

diff --git a/Makefile b/Makefile
index faad3dc..258712a 100644
--- a/Makefile
+++ b/Makefile
@@ -18,32 +18,59 @@ LDLIBS_DVBLAST += -lpthread
 OBJ_DVBLAST = dvblast.o util.o dvb.o udp.o asi.o demux.o output.o en50221.o comm.o mrtg-cnt.o
 OBJ_DVBLASTCTL = util.o dvblastctl.o
 
+ifndef V
+Q = @
+endif
+
+CLEAN_OBJS = dvblast dvblastctl $(OBJ_DVBLAST) $(OBJ_DVBLASTCTL)
+INSTALL_BIN = dvblast dvblastctl dvblast_mmi.sh
+INSTALL_MAN = dvblast.1
+
 PREFIX ?= /usr/local
-BIN = $(DESTDIR)/$(PREFIX)/bin
-MAN = $(DESTDIR)/$(PREFIX)/share/man/man1
+BIN = $(subst //,/,$(DESTDIR)/$(PREFIX)/bin)
+MAN = $(subst //,/,$(DESTDIR)/$(PREFIX)/share/man/man1)
 
 all: dvblast dvblastctl
 
-$(OBJ_DVBLAST) $(OBJ_DVBLASTCTL): Makefile dvblast.h en50221.h comm.h version.h asi.h
+.PHONY: clean install uninstall dist
+
+%.o: %.c Makefile dvblast.h en50221.h comm.h version.h asi.h mrtg-cnt.h
+	@echo "CC      $<"
+	$(Q)$(CC) $(CFLAGS) -c $<
 
 dvblast: $(OBJ_DVBLAST)
-	$(CC) -o $@ $(OBJ_DVBLAST) $(LDLIBS_DVBLAST) $(LDLIBS)
+	@echo "LINK    $@"
+	$(Q)$(CC) -o $@ $(OBJ_DVBLAST) $(LDLIBS_DVBLAST) $(LDLIBS)
 
 dvblastctl: $(OBJ_DVBLASTCTL)
+	@echo "LINK    $@"
+	$(Q)$(CC) -o $@ $(OBJ_DVBLAST) $(LDLIBS_DVBLAST) $(LDLIBS)
 
 clean:
-	@rm -f dvblast dvblastctl $(OBJ_DVBLAST) $(OBJ_DVBLASTCTL)
+	@echo "CLEAN   $(CLEAN_OBJS)"
+	$(Q)rm -f $(CLEAN_OBJS)
 
 install: all
-	@install -d $(BIN)
-	@install -d $(MAN)
-	@install dvblast dvblastctl dvblast_mmi.sh $(BIN)
-	@install -m 644 dvblast.1 $(MAN)
+	@install -d "$(BIN)"
+	@install -d "$(MAN)"
+	@echo "INSTALL $(INSTALL_MAN) -> $(MAN)"
+	$(Q)install -m 644 dvblast.1 "$(MAN)"
+	@echo "INSTALL $(INSTALL_BIN) -> $(BIN)"
+	$(Q)install dvblast dvblastctl dvblast_mmi.sh "$(BIN)"
 
 uninstall:
-	@rm $(BIN)/dvblast $(BIN)/dvblastctl $(BIN)/dvblast_mmi.sh $(MAN)/dvblast.1
+	@-for FILE in $(INSTALL_BIN); do \
+		echo "RM       $(BIN)/$$FILE"; \
+		rm "$(BIN)/$$FILE"; \
+	done
+	@-for FILE in $(INSTALL_MAN); do \
+		echo "RM       $(MAN)/$$FILE"; \
+		rm "$(MAN)/$$FILE"; \
+	done
 
-dist:
-	( cd ../ && \
+dist: clean
+	@echo "ARCHIVE dvblast-$(VERSION).tar.bz2"
+	$(Q)( cd ../ && \
 	  tar -cj --exclude-vcs --exclude $(TOPDIR)/*.tar.bz2 $(TOPDIR)/ > $(TOPDIR)/dvblast-$(VERSION).tar.bz2 )
+	$(Q)ls -l dvblast-$(VERSION).tar.bz2
 
-- 
1.7.5.1



More information about the dvblast-devel mailing list