xref: /titanic_51/usr/src/cmd/ttymon/Makefile (revision fb9f9b975cb9214fec5dab37d461199adab9b964)
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, Version 1.0 only
6# (the "License").  You may not use this file except in compliance
7# with the License.
8#
9# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10# or http://www.opensolaris.org/os/licensing.
11# See the License for the specific language governing permissions
12# and limitations under the License.
13#
14# When distributing Covered Code, include this CDDL HEADER in each
15# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16# If applicable, add the following below this CDDL HEADER, with the
17# fields enclosed by brackets "[]" replaced with your own identifying
18# information: Portions Copyright [yyyy] [name of copyright owner]
19#
20# CDDL HEADER END
21#
22#
23# Copyright 2005 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)
76
77#
78# Message catalog
79#
80POFILES= $(STTYOBJ:sttyobjs/%.o=%.po)
81POFILE= ttymon.po
82
83
84LIBSAFD= $(ROOTLIB)/saf
85DIRS= $(LIBSAFD)
86LIBSAF= ttymon
87USRSBINF= sttydefs ttyadm
88BINF= stty
89ROOTLIBF= $(LIBSAF:%=$(LIBSAFD)/%)
90ROOTUSRSBINF= $(USRSBINF:%=$(ROOTUSRSBIN)/%)
91ROOTBINF= $(BINF:%=$(ROOTBIN)/%)
92$(ROOTLIBF) :=			FILEMODE =	0555
93$(ROOTUSRSBINF) :=		FILEMODE =	0755
94$(ROOTUSRSBINF) $(ROOTLIBF) :=	OWNER =		root
95$(ROOTUSRSBINF) $(ROOTLIBF) :=	GROUP =		sys
96
97$(LIBSAFD)/% : %
98	$(INS.file)
99
100# /usr/xpg6/bin/stty is a hard link to /usr/bin/stty
101ROOTXPG6LINK= $(ROOTXPG6BIN)/stty
102.KEEP_STATE:
103
104all: $(PROG) $(XPG4)
105
106stty:	sttyobjs $(STTYOBJ)
107	$(LINK.c) $(STTYOBJ) -o $@ $(LDLIBS)
108	$(POST_PROCESS)
109
110stty.xpg4: $(XPG4STTYOBJ)
111	$(LINK.c) $(XPG4STTYOBJ) -o $@ $(LDLIBS)
112	$(POST_PROCESS)
113
114$(XPG4STTYOBJ): sttyobjs.xpg4
115
116sttyobjs/%.o:	%.c
117	$(COMPILE.c) -o $@ $<
118
119sttyobjs.xpg4/%.o:	%.c
120	$(COMPILE.c) -o $@ $<
121
122sttyobjs:
123	-@mkdir -p $@
124
125sttyobjs.xpg4:
126	-@mkdir -p $@
127
128ttymon:	$(TTYMONOBJ)
129	$(LINK.c) $(TTYMONOBJ) -o $@ $(LDLIBS) -lpam
130	$(POST_PROCESS)
131
132ttyadm:	$(TTYADMOBJ)
133	$(LINK.c) $(TTYADMOBJ) -o $@ $(LDLIBS)
134	$(POST_PROCESS)
135
136sttydefs: $(STTYDEFSOBJ)
137	$(LINK.c) $(STTYDEFSOBJ) -o $@ $(LDLIBS)
138	$(POST_PROCESS)
139
140install: all $(DIRS) $(ROOTLIBF) $(ROOTUSRSBINF) $(ROOTBINF) \
141	$(ROOTXPG4PROG) $(ROOTXPG6LINK)
142	-$(RM) $(ROOTETC)/getty
143	-$(SYMLINK) ../usr/lib/saf/ttymon $(ROOTETC)/getty
144
145$(ROOTXPG6LINK): $(ROOTBINF)
146	-$(RM) $@
147	-$(LN) -f $(ROOTBINF) $@
148
149$(POFILE):      $(POFILES)
150	$(RM) $@
151	cat $(POFILES)  > $@
152
153$(DIRS):
154	$(INS.dir)
155
156clean:
157	$(RM) $(OBJS)
158
159lint:
160	$(LINT.c) $(STTYSRC)
161	$(LINT.c) $(TTYMONSRC)
162	$(LINT.c) $(TTYADMSRC)
163	$(LINT.c) $(STTYDEFSSRC)
164
165include ../Makefile.targ
166