xref: /illumos-gate/usr/src/cmd/ttymon/Makefile (revision cb6207858a9fcc2feaee22e626912fba281ac969)
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# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
23# Use is subject to license terms.
24#
25# ident	"%Z%%M%	%I%	%E% SMI"
26#
27
28PROG= stty ttymon ttyadm sttydefs
29XPG4PROG= stty
30
31# the 'stty' objects have to be made in a separate directory
32# since only they are built with the -DEUC flag (see below).
33STTYOBJ=	sttyobjs/stty.o sttyobjs/sttytable.o sttyobjs/sttyparse.o
34
35XPG4STTYOBJ=	sttyobjs.xpg4/stty.o sttyobjs.xpg4/sttytable.o \
36		sttyobjs.xpg4/sttyparse.o
37
38TTYMONOBJ=	ttymon.o tmglobal.o tmhandler.o tmpmtab.o tmttydefs.o \
39		tmparse.o tmsig.o tmsac.o tmchild.o tmautobaud.o tmterm.o \
40		tmutmp.o tmpeek.o tmlog.o tmlock.o tmutil.o tmexpress.o \
41		sttytable.o sttyparse.o ulockf.o
42
43TTYADMOBJ=	ttyadm.o tmutil.o admutil.o
44
45STTYDEFSOBJ=	sttydefs.o admutil.o tmttydefs.o tmparse.o sttytable.o \
46		sttyparse.o
47
48OBJS= $(STTYOBJ) $(XPG4STTYOBJ) $(TTYMONOBJ) $(TTYADMOBJ) $(STTYDEFSOBJ)
49STTYSRC= stty.c sttytable.c sttyparse.c
50TTYMONSRC= $(TTYMONOBJ:%.o=%.c)
51TTYADMSRC= $(TTYADMOBJ:%.o=%.c)
52STTYDEFSSRC= $(STTYDEFSOBJ:%.o=%.c)
53SRCS= $(STTYSRC) $(TTYMONSRC) $(TTYADMSRC) $(STTYDEFSSRC)
54
55.PARALLEL:	$(OBJS) $(PROG)
56
57include ../Makefile.cmd
58
59# If machine name and /etc/issue file need to be printed
60# before the service prompt is printed, then:  CPPFLAGS += -DSYS_NAME
61# If debug is needed, then:  CPPFLAGS += -DDEBUG
62# fix for 1111333 - turn on SYS_NAME so /etc/issue will be read if it exists
63CPPFLAGS += -DSYS_NAME
64$(XPG4):= CPPFLAGS += -DXPG4
65sttydefs := LDLIBS += -lnsl
66ttymon := LDLIBS += -lnsl -lsec -ldevinfo
67
68# Only stty can be built with -DEUC.  ttymon will dump core unless further
69# changes are made to it.
70$(STTYOBJ) := CPPFLAGS += -DEUC
71$(XPG4STTYOBJ) := CPPFLAGS += -DEUC
72
73LINTFLAGS = -b -x
74CFLAGS += $(CCVERBOSE)
75
76#
77# Message catalog
78#
79POFILES= $(STTYOBJ:sttyobjs/%.o=%.po)
80POFILE= ttymon.po
81
82
83LIBSAFD= $(ROOTLIB)/saf
84DIRS= $(LIBSAFD)
85LIBSAF= ttymon
86USRSBINF= sttydefs ttyadm
87BINF= stty
88ROOTLIBF= $(LIBSAF:%=$(LIBSAFD)/%)
89ROOTUSRSBINF= $(USRSBINF:%=$(ROOTUSRSBIN)/%)
90ROOTBINF= $(BINF:%=$(ROOTBIN)/%)
91$(ROOTLIBF) :=			FILEMODE =	0555
92$(ROOTUSRSBINF) :=		FILEMODE =	0755
93$(ROOTUSRSBINF) $(ROOTLIBF) :=	OWNER =		root
94$(ROOTUSRSBINF) $(ROOTLIBF) :=	GROUP =		sys
95
96$(LIBSAFD)/% : %
97	$(INS.file)
98
99# /usr/xpg6/bin/stty is a symlink to /usr/bin/stty
100ROOTXPG6SYMLINK= $(ROOTXPG6BIN)/stty
101.KEEP_STATE:
102
103all: $(PROG) $(XPG4)
104
105stty:	sttyobjs $(STTYOBJ)
106	$(LINK.c) $(STTYOBJ) -o $@ $(LDLIBS)
107	$(POST_PROCESS)
108
109stty.xpg4: $(XPG4STTYOBJ)
110	$(LINK.c) $(XPG4STTYOBJ) -o $@ $(LDLIBS)
111	$(POST_PROCESS)
112
113$(XPG4STTYOBJ): sttyobjs.xpg4
114
115sttyobjs/%.o:	%.c
116	$(COMPILE.c) -o $@ $<
117
118sttyobjs.xpg4/%.o:	%.c
119	$(COMPILE.c) -o $@ $<
120
121sttyobjs:
122	-@mkdir -p $@
123
124sttyobjs.xpg4:
125	-@mkdir -p $@
126
127ttymon:	$(TTYMONOBJ)
128	$(LINK.c) $(TTYMONOBJ) -o $@ $(LDLIBS) -lpam
129	$(POST_PROCESS)
130
131ttyadm:	$(TTYADMOBJ)
132	$(LINK.c) $(TTYADMOBJ) -o $@ $(LDLIBS)
133	$(POST_PROCESS)
134
135sttydefs: $(STTYDEFSOBJ)
136	$(LINK.c) $(STTYDEFSOBJ) -o $@ $(LDLIBS)
137	$(POST_PROCESS)
138
139install: all $(DIRS) $(ROOTLIBF) $(ROOTUSRSBINF) $(ROOTBINF) \
140	$(ROOTXPG4PROG) $(ROOTXPG6SYMLINK)
141	-$(RM) $(ROOTETC)/getty
142	-$(SYMLINK) ../usr/lib/saf/ttymon $(ROOTETC)/getty
143
144$(ROOTXPG6SYMLINK): $(ROOTBINF)
145	-$(RM) $@
146	-$(SYMLINK) ../../bin/$(BINF) $@
147
148$(POFILE):      $(POFILES)
149	$(RM) $@
150	cat $(POFILES)  > $@
151
152$(DIRS):
153	$(INS.dir)
154
155clean:
156	$(RM) $(OBJS)
157
158lint:
159	$(LINT.c) $(STTYSRC)
160	$(LINT.c) $(TTYMONSRC)
161	$(LINT.c) $(TTYADMSRC)
162	$(LINT.c) $(STTYDEFSSRC)
163
164include ../Makefile.targ
165