xref: /illumos-gate/usr/src/cmd/ttymon/Makefile (revision dd4eeefd)
1#
2# CDDL HEADER START
3#
4# The contents of this file are subject to the terms of the
5# Common Development and Distribution License (the "License").
6# You may not use this file except in compliance with the License.
7#
8# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9# or http://www.opensolaris.org/os/licensing.
10# See the License for the specific language governing permissions
11# and limitations under the License.
12#
13# When distributing Covered Code, include this CDDL HEADER in each
14# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15# If applicable, add the following below this CDDL HEADER, with the
16# fields enclosed by brackets "[]" replaced with your own identifying
17# information: Portions Copyright [yyyy] [name of copyright owner]
18#
19# CDDL HEADER END
20#
21
22#
23# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
24# Use is subject to license terms.
25#
26# ident	"%Z%%M%	%I%	%E% SMI"
27#
28
29PROG= stty ttymon ttyadm sttydefs
30XPG4PROG= stty
31
32# the 'stty' objects have to be made in a separate directory
33# since only they are built with the -DEUC flag (see below).
34STTYOBJ=	sttyobjs/stty.o sttyobjs/sttytable.o sttyobjs/sttyparse.o
35
36XPG4STTYOBJ=	sttyobjs.xpg4/stty.o sttyobjs.xpg4/sttytable.o \
37		sttyobjs.xpg4/sttyparse.o
38
39TTYMONOBJ=	ttymon.o tmglobal.o tmhandler.o tmpmtab.o tmttydefs.o \
40		tmparse.o tmsig.o tmsac.o tmchild.o tmautobaud.o tmterm.o \
41		tmutmp.o tmpeek.o tmlog.o tmlock.o tmutil.o tmexpress.o \
42		sttytable.o sttyparse.o ulockf.o
43
44TTYADMOBJ=	ttyadm.o tmutil.o admutil.o
45
46STTYDEFSOBJ=	sttydefs.o admutil.o tmttydefs.o tmparse.o sttytable.o \
47		sttyparse.o
48
49OBJS= $(STTYOBJ) $(XPG4STTYOBJ) $(TTYMONOBJ) $(TTYADMOBJ) $(STTYDEFSOBJ)
50STTYSRC= stty.c sttytable.c sttyparse.c
51TTYMONSRC= $(TTYMONOBJ:%.o=%.c)
52TTYADMSRC= $(TTYADMOBJ:%.o=%.c)
53STTYDEFSSRC= $(STTYDEFSOBJ:%.o=%.c)
54SRCS= $(STTYSRC) $(TTYMONSRC) $(TTYADMSRC) $(STTYDEFSSRC)
55
56.PARALLEL:	$(OBJS) $(PROG)
57
58include ../Makefile.cmd
59
60# If machine name and /etc/issue file need to be printed
61# before the service prompt is printed, then:  CPPFLAGS += -DSYS_NAME
62# If debug is needed, then:  CPPFLAGS += -DDEBUG
63# fix for 1111333 - turn on SYS_NAME so /etc/issue will be read if it exists
64CPPFLAGS += -DSYS_NAME
65$(XPG4):= CPPFLAGS += -DXPG4
66sttydefs := LDLIBS += -lnsl
67ttymon := LDLIBS += -lnsl -lsec -ldevinfo
68
69# Only stty can be built with -DEUC.  ttymon will dump core unless further
70# changes are made to it.
71$(STTYOBJ) := CPPFLAGS += -DEUC
72$(XPG4STTYOBJ) := CPPFLAGS += -DEUC
73
74LINTFLAGS = -b -x
75CFLAGS += $(CCVERBOSE)
76LDFLAGS += $(MAPFILE.NGB:%=-M%)
77
78#
79# Message catalog
80#
81POFILES= $(STTYOBJ:sttyobjs/%.o=%.po)
82POFILE= ttymon.po
83
84
85LIBSAFD= $(ROOTLIB)/saf
86DIRS= $(LIBSAFD)
87LIBSAF= ttymon
88USRSBINF= sttydefs ttyadm
89BINF= stty
90ROOTLIBF= $(LIBSAF:%=$(LIBSAFD)/%)
91ROOTUSRSBINF= $(USRSBINF:%=$(ROOTUSRSBIN)/%)
92ROOTBINF= $(BINF:%=$(ROOTBIN)/%)
93$(ROOTLIBF) :=			FILEMODE =	0555
94$(ROOTUSRSBINF) :=		FILEMODE =	0755
95$(ROOTUSRSBINF) $(ROOTLIBF) :=	OWNER =		root
96$(ROOTUSRSBINF) $(ROOTLIBF) :=	GROUP =		sys
97
98$(LIBSAFD)/% : %
99	$(INS.file)
100
101# /usr/xpg6/bin/stty is a symlink to /usr/bin/stty
102ROOTXPG6SYMLINK= $(ROOTXPG6BIN)/stty
103.KEEP_STATE:
104
105all: $(PROG) $(XPG4)
106
107stty:	sttyobjs $(STTYOBJ) $(MAPFILE.NGB)
108	$(LINK.c) $(STTYOBJ) -o $@ $(LDLIBS)
109	$(POST_PROCESS)
110
111stty.xpg4: $(XPG4STTYOBJ) $(MAPFILE.NGB)
112	$(LINK.c) $(XPG4STTYOBJ) -o $@ $(LDLIBS)
113	$(POST_PROCESS)
114
115$(XPG4STTYOBJ): sttyobjs.xpg4
116
117sttyobjs/%.o:	%.c
118	$(COMPILE.c) -o $@ $<
119
120sttyobjs.xpg4/%.o:	%.c
121	$(COMPILE.c) -o $@ $<
122
123sttyobjs:
124	-@mkdir -p $@
125
126sttyobjs.xpg4:
127	-@mkdir -p $@
128
129ttymon:	$(TTYMONOBJ) $(MAPFILE.NGB)
130	$(LINK.c) $(TTYMONOBJ) -o $@ $(LDLIBS) -lpam
131	$(POST_PROCESS)
132
133ttyadm:	$(TTYADMOBJ) $(MAPFILE.NGB)
134	$(LINK.c) $(TTYADMOBJ) -o $@ $(LDLIBS)
135	$(POST_PROCESS)
136
137sttydefs: $(STTYDEFSOBJ) $(MAPFILE.NGB)
138	$(LINK.c) $(STTYDEFSOBJ) -o $@ $(LDLIBS)
139	$(POST_PROCESS)
140
141install: all $(DIRS) $(ROOTLIBF) $(ROOTUSRSBINF) $(ROOTBINF) \
142	$(ROOTXPG4PROG) $(ROOTXPG6SYMLINK)
143	-$(RM) $(ROOTETC)/getty
144	-$(SYMLINK) ../usr/lib/saf/ttymon $(ROOTETC)/getty
145
146$(ROOTXPG6SYMLINK): $(ROOTBINF)
147	-$(RM) $@
148	-$(SYMLINK) ../../bin/$(BINF) $@
149
150$(POFILE):      $(POFILES)
151	$(RM) $@
152	cat $(POFILES)  > $@
153
154$(DIRS):
155	$(INS.dir)
156
157clean:
158	$(RM) $(OBJS)
159
160lint:
161	$(LINT.c) $(STTYSRC)
162	$(LINT.c) $(TTYMONSRC)
163	$(LINT.c) $(TTYADMSRC)
164	$(LINT.c) $(STTYDEFSSRC)
165
166include ../Makefile.targ
167