[FFmpeg-cvslog] build: factor out the .c and .S compile commands as a macro

Mans Rullgard git at videolan.org
Mon Jun 27 03:46:17 CEST 2011


ffmpeg | branch: master | Mans Rullgard <mans at mansr.com> | Sat Jun 25 11:57:32 2011 +0100| [bc877faf7f92deef9c619d81bec85202b9f10f0e] | committer: Mans Rullgard

build: factor out the .c and .S compile commands as a macro

These commands have the same form, and using a common macro allows
it to be used elsewhere without further duplication.

Signed-off-by: Mans Rullgard <mans at mansr.com>

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

 Makefile  |   15 +++++++++++----
 configure |    2 ++
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/Makefile b/Makefile
index f1bede8..f16da3a 100644
--- a/Makefile
+++ b/Makefile
@@ -23,16 +23,23 @@ endif
 IFLAGS     := -I. -I$(SRC_PATH)
 CPPFLAGS   := $(IFLAGS) $(CPPFLAGS)
 CFLAGS     += $(ECFLAGS)
+CCFLAGS     = $(CFLAGS)
 YASMFLAGS  += $(IFLAGS) -Pconfig.asm
 HOSTCFLAGS += $(IFLAGS)
 
+define COMPILE
+	$($(1)DEP)
+	$($(1)) $(CPPFLAGS) $($(1)FLAGS) $($(1)_DEPFLAGS) -c $($(1)_O) $<
+endef
+
+COMPILE_C = $(call COMPILE,CC)
+COMPILE_S = $(call COMPILE,AS)
+
 %.o: %.c
-	$(CCDEP)
-	$(CC) $(CPPFLAGS) $(CFLAGS) $(CC_DEPFLAGS) -c $(CC_O) $<
+	$(COMPILE_C)
 
 %.o: %.S
-	$(ASDEP)
-	$(AS) $(CPPFLAGS) $(ASFLAGS) $(AS_DEPFLAGS) -c -o $@ $<
+	$(COMPILE_S)
 
 %.ho: %.h
 	$(CC) $(CPPFLAGS) $(CFLAGS) -Wno-unused -c -o $@ -x c $<
diff --git a/configure b/configure
index db3277f..d8454e0 100755
--- a/configure
+++ b/configure
@@ -1674,6 +1674,7 @@ SLIBNAME_WITH_VERSION='$(SLIBNAME).$(LIBVERSION)'
 SLIBNAME_WITH_MAJOR='$(SLIBNAME).$(LIBMAJOR)'
 LIB_INSTALL_EXTRA_CMD='$$(RANLIB) "$(LIBDIR)/$(LIBNAME)"'
 
+AS_O='-o $@'
 CC_O='-o $@'
 
 host_cflags='-D_ISOC99_SOURCE -O3 -g'
@@ -3273,6 +3274,7 @@ LN_S=$ln_s
 CPPFLAGS=$CPPFLAGS
 CFLAGS=$CFLAGS
 ASFLAGS=$ASFLAGS
+AS_O=$CC_O
 CC_O=$CC_O
 DLLTOOL=$dlltool
 LDFLAGS=$LDFLAGS



More information about the ffmpeg-cvslog mailing list