OSDN Git Service

deleted: admin/misc-tools/cvsstat.pl
[linuxjf/JF.git] / htmls_and_text.rules
1 #
2 #  Makefile rules for multi HTMLs and a single text
3 #
4
5 COMPILE=yes
6
7 SRC_EXPR =
8
9 IMAGE_EXPR =    -o -name '*.gif' \
10                 -o -name '*.png' \
11                 -o -name '*.jpg' \
12                 -o -name '*.jpeg' \
13                 -o -name '*.tif' \
14                 -o -name '*.tiff'\
15                 -o -name '*.css'
16
17 ifeq ($(origin BASENAME), undefined)
18 BASENAME := $(notdir $(CURDIR))
19 endif
20
21 #
22 # condition check
23 #
24 ifeq ($(RESTRICT_COMMERCIAL), yes)
25 ifeq ($(RESTRICT-DIST), yes)
26 COMPILE=no
27 endif
28 endif
29
30 #
31 # default target by condition.
32 #
33 ifeq ($(COMPILE), yes)
34 all: index.html $(BASENAME).txt
35
36 install: install-work \
37         install-www \
38         install-ftp \
39         install-ldp-mirror
40 else
41 all:
42         @echo Skip compilation.
43 install: 
44         @echo Skip installation.
45 endif
46
47 #
48 # rules
49 #
50
51 index.html:
52         @echo HTMLs are supplied from upstream
53
54 $(BASENAME).txt: 
55         @echo text is supplied from upstream
56
57 $(BASENAME).tar.gz: index.html
58         find . -name '*.html' $(IMAGE_EXPR) \
59          | tar cvfz $@ --files-from=-
60
61 #
62 # Create JF archives
63 #
64
65 #
66 # single html file with images, multiple html files,
67 # multiple html files with images
68 #
69 install-work: \
70         $(WORK_TEXT)/$(BASENAME).txt \
71         $(WORK_HTML)/$(BASENAME)/index.html
72
73 $(WORK_TEXT)/$(BASENAME).txt: $(BASENAME).txt
74         mkdir -p $(@D)
75         $(INSTALL) $< $@
76         touch $(LAST_MODIFIED)
77
78 $(WORK_HTML)/$(BASENAME)/index.html: index.html
79         mkdir -p $(WORK_HTML)
80         mkdir -p $(@D)
81         tar cf - `find . -name '*.html' $(IMAGE_EXPR)` \
82         | ( cd $(@D); tar xpf -)
83
84 #
85 # Install WWW contents
86 #
87 ifneq ($(INSTALL_WWW), yes)
88 install-www:
89 else
90 install-www: \
91         $(DEST_WWW_TEXT)/$(BASENAME).txt \
92         $(DEST_WWW_HTML)/$(BASENAME)/index.html
93
94 $(DEST_WWW_TEXT)/$(BASENAME).txt: $(BASENAME).txt
95         mkdir -p $(@D)
96         $(INSTALL) $< $@
97
98 $(DEST_WWW_HTML)/$(BASENAME)/index.html: index.html
99         mkdir -p $(DEST_WWW_HTML)
100         mkdir -p $(@D)
101         tar cf - `find . -name '*.html' $(IMAGE_EXPR)` \
102         | ( cd $(@D); tar xpf -)
103         if [ -r dot.htaccess ]; then \
104            $(INSTALL) dot.htaccess $(@D)/.htaccess ; \
105         fi
106 endif
107
108 #
109 # Install FTP contents
110 #
111 ifneq ($(INSTALL_FTP), yes)
112 install-ftp:
113 else
114 install-ftp: \
115         $(DEST_FTP_TEXT)/$(BASENAME).gz \
116         $(DEST_FTP_HTML)/$(BASENAME).tar.gz
117
118 $(DEST_FTP_TEXT)/$(BASENAME).gz: $(BASENAME).txt
119         mkdir -p $(@D)
120         $(INSTALL) $< $(@:.gz=)
121         rm -f $@
122         gzip $(@:.gz=)
123
124 $(DEST_FTP_HTML)/$(BASENAME).tar.gz: $(BASENAME).tar.gz
125         mkdir -p $(@D)
126         $(INSTALL) $< $@
127 endif
128
129 #
130 # Install LDP translations for mirror
131 #
132 ifneq ($(INSTALL_LDP), yes)
133 install-ldp-mirror:
134 else
135 ifneq ($(KIND), LDP-TRANS)
136 install-ldp-mirror: 
137         @echo Non-LDP document. Skipped.
138 else
139 install-ldp-mirror: \
140         $(DEST_LDP_TEXT)/$(BASENAME).gz \
141         $(DEST_LDP_HTML)/$(BASENAME).tar.gz
142
143 $(DEST_LDP_TEXT)/$(BASENAME).gz: $(BASENAME).txt
144         mkdir -p $(@D)
145         $(INSTALL) $< $(@:.gz=)
146         rm -f $@
147         gzip $(@:.gz=)
148
149 $(DEST_LDP_HTML)/$(BASENAME).tar.gz: $(BASENAME).tar.gz
150         mkdir -p $(@D)
151         $(INSTALL) $< $@
152
153 endif
154 endif
155
156 #
157 clean:
158         rm -f $(BASENAME).tar.gz