xref: /illumos-gate/usr/src/cmd/ttymon/Makefile (revision 5661bb76)
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#
26*5661bb76SJohn 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
437c478bd9Sstevel@tonic-gateTTYADMOBJ=	ttyadm.o tmutil.o admutil.o
447c478bd9Sstevel@tonic-gate
457c478bd9Sstevel@tonic-gateSTTYDEFSOBJ=	sttydefs.o admutil.o tmttydefs.o tmparse.o sttytable.o \
467c478bd9Sstevel@tonic-gate		sttyparse.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
597c478bd9Sstevel@tonic-gate# 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-gateLINTFLAGS = -b -x
747c478bd9Sstevel@tonic-gateCFLAGS += $(CCVERBOSE)
7524da5b34SrieLDFLAGS += $(MAPFILE.NGB:%=-M%)
767c478bd9Sstevel@tonic-gate
777014882cSRichard LoweCERRWARN +=	-_gcc=-Wno-parentheses
787014882cSRichard LoweCERRWARN +=	-_gcc=-Wno-unused-variable
797014882cSRichard LoweCERRWARN +=	-_gcc=-Wno-uninitialized
807014882cSRichard LoweCERRWARN +=	-_gcc=-Wno-extra
817014882cSRichard Lowe
82*5661bb76SJohn Levon# not linted
83*5661bb76SJohn LevonSMATCH=off
84*5661bb76SJohn Levon
857c478bd9Sstevel@tonic-gate#
867c478bd9Sstevel@tonic-gate# Message catalog
877c478bd9Sstevel@tonic-gate#
887c478bd9Sstevel@tonic-gatePOFILES= $(STTYOBJ:sttyobjs/%.o=%.po)
897c478bd9Sstevel@tonic-gatePOFILE= ttymon.po
907c478bd9Sstevel@tonic-gate
917c478bd9Sstevel@tonic-gate
927c478bd9Sstevel@tonic-gateLIBSAFD= $(ROOTLIB)/saf
937c478bd9Sstevel@tonic-gateDIRS= $(LIBSAFD)
947c478bd9Sstevel@tonic-gateLIBSAF= ttymon
957c478bd9Sstevel@tonic-gateUSRSBINF= sttydefs ttyadm
967c478bd9Sstevel@tonic-gateBINF= stty
977c478bd9Sstevel@tonic-gateROOTLIBF= $(LIBSAF:%=$(LIBSAFD)/%)
987c478bd9Sstevel@tonic-gateROOTUSRSBINF= $(USRSBINF:%=$(ROOTUSRSBIN)/%)
997c478bd9Sstevel@tonic-gateROOTBINF= $(BINF:%=$(ROOTBIN)/%)
1007c478bd9Sstevel@tonic-gate$(ROOTLIBF) :=			FILEMODE =	0555
1017c478bd9Sstevel@tonic-gate$(ROOTUSRSBINF) :=		FILEMODE =	0755
1027c478bd9Sstevel@tonic-gate
1037c478bd9Sstevel@tonic-gate$(LIBSAFD)/% : %
1047c478bd9Sstevel@tonic-gate	$(INS.file)
1057c478bd9Sstevel@tonic-gate
106d1c1c8ceScf# /usr/xpg6/bin/stty is a symlink to /usr/bin/stty
107d1c1c8ceScfROOTXPG6SYMLINK= $(ROOTXPG6BIN)/stty
1087c478bd9Sstevel@tonic-gate.KEEP_STATE:
1097c478bd9Sstevel@tonic-gate
1107c478bd9Sstevel@tonic-gateall: $(PROG) $(XPG4)
1117c478bd9Sstevel@tonic-gate
11224da5b34Sriestty:	sttyobjs $(STTYOBJ) $(MAPFILE.NGB)
1137c478bd9Sstevel@tonic-gate	$(LINK.c) $(STTYOBJ) -o $@ $(LDLIBS)
1147c478bd9Sstevel@tonic-gate	$(POST_PROCESS)
1157c478bd9Sstevel@tonic-gate
11624da5b34Sriestty.xpg4: $(XPG4STTYOBJ) $(MAPFILE.NGB)
1177c478bd9Sstevel@tonic-gate	$(LINK.c) $(XPG4STTYOBJ) -o $@ $(LDLIBS)
1187c478bd9Sstevel@tonic-gate	$(POST_PROCESS)
1197c478bd9Sstevel@tonic-gate
1207c478bd9Sstevel@tonic-gate$(XPG4STTYOBJ): sttyobjs.xpg4
1217c478bd9Sstevel@tonic-gate
1227c478bd9Sstevel@tonic-gatesttyobjs/%.o:	%.c
1237c478bd9Sstevel@tonic-gate	$(COMPILE.c) -o $@ $<
1247c478bd9Sstevel@tonic-gate
1257c478bd9Sstevel@tonic-gatesttyobjs.xpg4/%.o:	%.c
1267c478bd9Sstevel@tonic-gate	$(COMPILE.c) -o $@ $<
1277c478bd9Sstevel@tonic-gate
1287c478bd9Sstevel@tonic-gatesttyobjs:
1297c478bd9Sstevel@tonic-gate	-@mkdir -p $@
1307c478bd9Sstevel@tonic-gate
1317c478bd9Sstevel@tonic-gatesttyobjs.xpg4:
1327c478bd9Sstevel@tonic-gate	-@mkdir -p $@
1337c478bd9Sstevel@tonic-gate
13424da5b34Sriettymon:	$(TTYMONOBJ) $(MAPFILE.NGB)
1357c478bd9Sstevel@tonic-gate	$(LINK.c) $(TTYMONOBJ) -o $@ $(LDLIBS) -lpam
1367c478bd9Sstevel@tonic-gate	$(POST_PROCESS)
1377c478bd9Sstevel@tonic-gate
13824da5b34Sriettyadm:	$(TTYADMOBJ) $(MAPFILE.NGB)
1397c478bd9Sstevel@tonic-gate	$(LINK.c) $(TTYADMOBJ) -o $@ $(LDLIBS)
1407c478bd9Sstevel@tonic-gate	$(POST_PROCESS)
1417c478bd9Sstevel@tonic-gate
14224da5b34Sriesttydefs: $(STTYDEFSOBJ) $(MAPFILE.NGB)
1437c478bd9Sstevel@tonic-gate	$(LINK.c) $(STTYDEFSOBJ) -o $@ $(LDLIBS)
1447c478bd9Sstevel@tonic-gate	$(POST_PROCESS)
1457c478bd9Sstevel@tonic-gate
1467c478bd9Sstevel@tonic-gateinstall: all $(DIRS) $(ROOTLIBF) $(ROOTUSRSBINF) $(ROOTBINF) \
147d1c1c8ceScf	$(ROOTXPG4PROG) $(ROOTXPG6SYMLINK)
1487c478bd9Sstevel@tonic-gate	-$(RM) $(ROOTETC)/getty
1497c478bd9Sstevel@tonic-gate	-$(SYMLINK) ../usr/lib/saf/ttymon $(ROOTETC)/getty
1507c478bd9Sstevel@tonic-gate
151d1c1c8ceScf$(ROOTXPG6SYMLINK): $(ROOTBINF)
1527c478bd9Sstevel@tonic-gate	-$(RM) $@
153d1c1c8ceScf	-$(SYMLINK) ../../bin/$(BINF) $@
1547c478bd9Sstevel@tonic-gate
1557c478bd9Sstevel@tonic-gate$(POFILE):      $(POFILES)
1567c478bd9Sstevel@tonic-gate	$(RM) $@
1577c478bd9Sstevel@tonic-gate	cat $(POFILES)  > $@
1587c478bd9Sstevel@tonic-gate
1597c478bd9Sstevel@tonic-gate$(DIRS):
1607c478bd9Sstevel@tonic-gate	$(INS.dir)
1617c478bd9Sstevel@tonic-gate
1627c478bd9Sstevel@tonic-gateclean:
1637c478bd9Sstevel@tonic-gate	$(RM) $(OBJS)
1647c478bd9Sstevel@tonic-gate
1657c478bd9Sstevel@tonic-gatelint:
1667c478bd9Sstevel@tonic-gate	$(LINT.c) $(STTYSRC)
1677c478bd9Sstevel@tonic-gate	$(LINT.c) $(TTYMONSRC)
1687c478bd9Sstevel@tonic-gate	$(LINT.c) $(TTYADMSRC)
1697c478bd9Sstevel@tonic-gate	$(LINT.c) $(STTYDEFSSRC)
1707c478bd9Sstevel@tonic-gate
1717c478bd9Sstevel@tonic-gateinclude ../Makefile.targ
172