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

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
        !            15:        rm -rf incoming
        !            16: 
        !            17: pull:
        !            18: ifdef DEVEL
        !            19:        #
        !            20:        # grab incoming (unreviewed) tests from svn
        !            21:        #
        !            22:        svn co http://test.csswg.org/svn/CSS2.1-test-suite/incoming/ incoming
        !            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
        !            37:        find incoming -name '*.xht' | xargs -n 1 --replace cp -Lv {} tests
        !            38:        find incoming/* -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` }'
        !            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.15      fantasai   75: ifdef OFFICIAL
                     76:        cp data/LICENSE-W3CD dist/LICENSE-W3CD
1.18      fantasai   77:        tpage --relative --define path=data/ --define official=true data/index.xht > dist/index.xht
                     78:        tpage --relative --define path=data/ --define official=true data/index.html > dist/index.html
1.22    ! fantasai   79: else ifdef DEVEL
        !            80:        tpage --relative --define path=data/ --define devel=true data/index.xht > dist/index.xht
        !            81:        tpage --relative --define path=data/ --define devel=true data/index.html > dist/index.html
1.15      fantasai   82: else
1.18      fantasai   83:        tpage --relative --define path=data/ data/index.xht > dist/index.xht
                     84:        tpage --relative --define path=data/ data/index.html > dist/index.html
1.15      fantasai   85: endif
1.22    ! fantasai   86:        cp data/LICENSE-BSD dist/LICENSE-BSD
1.9       fantasai   87:        #
1.3       ihickson   88:        # generate the tests in all supported formats, along with support files
1.4       ihickson   89:        #
1.1       ihickson   90:        perl generate.pl tests/*.xht
1.9       fantasai   91:        perl -pi -e 's/\.xht/\.htm/g' dist/html4/by-section.htm
1.8       fantasai   92:        cp -Lrv tests/support dist/html4/support
                     93:        cp -Lrv tests/support dist/xhtml1/support
                     94:        cp -Lrv tests/support dist/xhtml1print/support
1.11      fantasai   95:         # PNG->JPEG conversion requires ImageMagick's 'convert' tool
1.13      bbos       96:        find dist/xhtml1print/support -iname '*.png' | xargs -iFILENAME convert FILENAME -background white -flatten -quality 90 -interlace none FILENAME.jpg
1.8       fantasai   97:        find dist/xhtml1print/support -iname '*.png.jpg' | xargs rename s/png.jpg/jpg/
                     98:        find dist/xhtml1print/support -iname '*.png' | xargs rm -rf
                     99:        find dist/xhtml1print -iname '*.xht' -o -iname '*.css' | xargs perl -pi -e 's/\.png/\.jpg/g'
1.4       ihickson  100:        #
1.15      fantasai  101:        # report number of tests now included (XHTML1.1 variants only)
                    102:        #
                    103:        ls dist/xhtml1/*.xht | wc -l
                    104: ifdef OFFICIAL
                    105:        @echo "Built as official copy"
                    106: endif
1.22    ! fantasai  107: ifdef DEVEL
        !           108:        @echo "Built including unreviewed tests"
        !           109: endif
1.15      fantasai  110: 
                    111: clean:
                    112:        #
1.20      fantasai  113:        # empty staging area and remove generated data files
1.4       ihickson  114:        #
1.3       ihickson  115:        rm -rf tests/
1.20      fantasai  116:        rm data/contributors.data
                    117:        rm data/testinfo.data
1.15      fantasai  118: 
                    119: official:
                    120:        # For lazy typists
                    121:        make OFFICIAL=true
1.22    ! fantasai  122: devel:
        !           123:        # For lazy typists
        !           124:        make DEVEL=true

Webmaster