From 24bf90abde21e77c574f2bd43e38a3222c3183ef Mon Sep 17 00:00:00 2001 From: Anton Mitrofanov Date: Sat, 12 Nov 2011 01:31:49 +0400 Subject: [PATCH] Improve makefile rules Remove the need for "make clean" after most reconfigures. --- Makefile | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 560ba901..c9505d3e 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) -- 2.40.0