summaryrefslogtreecommitdiff
path: root/usr.bin/less/Makefile.aut
blob: b3ee3f4639d1e4dba176261c213baedcfe96fb5a (plain)
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
# Makefile for authoring less.

EMAIL = markn@greenwoodsoftware.com
HOMEPAGE = http://www.greenwoodsoftware.com/less
SHELL = /bin/sh
RCS = rcs
NROFF = nroff -man

srcdir = .

SRC = \
	main.c screen.c brac.c ch.c charset.c cmdbuf.c \
	command.c cvt.c decode.c edit.c filename.c forwback.c \
	help.c ifile.c input.c jump.c line.c linenum.c \
	lsystem.c mark.c optfunc.c option.c opttbl.c os.c \
	output.c pattern.c position.c prompt.c search.c signal.c \
	tags.c ttyin.c version.c  
DISTFILES_W = \
	defines.ds  Makefile.dsb Makefile.dsg Makefile.dsu \
	defines.o2  Makefile.o2e \
	defines.o9  Makefile.o9c Makefile.o9u \
	defines.wn  Makefile.wnm Makefile.wnb
DISTFILES = \
	${SRC} regexp.c regexp.h \
	COPYING INSTALL LICENSE Makefile.in Makefile.aut NEWS README \
	configure configure.ac lesskey.c lessecho.c scrsize.c \
	charset.h cmd.h funcs.h lglob.h less.h lesskey.h option.h \
	pckeys.h pattern.h position.h \
	install.sh defines.h.in mkinstalldirs \
	less.nro less.man lesskey.nro lesskey.man lessecho.nro lessecho.man \
	less.hlp \
	mkfuncs.awk mkhelp.c \
	${DISTFILES_W}

all: help.c funcs.h ${srcdir}/configure 

release: .FORCE
	${MAKE} -f Makefile.aut tagall 
	${MAKE} -f Makefile.aut all 
	${MAKE} -f Makefile.aut clean 
	${MAKE} -f Makefile.aut dist

.FORCE:

help.c: less.hlp mkhelp
	-mv -f ${srcdir}/help.c ${srcdir}/help.c.old
	rm -rf help.c
	./mkhelp < less.hlp > help.c
	if cmp -s help.c help.c.old; then mv help.c.old help.c; fi

mkhelp: mkhelp.c
	${CC} -o mkhelp mkhelp.c

${srcdir}/configure: ${srcdir}/configure.ac \
		${srcdir}/Makefile.in
	cd ${srcdir}; autoheader; autoconf

funcs.h: ${SRC:%=${srcdir}/%}
	-mv -f ${srcdir}/funcs.h ${srcdir}/funcs.h.old
	awk -f ${srcdir}/mkfuncs.awk ${SRC:%=${srcdir}/%} >${srcdir}/funcs.h
	if cmp -s funcs.h funcs.h.old; then mv funcs.h.old funcs.h; fi

lint:
	lint -I. ${CPPFLAGS} ${SRC}

clean: 
	rm -f Makefile config.status config.log config.cache defines.h stamp-h \
		README NEWS \
		less.nro less.man lesskey.nro lesskey.man lessecho.nro lessecho.man 

distclean: clean
realclean: clean

REPLACE_VERSION = \
	@REL=`sed -e '/char version/!d' -e 's/[^0-9.]*\([0-9.]*\).*/\1/' -e q ${srcdir}/version.c`; \
	DT=`date '+%d %h %Y'`; \
	echo "Stuffing version number $$REL into $@"; \
	sed \
		-e "s;@@VERSION@@;$$REL;" \
		-e "s;@@DATE@@;$$DT;" \
		-e "s;@@EMAIL@@;${EMAIL};" \
		-e "s;@@HOMEPAGE@@;${HOMEPAGE};" >$@

${srcdir}/README: ${srcdir}/README.VER ${srcdir}/version.c
	${REPLACE_VERSION} ${srcdir}/README.VER
${srcdir}/NEWS: ${srcdir}/NEWS.VER ${srcdir}/version.c
	${REPLACE_VERSION} ${srcdir}/NEWS.VER
${srcdir}/less.nro: ${srcdir}/less.nro.VER ${srcdir}/version.c
	${REPLACE_VERSION} ${srcdir}/less.nro.VER
${srcdir}/lesskey.nro: ${srcdir}/lesskey.nro.VER ${srcdir}/version.c
	${REPLACE_VERSION} ${srcdir}/lesskey.nro.VER
${srcdir}/lessecho.nro: ${srcdir}/lessecho.nro.VER ${srcdir}/version.c
	${REPLACE_VERSION} ${srcdir}/lessecho.nro.VER
${srcdir}/less.hlp: ${srcdir}/less.hlp.VER ${srcdir}/version.c
	${REPLACE_VERSION} ${srcdir}/less.hlp.VER

${srcdir}/less.man: ${srcdir}/less.nro
	${NROFF} ${srcdir}/less.nro >${srcdir}/less.man
${srcdir}/lesskey.man: ${srcdir}/lesskey.nro
	${NROFF} ${srcdir}/lesskey.nro >${srcdir}/lesskey.man
${srcdir}/lessecho.man: ${srcdir}/lessecho.nro
	${NROFF} ${srcdir}/lessecho.nro >${srcdir}/lessecho.man


distfiles: ${DISTFILES}

dist: ${DISTFILES}
	if [ ! -d ${srcdir}/release ]; then mkdir ${srcdir}/release; fi
	@cd ${srcdir}; \
	REL=`sed -e '/char version/!d' -e 's/[^0-9.]*\([0-9.]*\).*/less-\1/' -e q version.c`; \
	rm -rf release/$$REL; mkdir release/$$REL; \
	echo "Preparing $$REL"; \
	rm -rf $$REL; mkdir $$REL; \
	for file in ${DISTFILES}; do \
	  cp -p $$file $$REL; \
	  chmod -w $$REL/$$file; \
	done; \
	cd $$REL; chmod +w ${DISTFILES_W}; cd ..; \
	echo "Creating release/$$REL/$$REL.tar.gz"; \
	tar -cf - $$REL | gzip -c >release/$$REL/$$REL.tar.gz; \
	echo "Signing release/$$REL/$$REL.tar.gz"; \
	gpg --detach-sign release/$$REL/$$REL.tar.gz; \
	echo "Creating release/$$REL/$$REL.zip"; \
	zip -rq release/$$REL/$$REL.zip $$REL; \
	rm -rf $$REL

tagall:
	@REL=`sed -e '/char version/!d' -e 's/[^0-9.]*\([0-9.]*\).*/v\1/' -e q ${srcdir}/version.c`; \
	echo "tagging $$REL"; \
	for f in ${srcdir}/RCS/*,v; do \
	  REV=`co -p $$f 2>&1 | sed -e '1d' -e '3,$$d' -e 's/revision //'`; \
	  ${RCS} -N$$REL:$$REV $$f; \
	done