Makefile
author Ville Skyttä <ville.skytta@iki.fi>
Mon, 16 Jul 2012 17:28:29 +0300
changeset 3292 c33aa0047b4d
parent 3265 14e6605f488e
permissions -rw-r--r--
perltidy: Do not leave backups behind if there are no errors.
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
3256
81a24724d6e0 Remove old unused CSS and associated images.
Ville Skyttä <ville.skytta@iki.fi>
parents: 3253
diff changeset
     3
CSS_FILES = htdocs/style/base.css htdocs/style/results.css
3190
ae77614001a4 Combine JS to yuicompressed lump, load uncompressed sources in debug mode.
Ville Skyttä <ville.skytta@iki.fi>
parents: 3189
diff changeset
     4
JS_SOURCES = htdocs/scripts/mootools-1.2.5-core-nc.js \
ae77614001a4 Combine JS to yuicompressed lump, load uncompressed sources in debug mode.
Ville Skyttä <ville.skytta@iki.fi>
parents: 3189
diff changeset
     5
	htdocs/scripts/mootools-1.2.5.1-more.js	htdocs/scripts/w3c-validator.js
2936
a895ac1d11c1 Add perltidy(1) settings and a simple Makefile target for running it.
ville
parents:
diff changeset
     6
PERL_FILES = httpd/cgi-bin/check httpd/cgi-bin/sendfeedback.pl \
3265
14e6605f488e Make XML::LibXML catalog setup work with mod_perl.
Ville Skyttä <ville.skytta@iki.fi>
parents: 3256
diff changeset
     7
	httpd/mod_perl/startup.pl misc/soc2xml.pl misc/spmpp.pl \
14e6605f488e Make XML::LibXML catalog setup work with mod_perl.
Ville Skyttä <ville.skytta@iki.fi>
parents: 3256
diff changeset
     8
	misc/docs_errors.pl misc/bundle/Makefile.PL \
14e6605f488e Make XML::LibXML catalog setup work with mod_perl.
Ville Skyttä <ville.skytta@iki.fi>
parents: 3256
diff changeset
     9
	misc/bundle/lib/Bundle/W3C/Validator.pm
3190
ae77614001a4 Combine JS to yuicompressed lump, load uncompressed sources in debug mode.
Ville Skyttä <ville.skytta@iki.fi>
parents: 3189
diff changeset
    10
GZIP_FILES = $(addsuffix .gz,$(CSS_FILES)) htdocs/scripts/combined.js.gz
2936
a895ac1d11c1 Add perltidy(1) settings and a simple Makefile target for running it.
ville
parents:
diff changeset
    11
3292
c33aa0047b4d perltidy: Do not leave backups behind if there are no errors.
Ville Skyttä <ville.skytta@iki.fi>
parents: 3265
diff changeset
    12
PERLTIDY = perltidy --profile=misc/perltidyrc --backup-and-modify-in-place \
c33aa0047b4d perltidy: Do not leave backups behind if there are no errors.
Ville Skyttä <ville.skytta@iki.fi>
parents: 3265
diff changeset
    13
	--backup-file-extension=/
2945
c8c09366077e Add perlcritic(1) profile and a Makefile target for running it.
ville
parents: 2944
diff changeset
    14
PERLCRITIC = perlcritic --profile misc/perlcriticrc
2937
f55b47ae1c23 Make perltidy backup/modify-in-place.
ville
parents: 2936
diff changeset
    15
3253
b7c87ffc4701 Be less specific about path to yuicompressor jar.
Ville Skyttä <ville.skytta@iki.fi>
parents: 3190
diff changeset
    16
YUICOMPRESSOR = java -jar $(wildcard /usr/share/java/yuicompressor*.jar)
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
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
    18
2972
5997b2e905b0 Add test target for running the test suite.
ville
parents: 2945
diff changeset
    19
VALIDATOR_URI = http://localhost/w3c-validator/check
5997b2e905b0 Add test target for running the test suite.
ville
parents: 2945
diff changeset
    20
3189
aba7c242f790 Make it possible to override Makefile variables in config.mk.
Ville Skyttä <ville.skytta@iki.fi>
parents: 3180
diff changeset
    21
# Override the above variables in config.mk if needed.
aba7c242f790 Make it possible to override Makefile variables in config.mk.
Ville Skyttä <ville.skytta@iki.fi>
parents: 3180
diff changeset
    22
-include config.mk
aba7c242f790 Make it possible to override Makefile variables in config.mk.
Ville Skyttä <ville.skytta@iki.fi>
parents: 3180
diff changeset
    23
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
    24
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
    25
