aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/w3mman/Makefile
blob: 8adf5dd1a2119a175b1dd4a9233cb208dbfaa7f7 (plain) (blame)
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
prefix		= /usr/local
BIN_DIR		= $(prefix)/bin
LIB_DIR		= $(prefix)/lib/w3m
MAN_DIR		= $(prefix)/man
DESTDIR		=
distdir		= ./distfiles

TARGETS		= w3mman
LIB_TARGETS	= w3mman2html.cgi
MAN1_TARGETS	= w3mman.1
MAN_TARGETS	= $(MAN1_TARGETS)

MKDIR		= mkdir -p
INSTALL		= install -c
INSTALL_SCRIPT	= $(INSTALL) -m 755
INSTALL_MAN	= $(INSTALL) -m 644

PERL		= /usr/local/bin/perl
W3M		= w3m
# W3M		= w3m -X -o confirm_qq=0
MAN		= man

.SUFFIXES: .in

all: $(TARGETS) $(LIB_TARGETS) $(MAN_TARGETS)

.in:
	sed -e 's%@PERL@%$(PERL)%g'	\
	    -e 's%@W3M@%$(W3M)%g'	\
	    -e 's%@MAN@%$(MAN)%g'	\
	    -e 's%@LIB_DIR@%$(LIB_DIR)%g' \
	$< > $@
	chmod +x $@

install: $(TARGETS) $(LIB_TARGETS) $(MAN_TARGETS)
	-$(MKDIR) $(DESTDIR)$(BIN_DIR)
	-$(MKDIR) $(DESTDIR)$(LIB_DIR)
	for file in $(TARGETS);     \
	do      \
		$(INSTALL_SCRIPT) $$file $(DESTDIR)$(BIN_DIR);	\
	done
	for file in $(LIB_TARGETS);     \
	do      \
		$(INSTALL_SCRIPT) $$file $(DESTDIR)$(LIB_DIR);	\
	done
	for file in $(MAN1_TARGETS); \
	do	\
		$(INSTALL_MAN) $$file $(DESTDIR)$(MAN_DIR)/man1; \
	done

uninstall:
	-for file in $(TARGETS);     \
	do      \
		rm -f $(BIN_DIR)/$$file;	\
	done
	-for file in $(LIB_TARGETS);     \
	do      \
		rm -f $(LIB_DIR)/$$file;	\
	done
	-for file in $(MAN_TARGETS); \
	do \
		rm -f $(MAN_DIR)/$$file; \
	done

clean:
	-rm -f $(TARGETS) $(LIB_TARGETS) $(MAN_TARGETS)

dist: all
	@-rm -fr $(distdir)/w3mman
	-$(MKDIR) $(distdir)/w3mman
	cp Makefile README w3mman.in w3mman2html.cgi.in hlink.cgi w3mman.1.in $(distdir)/w3mman
	( cd $(distdir); tar -cf - w3mman | GZIP='' gzip ) \
		> $(distdir)/w3mman.tar.gz
	-rm -fr $(distdir)/w3mman