Makefile
author Ville Skyttä <ville.skytta@iki.fi>
Tue, 14 Dec 2010 00:19:48 +0200
changeset 3190 ae77614001a4
parent 3189 aba7c242f790
child 3253 b7c87ffc4701
permissions -rw-r--r--
Combine JS to yuicompressed lump, load uncompressed sources in debug mode.
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)
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 \
3058
16a6e9abe911 Add crude script for converting SGML Open Catalogs to XML catalogs.
ville
parents: 3026
diff changeset
     7
	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
     8
	misc/bundle/Makefile.PL 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
     9
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
    10
2937
f55b47ae1c23 Make perltidy backup/modify-in-place.
ville
parents: 2936
diff changeset
    11
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
    12
PERLCRITIC = perlcritic --profile misc/perlcriticrc
2937
f55b47ae1c23 Make perltidy backup/modify-in-place.
ville
parents: 2936
diff changeset
    13
3190
ae77614001a4 Combine JS to yuicompressed lump, load uncompressed sources in debug mode.
Ville Skyttä <ville.skytta@iki.fi>
parents: 3189
diff changeset
    14
YUICOMPRESSOR = java -jar /usr/share/java/yuicompressor-2.4.2.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
    15
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
    16
2972
5997b2e905b0 Add test target for running the test suite.
ville
parents: 2945
diff changeset
    17
VALIDATOR_URI = http://localhost/w3c-validator/check
5997b2e905b0 Add test target for running the test suite.
ville
parents: 2945
diff changeset
    18
3189
aba7c242f790 Make it possible to override Makefile variables in config.mk.
Ville Skyttä <ville.skytta@iki.fi>
parents: 3180
diff changeset
    19
# 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
    20
-include config.mk
aba7c242f790 Make it possible to override Makefile variables in config.mk.
Ville Skyttä <ville.skytta@iki.fi>
parents: 3180
diff changeset
    21
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
    22
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
    23
e38f7ac74297 Add target for generating htdocs/docs/errors.html, do it in "all", do "all" in "dist".
ville
parents: 2976
diff changeset
    24
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
    25
	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
    26
3075
ba653e217e4e Add target for generating catalog.xml.
ville
parents: 3058
diff changeset
    27
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
    28
	misc/soc2xml.pl < htdocs/sgml-lib/xml.soc > $@
ba653e217e4e Add target for generating catalog.xml.
ville
parents: 3058
diff changeset
    29
3190
ae77614001a4 Combine JS to yuicompressed lump, load uncompressed sources in debug mode.
Ville Skyttä <ville.skytta@iki.fi>
parents: 3189
diff changeset
    30
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
    31
	rm -f $@
ae77614001a4 Combine JS to yuicompressed lump, load uncompressed sources in debug mode.
Ville Skyttä <ville.skytta@iki.fi>
parents: 3189
diff changeset
    32
	@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
    33
		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
    34
		$(YUICOMPRESSOR) $$src >> $@ ; \
ae77614001a4 Combine JS to yuicompressed lump, load uncompressed sources in debug mode.
Ville Skyttä <ville.skytta@iki.fi>
parents: 3189
diff changeset
    35
	done
ae77614001a4 Combine JS to yuicompressed lump, load uncompressed sources in debug mode.
Ville Skyttä <ville.skytta@iki.fi>
parents: 3189
diff changeset
    36
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
    37
.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
    38
	$(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
    39
2972
5997b2e905b0 Add test target for running the test suite.
ville
parents: 2945
diff changeset
    40
test:
5997b2e905b0 Add test target for running the test suite.
ville
parents: 2945
diff changeset
    41
	misc/testsuite/harness.py --validator_uri=$(VALIDATOR_URI) run
5997b2e905b0 Add test target for running the test suite.
ville
parents: 2945
diff changeset
    42
2945
c8c09366077e Add perlcritic(1) profile and a Makefile target for running it.
ville
parents: 2944
diff changeset
    43
perlcritic:
c8c09366077e Add perlcritic(1) profile and a Makefile target for running it.
ville
parents: 2944
diff changeset
    44
	$(PERLCRITIC) $(PERL_FILES)
c8c09366077e Add perlcritic(1) profile and a Makefile target for running it.
ville
parents: 2944
diff changeset
    45
2939
346d705fa833 Rename tidy Makefile target to perltidy.
ville
parents: 2937
diff changeset
    46
perltidy:
2944
59f2f3666ed0 Improve "make perltidy" output.
ville
parents: 2939
diff changeset
    47
	@for file in $(PERL_FILES) ; do \
59f2f3666ed0 Improve "make perltidy" output.
ville
parents: 2939
diff changeset
    48
		echo "$(PERLTIDY) $$file" ; \
2937
f55b47ae1c23 Make perltidy backup/modify-in-place.
ville
parents: 2936
diff changeset
    49
		$(PERLTIDY) $$file ; \
2936
a895ac1d11c1 Add perltidy(1) settings and a simple Makefile target for running it.
ville
parents:
diff changeset
    50
	done
2974
4828e0f44dc0 Add dist target.
ville
parents: 2972
diff changeset
    51
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
    52
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
    53
	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
    54
3026
e38f7ac74297 Add target for generating htdocs/docs/errors.html, do it in "all", do "all" in "dist".
ville
parents: 2976
diff changeset
    55
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
    56
	@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
    57
		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
    58
		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
    59
		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
    60
		exit 1 ; } ; \
f7494ae35248 Add "reminder" check for version in various files in "make dist".
Ville Skyttä <ville.skytta@iki.fi>
parents: 3106
diff changeset
    61
	done
2974
4828e0f44dc0 Add dist target.
ville
parents: 2972
diff changeset
    62
	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
    63
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
    64
.SUFFIXES: .css .css.gz .js .js.gz