xref: /illumos-gate/usr/src/cmd/ttymon/Makefile (revision 3bb2c156)
17c478bd9Sstevel@tonic-gate#
27c478bd9Sstevel@tonic-gate# CDDL HEADER START
37c478bd9Sstevel@tonic-gate#
47c478bd9Sstevel@tonic-gate# The contents of this file are subject to the terms of the
5d1c1c8ceScf# Common Development and Distribution License (the "License").
6d1c1c8ceScf# You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate#
87c478bd9Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate# See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate# and limitations under the License.
127c478bd9Sstevel@tonic-gate#
137c478bd9Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate#
197c478bd9Sstevel@tonic-gate# CDDL HEADER END
207c478bd9Sstevel@tonic-gate#
2124da5b34Srie
227c478bd9Sstevel@tonic-gate#
2324fe0b3bSjmcp# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
247c478bd9Sstevel@tonic-gate# Use is subject to license terms.
257c478bd9Sstevel@tonic-gate#
265661bb76SJohn Levon# Copyright (c) 2018, Joyent, Inc.
277c478bd9Sstevel@tonic-gate
287c478bd9Sstevel@tonic-gatePROG= stty ttymon ttyadm sttydefs
297c478bd9Sstevel@tonic-gateXPG4PROG= stty
307c478bd9Sstevel@tonic-gate
317c478bd9Sstevel@tonic-gate# the 'stty' objects have to be made in a separate directory
327c478bd9Sstevel@tonic-gate# since only they are built with the -DEUC flag (see below).
337c478bd9Sstevel@tonic-gateSTTYOBJ=	sttyobjs/stty.o sttyobjs/sttytable.o sttyobjs/sttyparse.o
347c478bd9Sstevel@tonic-gate
357c478bd9Sstevel@tonic-gateXPG4STTYOBJ=	sttyobjs.xpg4/stty.o sttyobjs.xpg4/sttytable.o \
367c478bd9Sstevel@tonic-gate		sttyobjs.xpg4/sttyparse.o
377c478bd9Sstevel@tonic-gate
387c478bd9Sstevel@tonic-gateTTYMONOBJ=	ttymon.o tmglobal.o tmhandler.o tmpmtab.o tmttydefs.o \
397c478bd9Sstevel@tonic-gate		tmparse.o tmsig.o tmsac.o tmchild.o tmautobaud.o tmterm.o \
407c478bd9Sstevel@tonic-gate		tmutmp.o tmpeek.o tmlog.o tmlock.o tmutil.o tmexpress.o \
417c478bd9Sstevel@tonic-gate		sttytable.o sttyparse.o ulockf.o
427c478bd9Sstevel@tonic-gate
4385f4cb87SRichard LoweTTYADMOBJ=	ttyadm.o tmutil.o admutil.o
447c478bd9Sstevel@tonic-gate
457c478bd9Sstevel@tonic-gateSTTYDEFSOBJ=	sttydefs.o admutil.o tmttydefs.o tmparse.o sttytable.o \
46*3bb2c156SToomas Soome		sttyparse.o tmglobal.o
477c478bd9Sstevel@tonic-gate
487c478bd9Sstevel@tonic-gateOBJS= $(STTYOBJ) $(XPG4STTYOBJ) $(TTYMONOBJ) $(TTYADMOBJ) $(STTYDEFSOBJ)
497c478bd9Sstevel@tonic-gateSTTYSRC= stty.c sttytable.c sttyparse.c
507c478bd9Sstevel@tonic-gateTTYMONSRC= $(TTYMONOBJ:%.o=%.c)
517c478bd9Sstevel@tonic-gateTTYADMSRC= $(TTYADMOBJ:%.o=%.c)
527c478bd9Sstevel@tonic-gateSTTYDEFSSRC= $(STTYDEFSOBJ:%.o=%.c)
537c478bd9Sstevel@tonic-gateSRCS= $(STTYSRC) $(TTYMONSRC) $(TTYADMSRC) $(STTYDEFSSRC)
547c478bd9Sstevel@tonic-gate
557c478bd9Sstevel@tonic-gate.PARALLEL:	$(OBJS) $(PROG)
567c478bd9Sstevel@tonic-gate
577c478bd9Sstevel@tonic-gateinclude ../Makefile.cmd
587c478bd9Sstevel@tonic-gate
5985f4cb87SRichard Lowe# If machine name and /etc/issue file need to be printed
607c478bd9Sstevel@tonic-gate# before the service prompt is printed, then:  CPPFLAGS += -DSYS_NAME
617c478bd9Sstevel@tonic-gate# If debug is needed, then:  CPPFLAGS += -DDEBUG
627c478bd9Sstevel@tonic-gate# fix for 1111333 - turn on SYS_NAME so /etc/issue will be read if it exists
637c478bd9Sstevel@tonic-gateCPPFLAGS += -DSYS_NAME
647c478bd9Sstevel@tonic-gate$(XPG4):= CPPFLAGS += -DXPG4
657c478bd9Sstevel@tonic-gatesttydefs := LDLIBS += -lnsl
66fa9e4066Sahrensttymon := LDLIBS += -lnsl -lsec -ldevinfo
677c478bd9Sstevel@tonic-gate
687c478bd9Sstevel@tonic-gate# Only stty can be built with -DEUC.  ttymon will dump core unless further
697c478bd9Sstevel@tonic-gate# changes are made to it.
707c478bd9Sstevel@tonic-gate$(STTYOBJ) := CPPFLAGS += -DEUC
717c478bd9Sstevel@tonic-gate$(XPG4STTYOBJ) := CPPFLAGS += -DEUC
727c478bd9Sstevel@tonic-gate
737c478bd9Sstevel@tonic-gateCFLAGS += $(CCVERBOSE)
7485f4cb87SRichard LoweLDFLAGS += $(MAPFILE.NGB:%=-Wl,-M%)
757c478bd9Sstevel@tonic-gate
767c478bd9Sstevel@tonic-gate#
777c478bd9Sstevel@tonic-gate# Message catalog
787c478bd9Sstevel@tonic-gate#
797c478bd9Sstevel@tonic-gatePOFILES= $(STTYOBJ:sttyobjs/%.o=%.po)
807c478bd9Sstevel@tonic-gatePOFILE= ttymon.po
817c478bd9Sstevel@tonic-gate
827c478bd9Sstevel@tonic-gate
837c478bd9Sstevel@tonic-gateLIBSAFD= $(ROOTLIB)/saf
847c478bd9Sstevel@tonic-gateDIRS= $(LIBSAFD)
857c478bd9Sstevel@tonic-gateLIBSAF= ttymon
867c478bd9Sstevel@tonic-gateUSRSBINF= sttydefs ttyadm
877c478bd9Sstevel@tonic-gateBINF= stty
887c478bd9Sstevel@tonic-gateROOTLIBF= $(LIBSAF:%=$(LIBSAFD)/%)
897c478bd9Sstevel@tonic-gateROOTUSRSBINF= $(USRSBINF:%=$(ROOTUSRSBIN)/%)
907c478bd9Sstevel@tonic-gateROOTBINF= $(BINF:%=$(ROOTBIN)/%)
917c478bd9Sstevel@tonic-gate$(ROOTLIBF) :=			FILEMODE =	0555
927c478bd9Sstevel@tonic-gate$(ROOTUSRSBINF) :=		FILEMODE =	0755
937c478bd9Sstevel@tonic-gate
947c478bd9Sstevel@tonic-gate$(LIBSAFD)/% : %
957c478bd9Sstevel@tonic-gate	$(INS.file)
967c478bd9Sstevel@tonic-gate
97d1c1c8ceScf# /usr/xpg6/bin/stty is a symlink to /usr/bin/stty
98d1c1c8ceScfROOTXPG6SYMLINK= $(ROOTXPG6BIN)/stty
997c478bd9Sstevel@tonic-gate.KEEP_STATE:
1007c478bd9Sstevel@tonic-gate
1017c478bd9Sstevel@tonic-gateall: $(PROG) $(XPG4)
1027c478bd9Sstevel@tonic-gate
10324da5b34Sriestty:	sttyobjs $(STTYOBJ) $(MAPFILE.NGB)
1047c478bd9Sstevel@tonic-gate	$(LINK.c) $(STTYOBJ) -o $@ $(LDLIBS)
1057c478bd9Sstevel@tonic-gate	$(POST_PROCESS)
1067c478bd9Sstevel@tonic-gate
10724da5b34Sriestty.xpg4: $(XPG4STTYOBJ) $(MAPFILE.NGB)
1087c478bd9Sstevel@tonic-gate	$(LINK.c) $(XPG4STTYOBJ) -o $@ $(LDLIBS)
1097c478bd9Sstevel@tonic-gate	$(POST_PROCESS)
1107c478bd9Sstevel@tonic-gate
1117c478bd9Sstevel@tonic-gate$(XPG4STTYOBJ): sttyobjs.xpg4
1127c478bd9Sstevel@tonic-gate
1137c478bd9Sstevel@tonic-gatesttyobjs/%.o:	%.c
1147c478bd9Sstevel@tonic-gate	$(COMPILE.c) -o $@ $<
1157c478bd9Sstevel@tonic-gate
1167c478bd9Sstevel@tonic-gatesttyobjs.xpg4/%.o:	%.c
1177c478bd9Sstevel@tonic-gate	$(COMPILE.c) -o $@ $<
1187c478bd9Sstevel@tonic-gate
1197c478bd9Sstevel@tonic-gatesttyobjs:
1207c478bd9Sstevel@tonic-gate	-@mkdir -p $@
1217c478bd9Sstevel@tonic-gate
1227c478bd9Sstevel@tonic-gatesttyobjs.xpg4:
1237c478bd9Sstevel@tonic-gate	-@mkdir -p $@
1247c478bd9Sstevel@tonic-gate
12524da5b34Sriettymon:	$(TTYMONOBJ) $(MAPFILE.NGB)
1267c478bd9Sstevel@tonic-gate	$(LINK.c) $(TTYMONOBJ) -o $@ $(LDLIBS) -lpam
1277c478bd9Sstevel@tonic-gate	$(POST_PROCESS)
1287c478bd9Sstevel@tonic-gate
12924da5b34Sriettyadm:	$(TTYADMOBJ) $(MAPFILE.NGB)
1307c478bd9Sstevel@tonic-gate	$(LINK.c) $(TTYADMOBJ) -o $@ $(LDLIBS)
1317c478bd9Sstevel@tonic-gate	$(POST_PROCESS)
1327c478bd9Sstevel@tonic-gate
13324da5b34Sriesttydefs: $(STTYDEFSOBJ) $(MAPFILE.NGB)
1347c478bd9Sstevel@tonic-gate	$(LINK.c) $(STTYDEFSOBJ) -o $@ $(LDLIBS)
1357c478bd9Sstevel@tonic-gate	$(POST_PROCESS)
1367c478bd9Sstevel@tonic-gate
1377c478bd9Sstevel@tonic-gateinstall: all $(DIRS) $(ROOTLIBF) $(ROOTUSRSBINF) $(ROOTBINF) \
138d1c1c8ceScf	$(ROOTXPG4PROG) $(ROOTXPG6SYMLINK)
1397c478bd9Sstevel@tonic-gate	-$(RM) $(ROOTETC)/getty
1407c478bd9Sstevel@tonic-gate	-$(SYMLINK) ../usr/lib/saf/ttymon $(ROOTETC)/getty
1417c478bd9Sstevel@tonic-gate
142d1c1c8ceScf$(ROOTXPG6SYMLINK): $(ROOTBINF)
1437c478bd9Sstevel@tonic-gate	-$(RM) $@
144d1c1c8ceScf	-$(SYMLINK) ../../bin/$(BINF) $@
1457c478bd9Sstevel@tonic-gate
1467c478bd9Sstevel@tonic-gate$(POFILE):      $(POFILES)
1477c478bd9Sstevel@tonic-gate	$(RM) $@
1487c478bd9Sstevel@tonic-gate	cat $(POFILES)  > $@
1497c478bd9Sstevel@tonic-gate
1507c478bd9Sstevel@tonic-gate$(DIRS):
1517c478bd9Sstevel@tonic-gate	$(INS.dir)
1527c478bd9Sstevel@tonic-gate
1537c478bd9Sstevel@tonic-gateclean:
1547c478bd9Sstevel@tonic-gate	$(RM) $(OBJS)
1557c478bd9Sstevel@tonic-gate
1567c478bd9Sstevel@tonic-gateinclude ../Makefile.targ
157