17c478bdstevel@tonic-gate#
27c478bdstevel@tonic-gate# CDDL HEADER START
37c478bdstevel@tonic-gate#
47c478bdstevel@tonic-gate# The contents of this file are subject to the terms of the
5b272bdapetede# Common Development and Distribution License (the "License").
6b272bdapetede# You may not use this file except in compliance with the License.
77c478bdstevel@tonic-gate#
87c478bdstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bdstevel@tonic-gate# or http://www.opensolaris.org/os/licensing.
107c478bdstevel@tonic-gate# See the License for the specific language governing permissions
117c478bdstevel@tonic-gate# and limitations under the License.
127c478bdstevel@tonic-gate#
137c478bdstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each
147c478bdstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bdstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the
167c478bdstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying
177c478bdstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner]
187c478bdstevel@tonic-gate#
197c478bdstevel@tonic-gate# CDDL HEADER END
207c478bdstevel@tonic-gate#
217c478bdstevel@tonic-gate#
2224da5b3rie# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
237c478bdstevel@tonic-gate# Use is subject to license terms.
247c478bdstevel@tonic-gate#
2506abc74John Levon# Copyright 2019 Joyent, Inc.
2606abc74John Levon#
27170832dAlbert Lee
28170832dAlbert LeeROOTTERMINFO = $(ROOTSHLIB)/terminfo
297c478bdstevel@tonic-gate
307c478bdstevel@tonic-gate$(PROG).core: $(OBJS) $(KMDBLIBS) $(MAPFILE)
3124da5b3rie	$(LD) -r $(BREDUCE) $(ZNOVERSION) $(ZDEFS) -M$(MAPFILE) -o $@ $(OBJS) \
327c478bdstevel@tonic-gate	    $(KMDBLIBS)
337c478bdstevel@tonic-gate
347c478bdstevel@tonic-gate$(PROG): $(PROG).core $(KCTLOBJS)
357c478bdstevel@tonic-gate	$(LD) -dy -r -o $@ $@.core -Nmisc/ctf $(KCTLOBJS)
3606abc74John Levon	$(CTFMERGE) -l "$(UTS_LABEL)" -o $@ $(OBJS) $(KCTLOBJS)
377c478bdstevel@tonic-gate	$(KMDB_FPTEST)
386ddb337Richard Lowe	$(POST_PROCESS)
397c478bdstevel@tonic-gate	$(SETDYNFLAG) -f DF_1_IGNMULDEF,DF_1_NOKSYMS $@
407c478bdstevel@tonic-gate
417c478bdstevel@tonic-gateclean.lint:
427c478bdstevel@tonic-gate	$(RM) $(ALLLINTFILES)
437c478bdstevel@tonic-gate
447c478bdstevel@tonic-gateclean:
457c478bdstevel@tonic-gate	$(RM) $(OBJS) $(KCTLOBJS) $(PROG).core $(MAPFILE)
46b272bdapetede	$(RM) $(MAPFILE_INTERMEDIATE)
477c478bdstevel@tonic-gate	$(RM) kmdb_terminfo.c kmdb_modlinktest.c kmdb_modlinktest.o
487c478bdstevel@tonic-gate	$(RM) kaif_off.h kmdb_context_off.h
497c478bdstevel@tonic-gate	$(RM) mdb_lex.c mdb_grammar.c mdb_grammar.h y.tab.h y.tab.c y.output
507c478bdstevel@tonic-gate
517c478bdstevel@tonic-gateclobber: clean clean.lint
527c478bdstevel@tonic-gate	$(RM) $(PROG)
537c478bdstevel@tonic-gate
547c478bdstevel@tonic-gatedmods:
557c478bdstevel@tonic-gate
567c478bdstevel@tonic-gate#
577c478bdstevel@tonic-gate# Specialized object construction
587c478bdstevel@tonic-gate#
5906abc74John Levonkmdb_terminfo.c:	../../../common/mdb/mdb_termio.c \
60170832dAlbert Lee			../../../common/kmdb/kmdb_terminfo_skel.c \
61170832dAlbert Lee			$(ROOTTERMINFO)
62170832dAlbert Lee	TERMINFO=$(ROOTTERMINFO) $(TIGEN) -s \
63170832dAlbert Lee	    ../../../common/kmdb/kmdb_terminfo_skel.c \
647c478bdstevel@tonic-gate	    -t ../../../common/mdb/mdb_termio.c \
657c478bdstevel@tonic-gate	    $(SUPPORTED_TERMS) > $@
667c478bdstevel@tonic-gate
67b272bdapetede$(MAPFILE_INTERMEDIATE): $(MAPFILE_SOURCES) $(MAPFILE_TEMPLATE)
68b272bdapetede	$(HDR2MAP) -t $(MAPFILE_TEMPLATE) $(MAPFILE_SOURCES) >$@
69b272bdapetede
70b272bdapetede$(MAPFILE): $(MAPFILE_INTERMEDIATE)
71b272bdapetede	$(CPP) -P $(SACPPFLAGS) <$(MAPFILE_INTERMEDIATE) >$@
727c478bdstevel@tonic-gate
737c478bdstevel@tonic-gatemdb_lex.c: ../../../common/mdb/mdb_lex.l mdb_grammar.h
747c478bdstevel@tonic-gate	$(LEX) $(LFLAGS) ../../../common/mdb/mdb_lex.l > $@
757c478bdstevel@tonic-gate
767c478bdstevel@tonic-gatemdb_grammar.h mdb_grammar.c: ../../../common/mdb/mdb_grammar.y
777c478bdstevel@tonic-gate	$(YACC) $(YFLAGS) ../../../common/mdb/mdb_grammar.y
787c478bdstevel@tonic-gate	@$(MV) y.tab.h mdb_grammar.h
797c478bdstevel@tonic-gate	@$(MV) y.tab.c mdb_grammar.c
807c478bdstevel@tonic-gate
817c478bdstevel@tonic-gate#
827c478bdstevel@tonic-gate# These should really be combined into a dynamic rule, but there's a bug in
837c478bdstevel@tonic-gate# dmake that'll cause it to get confused about dependencies if we do.
847c478bdstevel@tonic-gate#
857c478bdstevel@tonic-gate
867c478bdstevel@tonic-gatekaif_off.h := CPPFLAGS += $(SACPPCFLAGS)
877c478bdstevel@tonic-gate
88b272bdapetedekmdb_modlinktest.c: $(MAPFILE_INTERMEDIATE)
89b272bdapetede	$(MAP2LINKTEST) <$(MAPFILE_INTERMEDIATE) >$@
90b272bdapetede	$(CPP) -P $(SACPPFLAGS) <$(MAPFILE_INTERMEDIATE) >$(MAPFILE)
917c478bdstevel@tonic-gate
927c478bdstevel@tonic-gate#
937c478bdstevel@tonic-gate# Dynamic rules for object construction
947c478bdstevel@tonic-gate#
957c478bdstevel@tonic-gate%.o: ../../../common/kmdb/%.c
967c478bdstevel@tonic-gate	$(COMPILE.c) -o $@ $<
977c478bdstevel@tonic-gate	$(CTFCONVERT_O)
987c478bdstevel@tonic-gate
997c478bdstevel@tonic-gate%.o: ../../../common/kmdb/kctl/%.c
1007c478bdstevel@tonic-gate	$(COMPILE.c) -o $@ $<
1017c478bdstevel@tonic-gate	$(CTFCONVERT_O)
1027c478bdstevel@tonic-gate
1037c478bdstevel@tonic-gate%.o: ../../../common/kmdb/kctl/%.s
1047c478bdstevel@tonic-gate	$(COMPILE.s) -o $@ $<
1057c478bdstevel@tonic-gate
1067c478bdstevel@tonic-gate%.o: ../../../common/mdb/%.c
1077c478bdstevel@tonic-gate	$(COMPILE.c) -o $@ $<
1087c478bdstevel@tonic-gate	$(CTFCONVERT_O)
1097c478bdstevel@tonic-gate
1107c478bdstevel@tonic-gate%.o: ../../kmdb/%.c
1117c478bdstevel@tonic-gate	$(COMPILE.c) -o $@ $<
1127c478bdstevel@tonic-gate	$(CTFCONVERT_O)
1137c478bdstevel@tonic-gate
1147c478bdstevel@tonic-gate%.o: ../../kmdb/%.s
1157c478bdstevel@tonic-gate	$(COMPILE.s) -o $@ $<
1167c478bdstevel@tonic-gate
1177c478bdstevel@tonic-gate%.o: ../../kmdb/kctl/%.c
1187c478bdstevel@tonic-gate	$(COMPILE.c) -o $@ $<
1197c478bdstevel@tonic-gate	$(CTFCONVERT_O)
1207c478bdstevel@tonic-gate
1217c478bdstevel@tonic-gate%.o: ../../kmdb/kctl/%.s
1227c478bdstevel@tonic-gate	$(COMPILE.s) -o $@ $<
1237c478bdstevel@tonic-gate
1247c478bdstevel@tonic-gate%.o: ../../mdb/%.c
1257c478bdstevel@tonic-gate	$(COMPILE.c) -o $@ $<
1267c478bdstevel@tonic-gate	$(CTFCONVERT_O)
1277c478bdstevel@tonic-gate
1287c478bdstevel@tonic-gate%.o: %.c
1297c478bdstevel@tonic-gate	$(COMPILE.c) -o $@ $<
1307c478bdstevel@tonic-gate	$(CTFCONVERT_O)
1317c478bdstevel@tonic-gate
1327c478bdstevel@tonic-gate%.o: %.s
1337c478bdstevel@tonic-gate	$(COMPILE.s) -o $@ $<
1347c478bdstevel@tonic-gate
1357c478bdstevel@tonic-gate%.o: kctl/%.s
1367c478bdstevel@tonic-gate	$(COMPILE.s) -o $@ $<
1377c478bdstevel@tonic-gate
1387c478bdstevel@tonic-gate%.o: $(SRC)/common/net/util/%.c
1397c478bdstevel@tonic-gate	$(COMPILE.c) $<
1407c478bdstevel@tonic-gate	$(CTFCONVERT_O)
1417c478bdstevel@tonic-gate
14269bb4bbcarlsonj%.o: $(SRC)/common/util/%.c
14369bb4bbcarlsonj	$(COMPILE.c) $<
14469bb4bbcarlsonj	$(CTFCONVERT_O)
14569bb4bbcarlsonj
1467c478bdstevel@tonic-gate#
1477c478bdstevel@tonic-gate# Lint
1487c478bdstevel@tonic-gate#
1497c478bdstevel@tonic-gate
1507c478bdstevel@tonic-gate%.ln: ../../../common/kmdb/%.c
1517c478bdstevel@tonic-gate	$(LINT.c) -c $<
1527c478bdstevel@tonic-gate
1537c478bdstevel@tonic-gate%.ln: ../../../common/kmdb/kctl/%.c
1547c478bdstevel@tonic-gate	$(LINT.c) -c $<
1557c478bdstevel@tonic-gate
1567c478bdstevel@tonic-gate%.ln: ../../../common/kmdb/kctl/%.s
1577c478bdstevel@tonic-gate	$(LINT.s) -c $<
1587c478bdstevel@tonic-gate
1597c478bdstevel@tonic-gate%.ln: ../../../common/mdb/%.c
1607c478bdstevel@tonic-gate	$(LINT.c) -c $<
1617c478bdstevel@tonic-gate
1627c478bdstevel@tonic-gate%.ln: ../../kmdb/%.c
1637c478bdstevel@tonic-gate	$(LINT.c) -c $<
1647c478bdstevel@tonic-gate
1657c478bdstevel@tonic-gate%.ln: ../../kmdb/%.s
1667c478bdstevel@tonic-gate	$(LINT.s) -c $<
1677c478bdstevel@tonic-gate
1687c478bdstevel@tonic-gate%.ln: ../../kmdb/kctl/%.c
1697c478bdstevel@tonic-gate	$(LINT.c) -c $<
1707c478bdstevel@tonic-gate
1717c478bdstevel@tonic-gate%.ln: ../../kmdb/kctl/%.s
1727c478bdstevel@tonic-gate	$(LINT.s) -c $<
1737c478bdstevel@tonic-gate
1747c478bdstevel@tonic-gate%.ln: ../../mdb/%.c
1757c478bdstevel@tonic-gate	$(LINT.c) -c $<
1767c478bdstevel@tonic-gate
1777c478bdstevel@tonic-gate%.ln: %.c
1787c478bdstevel@tonic-gate	$(LINT.c) -c $<
1797c478bdstevel@tonic-gate
1807c478bdstevel@tonic-gate%.ln: %.s
1817c478bdstevel@tonic-gate	$(LINT.s) -c $<
1827c478bdstevel@tonic-gate
1837c478bdstevel@tonic-gate%.ln: kctl/%.s
1847c478bdstevel@tonic-gate	$(LINT.s) -c $<
1857c478bdstevel@tonic-gate
1867c478bdstevel@tonic-gate%.ln: $(SRC)/common/net/util/%.c
1877c478bdstevel@tonic-gate	$(LINT.c) -c $<
18869bb4bbcarlsonj
18969bb4bbcarlsonj%.ln: $(SRC)/common/util/%.c
19069bb4bbcarlsonj	$(LINT.c) -c $<
191