From cee668bb27e8b8322b9ccdaabab3e58cfe5c413d Mon Sep 17 00:00:00 2001 From: ben Date: Tue, 4 Dec 2007 18:10:20 +0000 Subject: add new configure option to disable VIDIX PCI device name database (saves a 300 kB on mplayer binary) git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@25299 b3059339-0415-0410-9bf9-f77b7e298cf2 --- vidix/Makefile | 2 +- vidix/pci_db2c.awk | 13 ++++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) (limited to 'vidix') diff --git a/vidix/Makefile b/vidix/Makefile index 0924abf2c4..cd9ab4b2c8 100644 --- a/vidix/Makefile +++ b/vidix/Makefile @@ -47,7 +47,7 @@ rage128_vid.o: radeon_vid.c $(CC) -c $(CFLAGS) -DRAGE128 -o $@ $< pci_names.c pci_dev_ids.c: pci.db - LC_ALL=C awk -f pci_db2c.awk $< + LC_ALL=C awk -f pci_db2c.awk $< $(VIDIX_PCIDB) clean:: rm -f pci_*.c pci_*.h diff --git a/vidix/pci_db2c.awk b/vidix/pci_db2c.awk index 12502d06f9..8bbc19dde0 100644 --- a/vidix/pci_db2c.awk +++ b/vidix/pci_db2c.awk @@ -26,12 +26,13 @@ BEGIN { - if(ARGC != 2) { + if(ARGC != 3) { # check for arguments: print "Usage awk -f pci_db2c.awk pci.db (and make sure pci.db file exists first)"; exit(1); } in_file = ARGV[1]; + with_pci_db = ARGV[2]; vendor_file = "pci_vendors.h"; ids_file = "pci_ids.h" name_file = "pci_names.c" @@ -60,9 +61,11 @@ BEGIN { print_name_struct(name_h_file); print "#include ">name_file print "#include \"pci_names.h\"">name_file + if (with_pci_db) { print "#include \"pci_dev_ids.c\"">name_file print "">name_file print "static struct vendor_id_s vendor_ids[] = {">name_file + } first_pass=1; init_name_db(); while(getline vendor_file; if(length(svend_name) < 9) printf("\t") >vendor_file; printf("0x%s /*%s*/\n",field[2], name_field) >vendor_file; - printf("{ 0x%s, \"%s\", dev_lst_%s },\n",field[2], name_field, field[2]) >name_file; + if (with_pci_db) printf("{ 0x%s, \"%s\", dev_lst_%s },\n",field[2], name_field, field[2]) >name_file; printf("/* Vendor: %s: %s */\n", field[2], name_field) > ids_file if(first_pass == 1) { first_pass=0; } else { print "{ 0xFFFF, NULL }\n};" >dev_ids_file; } @@ -118,7 +121,7 @@ BEGIN { print "#endif/*PCI_IDS_INCLUDED*/">ids_file print "">name_h_file print "#endif/*PCI_NAMES_INCLUDED*/">name_h_file - print "};">name_file + if (with_pci_db) print "};">name_file print "{ 0xFFFF, NULL }" >dev_ids_file; print "};">dev_ids_file print_func_bodies(name_file); @@ -172,16 +175,19 @@ function print_func_bodies(out_file) print "">out_file print "const char *pci_vendor_name(unsigned short id)" >out_file print "{" >out_file + if (with_pci_db) { print " unsigned i;" >out_file print " for(i=0;iout_file print " {" >out_file print "\tif(vendor_ids[i].id == id) return vendor_ids[i].name;" >out_file print " }" >out_file + } print " return NULL;" >out_file print "}">out_file print "" >out_file print "const char *pci_device_name(unsigned short vendor_id, unsigned short device_id)" >out_file print "{" >out_file + if (with_pci_db) { print " unsigned i, j;" >out_file print " for(i=0;iout_file print " {" >out_file @@ -196,6 +202,7 @@ function print_func_bodies(out_file) print "\t break;" >out_file print "\t}" >out_file print " }" >out_file + } print " return NULL;">out_file print "}">out_file return -- cgit v1.2.3