[x264-devel] [PATCH 2/2] Expand silent rules to handle install/uninstall/clean/distclean

Stephen Hutchinson qyot27 at gmail.com
Fri Apr 4 15:41:54 CEST 2014


---
 Makefile | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++++------------
 1 file changed, 56 insertions(+), 13 deletions(-)

diff --git a/Makefile b/Makefile
index 487af1c..8acebd9 100644
--- a/Makefile
+++ b/Makefile
@@ -6,11 +6,14 @@ include config.mak
 ifeq ($(V), 0)
 ECHO   = printf "$(1)\t%s\n" $(2)
 BRIEF  = CC AS YASM AR LD STRIP CP RC RANLIB
+SILENT = RM INSTALL RANLIB_VERBOSE
 
+Q      = @
 MSG    = $@
 M      = @$(call ECHO,$(TAG),$@);
 $(foreach VAR,$(BRIEF), \
     $(eval override $(VAR) = @$$(call ECHO,$(VAR),$$(MSG)); $($(VAR))))
+$(foreach VAR,$(SILENT),$(eval override $(VAR) = @$($(VAR))))
 endif
 # End of main silent make rules definition
 
@@ -176,7 +179,7 @@ lib-static: $(LIBX264)
 lib-shared: $(SONAME)
 
 $(LIBX264): $(GENERATED) .depend $(OBJS) $(OBJASM)
-	rm -f $(LIBX264)
+	$(RM) -f $(LIBX264)
 	$(AR)$@ $(OBJS) $(OBJASM)
 	$(if $(RANLIB), $(RANLIB) $@)
 
@@ -220,7 +223,7 @@ define \n
 endef
 
 .depend: config.mak
-	@rm -f .depend
+	@$(RM) -f .depend
 	@$(foreach SRC, $(addprefix $(SRCPATH)/, $(SRCS) $(SRCCLI) $(SRCSO)), $(CC_SILENT) $(CFLAGS) $(SRC) $(DEPMT) $(SRC:$(SRCPATH)/%.c=%.o) $(DEPMM) 1>> .depend;${\n})
 
 config.mak:
@@ -252,24 +255,38 @@ fprofiled:
 	$(MAKE) clean
 	$(MAKE) x264$(EXE) CFLAGS="$(CFLAGS) $(PROF_GEN_CC)" LDFLAGS="$(LDFLAGS) $(PROF_GEN_LD)"
 	$(foreach V, $(VIDS), $(foreach I, 0 1 2 3 4 5 6 7, ./x264$(EXE) $(OPT$I) --threads 1 $(V) -o $(DEVNULL) ;))
-	rm -f $(SRC2:%.c=%.o)
+	$(RM) -f $(SRC2:%.c=%.o)
 	$(MAKE) CFLAGS="$(CFLAGS) $(PROF_USE_CC)" LDFLAGS="$(LDFLAGS) $(PROF_USE_LD)"
-	rm -f $(SRC2:%.c=%.gcda) $(SRC2:%.c=%.gcno) *.dyn pgopti.dpi pgopti.dpi.lock
+	$(RM) -f $(SRC2:%.c=%.gcda) $(SRC2:%.c=%.gcno) *.dyn pgopti.dpi pgopti.dpi.lock
 endif
 
 clean:
-	rm -f $(OBJS) $(OBJASM) $(OBJCLI) $(OBJSO) $(SONAME) *.a *.lib *.exp *.pdb x264 x264.exe .depend TAGS
-	rm -f checkasm checkasm.exe $(OBJCHK) $(GENERATED) x264_lookahead.clbin
-	rm -f $(SRC2:%.c=%.gcda) $(SRC2:%.c=%.gcno) *.dyn pgopti.dpi pgopti.dpi.lock
+ifeq ($(V), 0)
+	@printf "Deleting compiled output and files used during compilation...\n";
+endif
+	$(RM) -f $(OBJS) $(OBJASM) $(OBJCLI) $(OBJSO) $(SONAME) *.a *.lib *.exp *.pdb x264 x264.exe .depend TAGS
+	$(RM) -f checkasm checkasm.exe $(OBJCHK) $(GENERATED) x264_lookahead.clbin
+	$(RM) -f $(SRC2:%.c=%.gcda) $(SRC2:%.c=%.gcno) *.dyn pgopti.dpi pgopti.dpi.lock
 
 distclean: clean
-	rm -f config.mak x264_config.h config.h config.log x264.pc x264.def
+ifeq ($(V), 0)
+	@printf "Deleting configuration files...\n";
+endif
+	$(RM) -f config.mak x264_config.h config.h config.log x264.pc x264.def
 
 install-cli: cli
