1# Makefile for "less"
2# Generated Thu Sep 22 13:28:32 PDT 1988 by linstall.
3#
4# Invoked as:
5#	make all
6#   or	make install
7# Plain "make" is equivalent to "make all".
8#
9# If you add or delete functions, remake funcs.h by doing:
10#	make newfuncs
11# This depends on the coding convention of function headers looking like:
12#	" \t public <function-type> \n <function-name> ( ... ) "
13#
14# Also provided:
15#	make lint	# Runs "lint" on all the sources.
16#	make clean	# Removes "less" and the .o files.
17#	make clobber	# Pretty much the same as make "clean".
18
19SHELL = /bin/sh
20
21
22##########################################################################
23# Compilation environment.
24##########################################################################
25l=/usr/lib
26# LIBS is the list of libraries needed.
27#LIBS = -ltermlib
28LIBS = $l/libc.a $l/libtermcap.a
29# INSTALL_LESS is a list of the public versions of less.
30# INSTALL_KEY is a list of the public versions of lesskey.
31# INSTALL_HELP is a list of the public version of the help file.
32# INSTALL_LESSMAN is a list of the public versions of the less manual page.
33# INSTALL_KEYMAN is a list of the public versions of the lesskey manual page.
34ROOT =  ${PREFIX}
35INSTALL_LESS =		$(ROOT)/bin/vnless
36INSTALL_KEY =		$(ROOT)/bin/vnlesskey
37INSTALL_HELP =		$(ROOT)/share/misc/vnless.help
38INSTALL_LESSMAN =	$(ROOT)/man/man1/vnless.1
39INSTALL_KEYMAN =	$(ROOT)/man/man1/vnlesskey.1
40LESS_MANUAL =		less.man
41KEY_MANUAL =		lesskey.man
42HELPFILE =		$(ROOT)/share/misc/vnless.help
43
44
45# OPTIM is passed to the compiler and the loader.
46# It is normally "-O" but may be, for example, "-g".
47#OPTIM = -O
48
49#CFLAGS = $(OPTIM)
50CFLAGS ?= -O
51LDFLAGS ?=
52LDLIBS = -lcompat
53
54
55##########################################################################
56# Files
57##########################################################################
58
59SRC1 =	main.c option.c prim.c ch.c position.c input.c linenum.c
60SRC2 =	screen.c prompt.c line.c signal.c os.c help.c ttyin.c command.c
61SRC3 =	output.c decode.c tags.c version.c regerror.c
62SRC =	$(SRC1) $(SRC2) $(SRC3)
63OBJ =	main.o option.o prim.o ch.o position.o input.o output.o \
64	screen.o prompt.o line.o signal.o os.o help.o ttyin.o \
65	decode.o command.o linenum.o tags.o version.o regerror.o
66
67
68##########################################################################
69# Rules for building stuff
70##########################################################################
71
72all: vnless lesskey
73install: install_less install_help install_key install_lman install_kman
74
75vnless: $(OBJ)
76	$(CC) $(LDFLAGS) $(OPTIM) -o vnless $(OBJ) $(LIBS) $(LDLIBS)
77
78lesskey: lesskey.o
79	$(CC) $(LDFLAGS) $(OPTIM) -o lesskey lesskey.o $(LDLIBS)
80
81# help.s depends on makefile for the definition of HELPFILE
82help.o: Makefile
83	$(CC) $(CFLAGS) -c -DHELPFILE=\"$(HELPFILE)\" help.c
84
85install_less: vnless
86	$(BSD_INSTALL_PROGRAM) vnless $(DESTDIR)$(INSTALL_LESS)
87
88install_key: lesskey
89	$(BSD_INSTALL_PROGRAM) lesskey $(DESTDIR)$(INSTALL_KEY)
90
91install_help: less.help
92	$(BSD_INSTALL_DATA) less.help $(DESTDIR)$(INSTALL_HELP)
93
94install_lman: $(LESS_MANUAL)
95	$(BSD_INSTALL_MAN) $(LESS_MANUAL) $(DESTDIR)$(INSTALL_LESSMAN)
96
97install_kman: $(KEY_MANUAL)
98	$(BSD_INSTALL_MAN) $(KEY_MANUAL) $(DESTDIR)$(INSTALL_KEYMAN)
99
100##########################################################################
101# Maintenance
102##########################################################################
103
104lint:
105	lint -hp $(SRC)
106
107newfuncs funcs.h:
108	if [ -f funcs.h ]; then mv funcs.h funcs.h.OLD; fi
109	awk -f mkfuncs.awk $(SRC) >funcs.h
110
111clean:
112	rm -f $(OBJ) lesskey.o vnless lesskey vecho
113
114clobber:
115	rm -f *.o vnless lesskey vecho install_less install_key \
116		install_help install_lman install_kman
117
118shar:
119	shar -v linstall less.h position.h funcs.h cmd.h \
120		vecho.c lesskey.c less.man lesskey.man  > less.shar.a
121	shar -v $(SRC1) > less.shar.b
122	shar -v $(SRC2) > less.shar.c
123	shar -v $(SRC3) less.man README less.help *.awk >less.shar.d
124
125
126##########################################################################
127# Dependencies
128##########################################################################
129
130$(OBJ): less.h funcs.h defines.h position.h
131command.o decode.o: cmd.h
132lesskey.o: less.h funcs.h defines.h cmd.h
133
134