Makefile
author Ville Skyttä <ville.skytta@iki.fi>
Sun, 12 Dec 2010 20:27:00 +0200
changeset 3180 13be4ea042d6
parent 3107 f7494ae35248
child 3189 aba7c242f790
permissions -rw-r--r--
Add Makefile target for precompressing *.css and *.js and httpd.conf section for serving them compressed.
3106
a634c95910f8 Get version from the check script instead of bundle.
Ville Skyttä <ville.skytta@iki.fi>
parents: 3075
diff changeset
     1
VERSION = $(shell perl -ne '/^\$$VERSION\b.*?([\d.]+)/ && print $$1' httpd/cgi-bin/check)
2974
4828e0f44dc0 Add dist target.
ville
parents: 2972
diff changeset
     2
3180
13be4ea042d6 Add Makefile target for precompressing *.css and *.js and httpd.conf section for serving them compressed.
Ville Skyttä <ville.skytta@iki.fi>
parents: 3107
diff changeset
     3
CSS_FILES = $(wildcard htdocs/*.css htdocs/style/*.css)
13be4ea042d6 Add Makefile target for precompressing *.css and *.js and httpd.conf section for serving them compressed.
Ville Skyttä <ville.skytta@iki.fi>
parents: 3107
diff changeset
     4
JS_FILES = $(wildcard htdocs/scripts/*.js)
2936
a895ac1d11c1 Add perltidy(1) settings and a simple Makefile target for running it.
ville
parents:
diff changeset
     5
PERL_FILES = httpd/cgi-bin/check httpd/cgi-bin/sendfeedback.pl \
3058
16a6e9abe911 Add crude script for converting SGML Open Catalogs to XML catalogs.
ville
parents: 3026
diff changeset
     6
	misc/soc2xml.pl misc/spmpp.pl misc/docs_errors.pl \
16a6e9abe911 Add crude script for converting SGML Open Catalogs to XML catalogs.
ville
parents: 3026
diff changeset
     7
	misc/bundle/Makefile.PL misc/bundle/lib/Bundle/W3C/Validator.pm
3180
13be4ea042d6 Add Makefile target for precompressing *.css and *.js and httpd.conf section for serving them compressed.
Ville Skyttä <ville.skytta@iki.fi>
parents: 3107
diff changeset
     8
GZIP_FILES = $(addsuffix .gz,$(CSS_FILES) $(JS_FILES))
2936
a895ac1d11c1 Add perltidy(1) settings and a simple Makefile target for running it.
ville
parents:
diff changeset
     9
2937
f55b47ae1c23 Make perltidy backup/modify-in-place.
ville
parents: 2936
diff changeset
    10
PERLTIDY = perltidy --profile=misc/perltidyrc --backup-and-modify-in-place
2945
c8c09366077e Add perlcritic(1) profile and a Makefile target for running it.
ville
parents: 2944
diff changeset
    11
PERLCRITIC = perlcritic --profile misc/perlcriticrc
2937
f55b47ae1c23 Make perltidy backup/modify-in-place.
ville
parents: 2936
diff changeset
    12
3180
13be4ea042d6 Add Makefile target for precompressing *.css and *.js and httpd.conf section for serving them compressed.
Ville Skyttä <ville.skytta@iki.fi>
parents: 3107
diff changeset
    13
GZIP = gzip -9n
13be4ea042d6 Add Makefile target for precompressing *.css and *.js and httpd.conf section for serving them compressed.
Ville Skyttä <ville.skytta@iki.fi>
parents: 3107
diff changeset
    14
2972
5997b2e905b0 Add test target for running the test suite.
ville
parents: 2945
diff changeset
    15
VALIDATOR_URI = http://localhost/w3c-validator/check
5997b2e905b0 Add test target for running the test suite.
ville
parents: 2945
diff changeset
    16
3180
13be4ea042d6 Add Makefile target for precompressing *.css and *.js and httpd.conf section for serving them compressed.
Ville Skyttä <ville.skytta@iki.fi>
parents: 3107
diff changeset
    17
all: htdocs/docs/errors.html htdocs/sgml-lib/catalog.xml $(GZIP_FILES)
3026
e38f7ac74297 Add target for generating htdocs/docs/errors.html, do it in "all", do "all" in "dist".
ville
parents: 2976
diff changeset
    18
e38f7ac74297 Add target for generating htdocs/docs/errors.html, do it in "all", do "all" in "dist".
ville
parents: 2976
diff changeset
    19
htdocs/docs/errors.html: misc/docs_errors.pl share/templates/en_US/error_messages.cfg share/templates/en_US/docs_errors.tmpl htdocs/config/validator.conf
e38f7ac74297 Add target for generating htdocs/docs/errors.html, do it in "all", do "all" in "dist".
ville
parents: 2976
diff changeset
    20
	env W3C_VALIDATOR_HOME=. W3C_VALIDATOR_CFG=htdocs/config/validator.conf misc/docs_errors.pl > $@
2936
a895ac1d11c1 Add perltidy(1) settings and a simple Makefile target for running it.
ville
parents:
diff changeset
    21
3075
ba653e217e4e Add target for generating catalog.xml.
ville
parents: 3058
diff changeset
    22
htdocs/sgml-lib/catalog.xml: misc/soc2xml.pl htdocs/sgml-lib/xml.soc
ba653e217e4e Add target for generating catalog.xml.
ville
parents: 3058
diff changeset
    23
	misc/soc2xml.pl < htdocs/sgml-lib/xml.soc > $@
ba653e217e4e Add target for generating catalog.xml.
ville
parents: 3058
diff changeset
    24
3180
13be4ea042d6 Add Makefile target for precompressing *.css and *.js and httpd.conf section for serving them compressed.
Ville Skyttä <ville.skytta@iki.fi>
parents: 3107
diff changeset
    25
.css.css.gz .js.js.gz:
13be4ea042d6 Add Makefile target for precompressing *.css and *.js and httpd.conf section for serving them compressed.
Ville Skyttä <ville.skytta@iki.fi>
parents: 3107
diff changeset
    26
	$(GZIP) -c $< > $@ && touch -r $< $@
13be4ea042d6 Add Makefile target for precompressing *.css and *.js and httpd.conf section for serving them compressed.
Ville Skyttä <ville.skytta@iki.fi>
parents: 3107
diff changeset
    27
2972
5997b2e905b0 Add test target for running the test suite.
ville
parents: 2945
diff changeset
    28
test:
5997b2e905b0 Add test target for running the test suite.
ville
parents: 2945
diff changeset
    29
	misc/testsuite/harness.py --validator_uri=$(VALIDATOR_URI) run
5997b2e905b0 Add test target for running the test suite.
ville
parents: 2945
diff changeset
    30
2945
c8c09366077e Add perlcritic(1) profile and a Makefile target for running it.
ville
parents: 2944
diff changeset
    31
perlcritic:
c8c09366077e Add perlcritic(1) profile and a Makefile target for running it.
ville
parents: 2944
diff changeset
    32
	$(PERLCRITIC) $(PERL_FILES)
c8c09366077e Add perlcritic(1) profile and a Makefile target for running it.
ville
parents: 2944
diff changeset
    33
2939
346d705fa833 Rename tidy Makefile target to perltidy.
ville
parents: 2937
diff changeset
    34
perltidy:
2944
59f2f3666ed0 Improve "make perltidy" output.
ville
parents: 2939
diff changeset
    35
	@for file in $(PERL_FILES) ; do \
59f2f3666ed0 Improve "make perltidy" output.
ville
parents: 2939
diff changeset
    36
		echo "$(PERLTIDY) $$file" ; \
2937
f55b47ae1c23 Make perltidy backup/modify-in-place.
ville
parents: 2936
diff changeset
    37
		$(PERLTIDY) $$file ; \
2936
a895ac1d11c1 Add perltidy(1) settings and a simple Makefile target for running it.
ville
parents:
diff changeset
    38
	done
2974
4828e0f44dc0 Add dist target.
ville
parents: 2972
diff changeset
    39
3180
13be4ea042d6 Add Makefile target for precompressing *.css and *.js and httpd.conf section for serving them compressed.
Ville Skyttä <ville.skytta@iki.fi>
parents: 3107
diff changeset
    40
clean:
13be4ea042d6 Add Makefile target for precompressing *.css and *.js and httpd.conf section for serving them compressed.
Ville Skyttä <ville.skytta@iki.fi>
parents: 3107
diff changeset
    41
	rm -f $(GZIP_FILES)
13be4ea042d6 Add Makefile target for precompressing *.css and *.js and httpd.conf section for serving them compressed.
Ville Skyttä <ville.skytta@iki.fi>
parents: 3107
diff changeset
    42
3026
e38f7ac74297 Add target for generating htdocs/docs/errors.html, do it in "all", do "all" in "dist".
ville
parents: 2976
diff changeset
    43
dist: all
3107
f7494ae35248 Add "reminder" check for version in various files in "make dist".
Ville Skyttä <ville.skytta@iki.fi>
parents: 3106
diff changeset
    44
	@for file in htdocs/footer.html htdocs/whatsnew.html \
f7494ae35248 Add "reminder" check for version in various files in "make dist".
Ville Skyttä <ville.skytta@iki.fi>
parents: 3106
diff changeset
    45
		httpd/cgi-bin/check share/templates/*/footer.tmpl ; do \
f7494ae35248 Add "reminder" check for version in various files in "make dist".
Ville Skyttä <ville.skytta@iki.fi>
parents: 3106
diff changeset
    46
		grep -qF "$(VERSION)" $$file || { \
f7494ae35248 Add "reminder" check for version in various files in "make dist".
Ville Skyttä <ville.skytta@iki.fi>
parents: 3106
diff changeset
    47
		echo "Validator version in $$file seems out of date." ; \
f7494ae35248 Add "reminder" check for version in various files in "make dist".
Ville Skyttä <ville.skytta@iki.fi>
parents: 3106
diff changeset
    48
		exit 1 ; } ; \
f7494ae35248 Add "reminder" check for version in various files in "make dist".
Ville Skyttä <ville.skytta@iki.fi>
parents: 3106
diff changeset
    49
	done
2974
4828e0f44dc0 Add dist target.
ville
parents: 2972
diff changeset
    50
	misc/mkrelease.sh $(VERSION)
3180
13be4ea042d6 Add Makefile target for precompressing *.css and *.js and httpd.conf section for serving them compressed.
Ville Skyttä <ville.skytta@iki.fi>
parents: 3107
diff changeset
    51
13be4ea042d6 Add Makefile target for precompressing *.css and *.js and httpd.conf section for serving them compressed.
Ville Skyttä <ville.skytta@iki.fi>
parents: 3107
diff changeset
    52
.SUFFIXES: .css .css.gz .js .js.gz