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