[x264-devel] Improve makefile rules

Anton Mitrofanov git at videolan.org
Tue Dec 6 01:00:44 CET 2011


x264 | branch: master | Anton Mitrofanov <BugMaster at narod.ru> | Sat Nov 12 01:31:49 2011 +0400| [d8d8e756b1fee72b4771761d6aa4cfb31edc0b67] | committer: Jason Garrett-Glaser

Improve makefile rules
Remove the need for "make clean" after most reconfigures.

> http://git.videolan.org/gitweb.cgi/x264.git/?a=commit;h=d8d8e756b1fee72b4771761d6aa4cfb31edc0b67
---

 Makefile |   22 ++++++++++++++++------
 1 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/Makefile b/Makefile
index 560ba90..c9505d3 100644
--- a/Makefile
+++ b/Makefile
@@ -22,6 +22,8 @@ SRCCLI = x264.c input/input.c input/timecode.c input/raw.c input/y4m.c \
 
 SRCSO =
 
+OBJCHK = tools/checkasm.o
+
 CONFIG := $(shell cat config.h)
 
 # GPL-only files
@@ -88,7 +90,7 @@ ASFLAGS += -Icommon/x86/
 SRCS   += common/x86/mc-c.c common/x86/predict-c.c
 OBJASM  = $(ASMSRC:%.asm=%.o)
 $(OBJASM): common/x86/x86inc.asm common/x86/x86util.asm
-checkasm: tools/checkasm-a.o
+OBJCHK += tools/checkasm-a.o
 endif
 endif
 
@@ -135,7 +137,7 @@ OBJCLI = $(SRCCLI:%.c=%.o)
 OBJSO = $(SRCSO:%.c=%.o)
 DEP  = depend
 
-.PHONY: all default fprofiled clean distclean install uninstall dox test testclean lib-static lib-shared cli install-lib-dev install-lib-static install-lib-shared install-cli
+.PHONY: all default fprofiled clean distclean install uninstall lib-static lib-shared cli install-lib-dev install-lib-static install-lib-shared install-cli
 
 default: $(DEP)
 
@@ -144,17 +146,26 @@ lib-static: $(LIBX264)
 lib-shared: $(SONAME)
 
 $(LIBX264): .depend $(OBJS) $(OBJASM)
+	rm -f $(LIBX264)
 	$(AR)$@ $(OBJS) $(OBJASM)
 	$(if $(RANLIB), $(RANLIB) $@)
 
 $(SONAME): .depend $(OBJS) $(OBJASM) $(OBJSO)
 	$(LD)$@ $(OBJS) $(OBJASM) $(OBJSO) $(SOFLAGS) $(LDFLAGS)
 
+ifneq ($(EXE),)
+.PHONY: x264 checkasm
+x264: x264$(EXE)
+checkasm: checkasm$(EXE)
+endif
+
 x264$(EXE): .depend $(OBJCLI) $(CLI_LIBX264)
 	$(LD)$@ $(OBJCLI) $(CLI_LIBX264) $(LDFLAGSCLI) $(LDFLAGS)
 
-checkasm: tools/checkasm.o $(LIBX264)
-	$(LD)$@ $+ $(LDFLAGS)
+checkasm$(EXE): .depend $(OBJCHK) $(LIBX264)
+	$(LD)$@ $(OBJCHK) $(LIBX264) $(LDFLAGS)
+
+$(OBJS) $(OBJASM) $(OBJSO) $(OBJCLI) $(OBJCHK): .depend
 
 %.o: %.asm
 	$(AS) $(ASFLAGS) -o $@ $<
@@ -204,12 +215,11 @@ endif
 
 clean:
 	rm -f $(OBJS) $(OBJASM) $(OBJCLI) $(OBJSO) $(SONAME) *.a *.lib *.exp *.pdb x264 x264.exe .depend TAGS
-	rm -f checkasm checkasm.exe tools/checkasm.o tools/checkasm-a.o
+	rm -f checkasm checkasm.exe $(OBJCHK)
 	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
-	rm -rf test/
 
 install-cli: cli
 	install -d $(DESTDIR)$(bindir)



More information about the x264-devel mailing list