File: Makefile.pcd2html

package info (click to toggle)
pcd2html 0.5.1.1-1
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 384 kB
  • ctags: 56
  • sloc: perl: 1,405; makefile: 120; sh: 69
file content (107 lines) | stat: -rw-r--r-- 3,566 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# Makefile to convert Kodak Photo CD images to HTML
DEFAULT_PCD=PCD
DEFAULT_VERSION=1

PCD_TO_SAVE=rules
EXT_TO_SAVE=.deu \
	    .eng \
	    .tec \
	    .drf \
	    extra
WWW_FILES_TO_SAVE=index.html \
	          index_de.html \
		  index.jpg \
		  deutsch.png \
		  english.png \
		  home.png \
		  pic_home.png \
		  pcd.css 
WWW_EXT_TO_SAVE=.html \
	        .jpg \
		.gif

DIRS := $(shell echo `grep -v "^\#" rules | grep "^[A-Za-z0-9]" | sed "s/ .*//"`)
PCD  := $(shell if [ _`sed -n "1p" rules | sed "s/^\# *\([^ ]*\) .*/\1/"` != _ ] ; then sed -n "1p" rules | sed "s/^\# *\([^ ]*\) .*/\1/" ; else echo $(DEFAULT_PCD) ; fi )
VERSION := $(shell if [ _`sed -n "1p" rules | sed "s/^\# *[^ ]* *\([^ ]*\).*/\1/"` != _ ] ; then sed -n "1p" rules | sed "s/^\# *[^ ]* *\([^ ]*\).*/\1/" ; else echo $(DEFAULT_VERSION) ; fi )
PCD_ARCH :=$(PCD)_data-$(VERSION)
HTML_ARCH :=$(PCD)_html-$(VERSION)

all: pcd2html

pcd2html: rules
	@for subdir in $(DIRS) ; do \
	   ( cd $$subdir ; \
           if [ ! -f Makefile ] ; then \
              ( pcd2html_create_makefile ) \
           fi ; \
           make -k ) \
	done
	pcd2html_create_index

data:
	echo Saving into $(PCD_ARCH)
	rm -rf $(PCD_ARCH)
	mkdir $(PCD_ARCH)
	for subdir in $(DIRS) ; do \
	   ( mkdir -p $(PCD_ARCH)/$$subdir && \
	   cp -a $$subdir/rules $(PCD_ARCH)/$$subdir && \
	   if [ -f $$subdir/extra ] ; then ( cp -a $$subdir/extra $(PCD_ARCH)/$$subdir ) fi && \
	   if [ -f $$subdir/data.extra ] ; then ( \
	      for file in `cat $$subdir/data.extra` ; do cp -a $$subdir/$$file $(PCD_ARCH)/$$subdir ; done \
	   ) fi ) \
	done
	for ext in $(EXT_TO_SAVE) ; do \
	  ( for subdir in . $(DIRS) ; do \
	    ( EXIST=`ls -x $$subdir/*$$ext 2> /dev/null | sed "s/\([a-z]\).*/\1/"` && \
	    EXIST=`echo $$EXIST | sed "s/ //g"` && \
	    if [ _$$EXIST != _ ] ; then ( cp -a $$subdir/*$$ext $(PCD_ARCH)/$$subdir ) fi \
	    ) \
	  done ) \
	done
	cp -a $(PCD_TO_SAVE) $(PCD_ARCH)
	# save email adress images which might be used for spam prevention
	for emil in `grep "email[[:space:]]*:" index.{deu,eng} | \
                           sed "s/^.*email[[:space:]]*:[[:space:]]*//" | \
                           uniq` ; do \
	  cp -a $$emil $(PCD_ARCH) ; \
	done
	GZIP=-9 tar -czf $(PCD_ARCH).tgz $(PCD_ARCH)
	rm -rf $(PCD_ARCH)

html: pcd2html
	rm -rf $(HTML_ARCH)
	mkdir $(HTML_ARCH)
	for subdir in $(DIRS) ; do \
	   ( mkdir -p $(HTML_ARCH)/$$subdir ) \
	done
	for subdir in $(DIRS) ; do \
	  ( for ext in $(WWW_EXT_TO_SAVE) ; do \
	    ( EXIST=`ls -x $$subdir/*$$ext 2> /dev/null | sed "s/\([a-z]\).*/\1/"` && \
	    EXIST=`echo $$EXIST | sed "s/ //g"` && \
	    if [ _$$EXIST != _ ] ; then ( cp -a $$subdir/*$$ext $(HTML_ARCH)/$$subdir ) fi \
	    ) \
	  done  && \
          if [ -e $$subdir/index.jpg ] ; then ( cp -a $$subdir/index.jpg $(HTML_ARCH)/$$subdir ) fi \
	  ) \
	done
	cp -a $(WWW_FILES_TO_SAVE) $(HTML_ARCH)
	# save email adress images which might be used for spam prevention
	for emil in `grep "email[[:space:]]*:" index.{deu,eng} | \
                           sed "s/^.*email[[:space:]]*:[[:space:]]*//" | \
                           uniq` ; do \
	  cp -a $$emil $(HTML_ARCH) ; \
	done
	GZIP=-9 tar -czf $(HTML_ARCH).tgz $(HTML_ARCH)
	rm -rf $(HTML_ARCH)

clean:
	for subdir in $(DIRS) ; do \
	   (cd $$subdir && pcd2html_create_makefile && make clean) \
	done

distclean:
	for subdir in $(DIRS); do \
	   (cd $$subdir && pcd2html_create_makefile && make distclean && rm -f Makefile) \
	done
	rm -f index.html index_de.html pcd.css index.jpg \
	      english.png deutsch.png home.png pic_home.png