1# Makefile for "top", a top 10 process display for Unix
2#
3# This makefile is for top, version 3
4#
5# Written by William LeFebvre, Group sys Consulting
6#		(formerly of Northwestern University and Rice University)
7
8# DO NOT EDIT "Makefile"!!!!  Make changes to "Makefile.X" and rerun
9# Configure.
10
11# Executables (these should be obvious):
12
13SHELL   = %shell%
14CC      = %cc%
15AWK     = %awk%
16INSTALL = %install%
17
18# installation information:
19#	OWNER	- name (or uid) for the installed executable's owner
20#	GROUP	- group name (or gid) for the installed executable's group
21#	MODE	- mode for the installed executable (should start with a 0)
22#	BINDIR	- directory where the executable should live
23#	MANDIR	- directory where the manual page should live
24#	MANEXT	- installed man pages end in .$(MANEXT)
25#	MANSTY	- "man" or "catman" depending on what's to be installed
26#	SIGNAL	- <signal.h> or <sys/signal.h>; the one with signal definitions
27#	TROFF	- most appropriate troff command
28
29OWNER  = %owner%
30GROUP  = %group%
31MODE   = %mode%
32BINDIR = %bindir%
33MANDIR = %mandir%
34MANEXT = %manext%
35MANSTY = %mansty%
36SIGNAL = %signal%
37
38# Values for the two defaults in "top":
39#	TOPN	- default number of processes to display
40#	DELAY	- default delay between updates
41#
42# set TOPN to -1 to indicate infinity (so that top will display as many
43# as the screen will hold).
44
45TOPN = %topn%
46DELAY = %delay%
47
48CFILES = top.c commands.c display.c screen.c username.c \
49	 utils.c version.c getopt.c machine.c
50OBJS = top.o commands.o display.o screen.o username.o \
51       utils.o version.o getopt.o machine.o
52
53CDEFS = %cdefs%
54LIBS = %libs%
55TERMCAP = %termcap%
56MATH = %math%
57
58CFLAGS = %cflgs% $(CDEFS)
59LINTFLAGS = -x $(CDEFS)
60
61all: Makefile top.local.h top
62
63Makefile: Makefile.X
64	@echo 'You need to run the script "Configure" before running "make".'
65	exit 10
66
67top.local.h: top.local.H
68	@echo 'You need to run the script "Configure" before running "make".'
69	exit 10
70
71top: $(OBJS)
72	rm -f top
73	$(CC) $(CDEFS) -o top $(OBJS) $(TERMCAP) $(MATH) $(LIBS)
74
75lint: sigdesc.h
76	$(LINT) $(LINTFLAGS) $(CFILES)
77
78# include file dependencies
79top.o: boolean.h display.h screen.h top.h top.local.h utils.h machine.h
80commands.o: boolean.h sigdesc.h top.h utils.h
81display.o: boolean.h display.h layout.h screen.h top.h top.local.h utils.h
82screen.o: boolean.h screen.h
83utils.o: top.h
84version.o: top.h patchlevel.h
85username.o: top.local.h utils.h
86
87# when compiling machine.c, include os revision definition
88machine.o: machine.c top.h machine.h utils.h
89	$(CC) "%osrev%" $(CFLAGS) -c machine.c
90
91# automatically built include file
92sigdesc.h: sigconv.awk $(SIGNAL)
93	$(AWK) -f sigconv.awk $(SIGNAL) >sigdesc.h
94
95clean:
96	rm -f *.o top core core.* sigdesc.h
97
98veryclean: clean
99	rm -f Make.desc machine/*.desc .defaults top.tar SYNOPSIS Makefile top.local.h top.1 machine.c prime
100
101install: top top.1 install-top install-$(MANSTY)
102
103install-top:
104	$(INSTALL) -o $(OWNER) -m $(MODE) -g $(GROUP) top $(BINDIR)
105
106install-man:
107	$(INSTALL) top.1 $(MANDIR)/top.$(MANEXT)
108
109install-catman:
110	tbl top.1 | nroff -man > $(MANDIR)/top.$(MANEXT)
111
112installmeta: top top.1
113	$(INSTALL) -o $(OWNER) -m 755 -g $(GROUP) metatop $(BINDIR)/top
114	@echo $(INSTALL) -o $(OWNER) -m $(MODE) -g $(GROUP) top $(BINDIR)/top-`uname -m`-`uname -r`
115	@$(INSTALL) -o $(OWNER) -m $(MODE) -g $(GROUP) \
116		top $(BINDIR)/top-`uname -m`-`uname -r`
117	$(INSTALL) top.1 $(MANDIR)/top.$(MANEXT)
118