+ifeq ($(V), 0)
+	@printf "INSTALL\t%s\n" x264$(EXE);
+endif
 	$(INSTALL) -d $(DESTDIR)$(bindir)
 	$(INSTALL) x264$(EXE) $(DESTDIR)$(bindir)
 
 install-lib-dev:
+ifeq ($(V), 0)
+	@printf "INSTALL\t%s\n" x264.h;
+	@printf "INSTALL\t%s\n" x264_config.h;
+	@printf "INSTALL\t%s\n" x264.pc;
+endif
 	$(INSTALL) -d $(DESTDIR)$(includedir)
 	$(INSTALL) -d $(DESTDIR)$(libdir)
 	$(INSTALL) -d $(DESTDIR)$(libdir)/pkgconfig
@@ -278,26 +295,52 @@ install-lib-dev:
 	$(INSTALL) -m 644 x264.pc $(DESTDIR)$(libdir)/pkgconfig
 
 install-lib-static: lib-static install-lib-dev
+ifeq ($(V), 0)
+	@printf "INSTALL\t%s\n" $(LIBX264);
+	@printf "RANLIB\t%s\n" $(LIBX264);
+endif
 	$(INSTALL) -m 644 $(LIBX264) $(DESTDIR)$(libdir)
 	$(if $(RANLIB), $(RANLIB_VERBOSE) $(DESTDIR)$(libdir)/$(LIBX264))
 
 install-lib-shared: lib-shared install-lib-dev
 ifneq ($(IMPLIBNAME),)
+ifeq ($(V), 0)
+	@printf "INSTALL\t%s\n" $(SONAME);
+	@printf "INSTALL\t%s\n" $(IMPLIBNAME);
+endif
 	$(INSTALL) -d $(DESTDIR)$(bindir)
 	$(INSTALL) -m 755 $(SONAME) $(DESTDIR)$(bindir)
 	$(INSTALL) -m 644 $(IMPLIBNAME) $(DESTDIR)$(libdir)
 else ifneq ($(SONAME),)
-	ln -f -s $(SONAME) $(DESTDIR)$(libdir)/libx264.$(SOSUFFIX)
+ifeq ($(V), 0)
+	@printf "INSTALL\t%s\n" $(SONAME);
+	@printf "LN\t%s %s\n" libx264.$(SOSUFFIX);
+endif
+	$(Q)ln -f -s $(SONAME) $(DESTDIR)$(libdir)/libx264.$(SOSUFFIX)
 	$(INSTALL) -m 755 $(SONAME) $(DESTDIR)$(libdir)
 endif
 
 uninstall:
-	rm -f $(DESTDIR)$(includedir)/x264.h $(DESTDIR)$(includedir)/x264_config.h $(DESTDIR)$(libdir)/libx264.a
-	rm -f $(DESTDIR)$(bindir)/x264$(EXE) $(DESTDIR)$(libdir)/pkgconfig/x264.pc
+ifeq ($(V), 0)
+	@printf "RM\t%s\n" x264.h;
+	@printf "RM\t%s\n" x264_config.h;
+	@printf "RM\t%s\n" libx264.a;
+	@printf "RM\t%s\n" x264.pc;
+endif
+	$(RM) -f $(DESTDIR)$(includedir)/x264.h $(DESTDIR)$(includedir)/x264_config.h $(DESTDIR)$(libdir)/libx264.a
+	$(RM) -f $(DESTDIR)$(bindir)/x264$(EXE) $(DESTDIR)$(libdir)/pkgconfig/x264.pc
 ifneq ($(IMPLIBNAME),)
-	rm -f $(DESTDIR)$(bindir)/$(SONAME) $(DESTDIR)$(libdir)/$(IMPLIBNAME)
+ifeq ($(V), 0)
+	@printf "RM\t%s\n" $(SONAME);
+	@printf "RM\t%s\n" $(IMPLIBNAME);
+endif
+	$(RM) -f $(DESTDIR)$(bindir)/$(SONAME) $(DESTDIR)$(libdir)/$(IMPLIBNAME)
 else ifneq ($(SONAME),)
-	rm -f $(DESTDIR)$(libdir)/$(SONAME) $(DESTDIR)$(libdir)/libx264.$(SOSUFFIX)
+ifeq ($(V), 0)
+	@printf "RM\t%s\n" $(SONAME);
+	@printf "RM\t%s\n" libx264.$(SOSUFFIX);
+endif
+	$(RM) -f $(DESTDIR)$(libdir)/$(SONAME) $(DESTDIR)$(libdir)/libx264.$(SOSUFFIX)
 endif
 
 etags: TAGS
-- 
1.8.3.2



More information about the x264-devel mailing list