]> git.sesse.net Git - ffmpeg/commitdiff
Simplify trig table rules
authorMans Rullgard <mans@mansr.com>
Thu, 19 May 2011 17:34:40 +0000 (18:34 +0100)
committerMans Rullgard <mans@mansr.com>
Thu, 19 May 2011 18:45:06 +0000 (19:45 +0100)
This collapses the make rules for the trig tables into a pattern
rule.  Based on a patch by Diego, modified to avoid using fragile
make constructs and allow future addition of fixed-point sin tables.

Signed-off-by: Mans Rullgard <mans@mansr.com>
libavcodec/Makefile
libavcodec/costablegen.c

index 4765ceb4132f7f75ee3815a8b7c4bdf84d7ae394..7a9d897606e310d548b2e81239ae22b34c1fd060 100644 (file)
@@ -676,14 +676,11 @@ include $(SUBDIR)../subdir.mak
 
 $(SUBDIR)dct-test$(EXESUF): $(SUBDIR)dctref.o
 
-$(SUBDIR)cos_tables.c: $(SUBDIR)costablegen$(HOSTEXESUF)
-       $(M)./$< > $@
-
-$(SUBDIR)cos_fixed_tables.c: $(SUBDIR)costablegen$(HOSTEXESUF)
-       $(M)./$< cos fixed > $@
+TRIG_TABLES  = cos cos_fixed sin
+TRIG_TABLES := $(TRIG_TABLES:%=$(SUBDIR)%_tables.c)
 
-$(SUBDIR)sin_tables.c: $(SUBDIR)costablegen$(HOSTEXESUF)
-       $(M)./$< sin > $@
+$(TRIG_TABLES): $(SUBDIR)%_tables.c: $(SUBDIR)costablegen$(HOSTEXESUF)
+       $(M)./$< $* > $@
 
 ifdef CONFIG_SMALL
 $(SUBDIR)%_tablegen$(HOSTEXESUF): HOSTCFLAGS += -DCONFIG_SMALL=1
index 6bfb8eabf26d229fb65f5dfbbc343517fc964707..5e52c482c66671b56175a17f5d78ee3966d5da1e 100644 (file)
@@ -51,7 +51,7 @@ int main(int argc, char *argv[])
 {
     int i, j;
     int do_sin = argc > 1 && !strcmp(argv[1], "sin");
-    int fixed  = argc > 2 && !strcmp(argv[2], "fixed");
+    int fixed  = argc > 1 &&  strstr(argv[1], "fixed");
     double (*func)(double) = do_sin ? sin : cos;
 
     printf("/* This file was automatically generated. */\n");