e38f7ac74297 Add target for generating htdocs/docs/errors.html, do it in "all", do "all" in "dist".
ville
parents: 2976
diff changeset
    26
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
    27
	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
    28
3075
ba653e217e4e Add target for generating catalog.xml.
ville
parents: 3058
diff changeset
    29
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
    30
	misc/soc2xml.pl < htdocs/sgml-lib/xml.soc > $@
ba653e217e4e Add target for generating catalog.xml.
ville
parents: 3058
diff changeset
    31
3190
ae77614001a4 Combine JS to yuicompressed lump, load uncompressed sources in debug mode.
Ville Skyttä <ville.skytta@iki.fi>
parents: 3189
diff changeset
    32
htdocs/scripts/combined.js: $(JS_SOURCES)
ae77614001a4 Combine JS to yuicompressed lump, load uncompressed sources in debug mode.
Ville Skyttä <ville.skytta@iki.fi>
parents: 3189
diff changeset
    33
	rm -f $@
ae77614001a4 Combine JS to yuicompressed lump, load uncompressed sources in debug mode.
Ville Skyttä <ville.skytta@iki.fi>
parents: 3189
diff changeset
    34
	@for src in $(JS_SOURCES) ; do \
ae77614001a4 Combine JS to yuicompressed lump, load uncompressed sources in debug mode.
Ville Skyttä <ville.skytta@iki.fi>
parents: 3189
diff changeset
    35
		echo "$(YUICOMPRESSOR) $$src >> $@" ; \
ae77614001a4 Combine JS to yuicompressed lump, load uncompressed sources in debug mode.
Ville Skyttä <ville.skytta@iki.fi>
parents: 3189
diff changeset
    36
		$(YUICOMPRESSOR) $$src >> $@ ; \
ae77614001a4 Combine JS to yuicompressed lump, load uncompressed sources in debug mode.
Ville Skyttä <ville.skytta@iki.fi>
parents: 3189
diff changeset
    37
	done
ae77614001a4 Combine JS to yuicompressed lump, load uncompressed sources in debug mode.
Ville Skyttä <ville.skytta@iki.fi>
parents: 3189
diff changeset
    38
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
    39
.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
    40
	$(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
    41
2972
5997b2e905b0 Add test target for running the test suite.
ville
parents: 2945
diff changeset
    42
test:
5997b2e905b0 Add test target for running the test suite.
ville
parents: 2945
diff changeset
    43
	misc/testsuite/harness.py --validator_uri=$(VALIDATOR_URI) run
5997b2e905b0 Add test target for running the test suite.
ville
parents: 2945
diff changeset
    44
2945
c8c09366077e Add perlcritic(1) profile and a Makefile target for running it.
ville
parents: 2944
diff changeset
    45
perlcritic:
c8c09366077e Add perlcritic(1) profile and a Makefile target for running it.
ville
parents: 2944
diff changeset
    46
	$(PERLCRITIC) $(PERL_FILES)
c8c09366077e Add perlcritic(1) profile and a Makefile target for running it.
ville
parents: 2944
diff changeset
    47
2939
346d705fa833 Rename tidy Makefile target to perltidy.
ville
parents: 2937
diff changeset
    48
perltidy:
2944
59f2f3666ed0 Improve "make perltidy" output.
ville
parents: 2939
diff changeset
    49
	@for file in $(PERL_FILES) ; do \
59f2f3666ed0 Improve "make perltidy" output.
ville
parents: 2939
diff changeset
    50
		echo "$(PERLTIDY) $$file" ; \
2937
f55b47ae1c23 Make perltidy backup/modify-in-place.
ville
parents: 2936
diff changeset
    51
		$(PERLTIDY) $$file ; \
2936
a895ac1d11c1 Add perltidy(1) settings and a simple Makefile target for running it.
ville
parents:
diff changeset
    52
	done
2974
4828e0f44dc0 Add dist target.
ville
parents: 2972
diff changeset
    53
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
    54
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
    55
	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
    56
3026
e38f7ac74297 Add target for generating htdocs/docs/errors.html, do it in "all", do "all" in "dist".
ville
parents: 2976
diff changeset
    57
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
    58
	@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
    59
		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
    60
		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
    61
		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
    62
		exit 1 ; } ; \
f7494ae35248 Add "reminder" check for version in various files in "make dist".
Ville Skyttä <ville.skytta@iki.fi>
parents: 3106
diff changeset
    63
	done
2974
4828e0f44dc0 Add dist target.
ville
parents: 2972
diff changeset
    64
	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
    65
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
    66
.SUFFIXES: .css .css.gz .js .js.gz