Annotation of CSS/CSS2.1-test-suite/Makefile, revision 1.26

1.15      fantasai    1: OFFICIAL =
1.22      fantasai    2: # Call `make OFFICIAL=true` or `make official` to build for w3.org's official copy
                      3: DEVEL =
                      4: # Call `make DEVEL=true` or `make devel` to build including unreviewed tests in the SVN repository
1.19      fantasai    5: 
                      6: # Please keep any changes in sync with other CSS test suite Makefiles as appropriate, thanks.
1.15      fantasai    7: 
1.22      fantasai    8: all: pull build clobber
                      9: 
                     10: update: pull build clean
1.15      fantasai   11: 
1.19      fantasai   12: build: stage process generate
                     13: 
1.22      fantasai   14: clobber: clean
1.26    ! fantasai   15:        rm -rf devel
1.22      fantasai   16: 
                     17: pull:
                     18: ifdef DEVEL
                     19:        #
1.26    ! fantasai   20:        # grab devel (unreviewed) tests from svn
1.22      fantasai   21:        #
1.26    ! fantasai   22:        svn co http://test.csswg.org/svn/submitted/css2.1/ devel
1.22      fantasai   23: endif
                     24: 
1.15      fantasai   25: stage:
1.4       ihickson   26:        #
1.3       ihickson   27:        # empty staging area
1.4       ihickson   28:        #
1.3       ihickson   29:        rm -rf tests/
                     30:        mkdir tests
1.21      fantasai   31:        mkdir tests/support
1.4       ihickson   32:        #
1.3       ihickson   33:        # take raw and cooked tests and place them in staging area, along with support files
1.4       ihickson   34:        #
1.1       ihickson   35:        find raw-tests -name FILENAMES | xargs -n 1 perl make-proper-tests.pl
1.22      fantasai   36: ifdef DEVEL
1.26    ! fantasai   37:        find devel -name '*.xht' | xargs -n 1 --replace cp -Lv {} tests
        !            38:        find devel/* -type d -not -name .svn -not -name support  | xargs -n 1 perl -e 'if (-d "$$ARGV[0]/support") { print `cp -Lrvu "$$ARGV[0]/support" tests` }'
1.22      fantasai   39: endif
1.2       ihickson   40:        find cooked-tests -name '*.xht' | xargs -n 1 --replace cp -Lv {} tests
1.6       ihickson   41:        find cooked-tests/* -maxdepth 0 -type d -not -name CVS | xargs -n 1 perl -e 'if (-d "$$ARGV[0]/support") { print `cp -Lrvu "$$ARGV[0]/support" tests` }'
1.21      fantasai   42:        cp -Lv src/*.xht tests
                     43:        cp -Lrvu src/support tests
1.4       ihickson   44:        #
1.5       ihickson   45:        # nuke unused support files and CVS directories
1.4       ihickson   46:        #
1.1       ihickson   47:        rm -rf tests/support/.unused
1.2       ihickson   48:        find tests -type d -name CVS | xargs rm -rf
1.15      fantasai   49: 
                     50: process:
1.4       ihickson   51:        #
1.14      fantasai   52:        # preprocess tests as necessary
                     53:        #
                     54:        egrep -l '&\w+;' tests/*.xht | xargs perl -pi -e 'use HTML::Entities::Numbered;' -e '$$_ = name2decimal_xml($$_)'
1.17      fantasai   55:        #
                     56:        # now catalog them
                     57:        #
                     58:        perl catalog.pl tests/*.xht
1.15      fantasai   59: 
                     60: generate:
1.14      fantasai   61:        #
1.3       ihickson   62:        # empty distribution area
1.4       ihickson   63:        #
1.1       ihickson   64:        rm -rf dist/
                     65:        mkdir dist
1.8       fantasai   66:        mkdir dist/html4
                     67:        mkdir dist/xhtml1
                     68:        mkdir dist/xhtml1print
1.4       ihickson   69:        #
1.17      fantasai   70:        # documentation and htaccess
1.9       fantasai   71:        #
                     72:        cp data/indices.css dist/indices.css
1.12      fantasai   73:        cp data/htaccess dist/.htaccess
1.20      fantasai   74:        cp data/testinfo.data dist/testinfo.data
1.23      fantasai   75:        cp data/LICENSE-BSD dist/LICENSE-BSD
1.15      fantasai   76: ifdef OFFICIAL
1.23      fantasai   77:        cp data/LICENSE-W3CD dist/LICENSE-W3CTS
1.18      fantasai   78:        tpage --relative --define path=data/ --define official=true data/index.xht > dist/index.xht
                     79:        tpage --relative --define path=data/ --define official=true data/index.html > dist/index.html
1.24      bbos       80: else
                     81: ifdef DEVEL
1.22      fantasai   82:        tpage --relative --define path=data/ --define devel=true data/index.xht > dist/index.xht
                     83:        tpage --relative --define path=data/ --define devel=true data/index.html > dist/index.html
1.15      fantasai   84: else
1.18      fantasai   85:        tpage --relative --define path=data/ data/index.xht > dist/index.xht
                     86:        tpage --relative --define path=data/ data/index.html > dist/index.html
1.15      fantasai   87: endif
1.25      bbos       88: endif
1.9       fantasai   89:        #
1.3       ihickson   90:        # generate the tests in all supported formats, along with support files
1.4       ihickson   91:        #
1.1       ihickson   92:        perl generate.pl tests/*.xht
1.9       fantasai   93:        perl -pi -e 's/\.xht/\.htm/g' dist/html4/by-section.htm
1.8       fantasai   94:        cp -Lrv tests/support dist/html4/support
                     95:        cp -Lrv tests/support dist/xhtml1/support
                     96:        cp -Lrv tests/support dist/xhtml1print/support
1.11      fantasai   97:         # PNG->JPEG conversion requires ImageMagick's 'convert' tool
1.13      bbos       98:        find dist/xhtml1print/support -iname '*.png' | xargs -iFILENAME convert FILENAME -background white -flatten -quality 90 -interlace none FILENAME.jpg
1.8       fantasai   99:        find dist/xhtml1print/support -iname '*.png.jpg' | xargs rename s/png.jpg/jpg/
                    100:        find dist/xhtml1print/support -iname '*.png' | xargs rm -rf
                    101:        find dist/xhtml1print -iname '*.xht' -o -iname '*.css' | xargs perl -pi -e 's/\.png/\.jpg/g'
1.4       ihickson  102:        #
1.15      fantasai  103:        # report number of tests now included (XHTML1.1 variants only)
                    104:        #
                    105:        ls dist/xhtml1/*.xht | wc -l
                    106: ifdef OFFICIAL
                    107:        @echo "Built as official copy"
                    108: endif
1.22      fantasai  109: ifdef DEVEL
                    110:        @echo "Built including unreviewed tests"
                    111: endif
1.15      fantasai  112: 
                    113: clean:
                    114:        #
1.20      fantasai  115:        # empty staging area and remove generated data files
1.4       ihickson  116:        #
1.3       ihickson  117:        rm -rf tests/
1.20      fantasai  118:        rm data/contributors.data
                    119:        rm data/testinfo.data
1.15      fantasai  120: 
                    121: official:
                    122:        # For lazy typists
                    123:        make OFFICIAL=true
1.22      fantasai  124: devel:
                    125:        # For lazy typists
                    126:        make DEVEL=true

Webmaster