[go: up one dir, main page]

File: Makefile

package info (click to toggle)
dwww 1.10.3
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 676 kB
  • ctags: 261
  • sloc: perl: 2,774; ansic: 1,507; makefile: 153; sh: 130
file content (155 lines) | stat: -rw-r--r-- 3,846 bytes parent folder | download
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
#
# Makefile for dwww.
# "@(#)dwww:$Id: Makefile,v 1.30 2006-05-30 18:56:29 robert Exp $"
#

VERSION	= $(shell dpkg-parsechangelog | sed -ne 's/^Version: *//p')

CC	= gcc
CFLAGS	= -Wall -Wstrict-prototypes -Wmissing-prototypes -DVERSION='"$(VERSION)"' 
LDFLAGS	=
LIBS	= -lpub
PERL	= /usr/bin/perl


ifeq (,$(findstring nodebug,$(DEB_BUILD_OPTIONS)))
  CFLAGS += -g
endif

ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
  CFLAGS += -O0
else
  CFLAGS += -O2
endif

ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
  LDFLAGS += -s
endif


prefix		= debian/dwww

bindir		= $(prefix)/usr/bin
sbindir		= $(prefix)/usr/sbin
libdir		= $(prefix)/usr/share/dwww
htmldir		= $(prefix)/var/lib/dwww/html
docdir		= $(prefix)/usr/share/doc/dwww
etcdir		= $(prefix)/etc
etcdwwwdir 	= $(prefix)/etc/dwww
varlibdir  	= $(prefix)/var/lib/dwww
man1dir		= $(prefix)/usr/share/man/man1
man8dir		= $(prefix)/usr/share/man/man8
cachedir 	= $(prefix)/var/cache/dwww
webdocrootdir 	= $(prefix)/var/www
webcgidir	= $(prefix)/usr/lib/cgi-bin
perlmoddir	= $(prefix)/usr/share/perl5/Debian/Dwww

perlmodules	= perl/Debian/Dwww/*.pm


links_end	= dwww-convert.dir.end dwww-convert.end dwww-find.end 

lib		= lib/[!Ceio]* lib/img/[!C]*
editorial	= lib/editorial/*.html
bin		= dwww
cgi		= dwww.cgi
sbin		= dwww-convert dwww-build dwww-cache dwww-find \
		  dwww-quickfind  dwww-txt2html dwww-format-man \
		  dwww-build-menu dwww-index++ dwww-refresh-cache
doc		= README TODO
man1		= man/*.1
man8		= man/*.8

generated	= dwww-cache dwww-quickfind dwww-txt2html \
		  perl/Debian/Dwww/Version.pm functions.sh

perlprogs       = dwww-find dwww-build-menu dwww-index++
testprogs       := $(patsubst %,%.test,$(perlprogs))

all:  $(generated)


%::%.in 
	# try to be compatible with the both sarge and sid versions of make
	PERL5LIB="./perl" $(PERL)  -e \
	'exec ("'$(PERL)'", "-e", join("",@ARGV)) if $$#ARGV >-1; '\
	'	$$|=1;					'\
	'	use Debian::Dwww::Initialize; 		'\
	'	$$d=&DwwwInitialize;			'\
	'	$$v="";					'\
	'	foreach $$k (sort keys %{$$d}) {	'\
	'		$$v.="\t$$k=\"$$d->{$$k}\"\n"	'\
	'			if $$k ne "DWWW_TITLE";	'\
	'	}					'\
	'	while (<>) {				'\
	'		s/#VERSION#/$(VERSION)/g;  	'\
	'		s/^.*#DWWWVARS#.*$$/$$v/g;	'\
	'		print;				'\
	'	}					'\
	  < $< > $@
	touch -r $< $@



dwww-txt2html: dwww-txt2html.o utils.o
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)

dwww-cache: dwww-cache.o utils.o
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)
	
dwww-quickfind: dwww-quickfind.o utils.o
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)
	
debug:
	DEB_BUILD_OPTIONS=noopt,nostrip $(MAKE) all


Debian:
	ln -s . $@

clean:
	rm -f core *.o $(generated)
	rm -f $(testprogs)


installdirs:
	for i in $(prefix) $(prefix)/usr $(prefix)/var $(prefix)/var/lib \
	  $(etcdir) $(etcdwwwdir) $(libdir) $(varlibdir) $(bindir) $(sbindir) \
	  $(docdir) $(man1dir) $(man8dir) $(cachedir) \
	  $(webdocrootdir) $(webcgidir) $(perlmoddir) \
	  $(htmldir) ; \
	do  \
		echo "$$i"; \
		test -d $$i || install -p -d $$i; \
	done

install: installdirs
	install -p -m 0644 $(lib) $(libdir)
	for i in $(links_end) ; do \
		ln -sv dwww.end $(libdir)/$$i; \
	done

	install -p -m 0644 functions.sh $(libdir)
#	chmod a+x $(libdir)/dwww.cgi
#	rm -f $(cgidir)/dwww
#	ln -s $(libdir)/dwww.cgi $(cgidir)/dwww
#	ln -s /usr/lib/dwww/dwww.cgi $(webcgidir)/dwww
	install -p -m 0755 $(cgi) $(webcgidir)/dwww
	install -d -m 0755 $(webdocrootdir)/dwww
	install -p -m 0755 $(bin) $(bindir)
	install -p -m 0755 $(sbin) $(sbindir)
	install -p -m 0644 $(perlmodules) $(perlmoddir)
	install -p -m 0644 $(doc) $(docdir)
	install -p -m 0644 $(man1) $(man1dir)
	install -p -m 0644 $(man8) $(man8dir)

%.test::%
	rm -f $@
	echo "#!/usr/bin/perl" > $@
	echo "use lib \"./perl\";"  >> $@
	sed -e 's/\/usr\/share\/dwww/lib/g'  $< >> $@
	chmod 555 $@

test: $(testprogs) 

.PHONY: all debug clean install installdirs test