Commit 272874c9 authored by Mans Rullgard's avatar Mans Rullgard

Simplify trig table rules

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: 's avatarMans Rullgard <mans@mansr.com>
parent c98657a2
...@@ -676,14 +676,11 @@ include $(SUBDIR)../subdir.mak ...@@ -676,14 +676,11 @@ include $(SUBDIR)../subdir.mak
$(SUBDIR)dct-test$(EXESUF): $(SUBDIR)dctref.o $(SUBDIR)dct-test$(EXESUF): $(SUBDIR)dctref.o
$(SUBDIR)cos_tables.c: $(SUBDIR)costablegen$(HOSTEXESUF) TRIG_TABLES = cos cos_fixed sin
$(M)./$< > $@ TRIG_TABLES := $(TRIG_TABLES:%=$(SUBDIR)%_tables.c)
$(SUBDIR)cos_fixed_tables.c: $(SUBDIR)costablegen$(HOSTEXESUF)
$(M)./$< cos fixed > $@
$(SUBDIR)sin_tables.c: $(SUBDIR)costablegen$(HOSTEXESUF) $(TRIG_TABLES): $(SUBDIR)%_tables.c: $(SUBDIR)costablegen$(HOSTEXESUF)
$(M)./$< sin > $@ $(M)./$< $* > $@
ifdef CONFIG_SMALL ifdef CONFIG_SMALL
$(SUBDIR)%_tablegen$(HOSTEXESUF): HOSTCFLAGS += -DCONFIG_SMALL=1 $(SUBDIR)%_tablegen$(HOSTEXESUF): HOSTCFLAGS += -DCONFIG_SMALL=1
......
...@@ -51,7 +51,7 @@ int main(int argc, char *argv[]) ...@@ -51,7 +51,7 @@ int main(int argc, char *argv[])
{ {
int i, j; int i, j;
int do_sin = argc > 1 && !strcmp(argv[1], "sin"); 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; double (*func)(double) = do_sin ? sin : cos;
printf("/* This file was automatically generated. */\n"); printf("/* This file was automatically generated. */\n");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment