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
5b272bda5Spetede# Common Development and Distribution License (the "License").
6b272bda5Spetede# 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#
217c478bd9Sstevel@tonic-gate#
2224da5b34Srie# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
237c478bd9Sstevel@tonic-gate# Use is subject to license terms.
247c478bd9Sstevel@tonic-gate#
2506abc743SJohn Levon# Copyright 2019 Joyent, Inc.
2606abc743SJohn Levon#
27170832d3SAlbert Lee
28170832d3SAlbert LeeROOTTERMINFO = $(ROOTSHLIB)/terminfo
297c478bd9Sstevel@tonic-gate
307c478bd9Sstevel@tonic-gate$(PROG).core: $(OBJS) $(KMDBLIBS) $(MAPFILE)
3185f4cb87SRichard Lowe	$(LD) -r $(BREDUCE) $(ZNOVERSION) $(ZDEFS) -Wl,-M$(MAPFILE) -o $@ $(OBJS) \
327c478bd9Sstevel@tonic-gate	    $(KMDBLIBS)
337c478bd9Sstevel@tonic-gate
347c478bd9Sstevel@tonic-gate$(PROG): $(PROG).core $(KCTLOBJS)
3582d0151aSRichard Lowe	$(LD) -ztype=kmod -o $@ $@.core -Nmisc/ctf $(KCTLOBJS)
3606abc743SJohn Levon	$(CTFMERGE) -l "$(UTS_LABEL)" -o $@ $(OBJS) $(KCTLOBJS)
376ddb3373SRichard Lowe	$(POST_PROCESS)
387c478bd9Sstevel@tonic-gate	$(SETDYNFLAG) -f DF_1_IGNMULDEF,DF_1_NOKSYMS $@
397c478bd9Sstevel@tonic-gate
407c478bd9Sstevel@tonic-gateclean:
417c478bd9Sstevel@tonic-gate	$(RM) $(OBJS) $(KCTLOBJS) $(PROG).core $(MAPFILE)
42b272bda5Spetede	$(RM) $(MAPFILE_INTERMEDIATE)
437c478bd9Sstevel@tonic-gate	$(RM) kmdb_terminfo.c kmdb_modlinktest.c kmdb_modlinktest.o
447c478bd9Sstevel@tonic-gate	$(RM) kaif_off.h kmdb_context_off.h
457c478bd9Sstevel@tonic-gate	$(RM) mdb_lex.c mdb_grammar.c mdb_grammar.h y.tab.h y.tab.c y.output
467c478bd9Sstevel@tonic-gate
4785f4cb87SRichard Loweclobber: clean
487c478bd9Sstevel@tonic-gate	$(RM) $(PROG)
497c478bd9Sstevel@tonic-gate
507c478bd9Sstevel@tonic-gatedmods:
517c478bd9Sstevel@tonic-gate
527c478bd9Sstevel@tonic-gate#
537c478bd9Sstevel@tonic-gate# Specialized object construction
547c478bd9Sstevel@tonic-gate#
5506abc743SJohn Levonkmdb_terminfo.c:	../../../common/mdb/mdb_termio.c \
56170832d3SAlbert Lee			../../../common/kmdb/kmdb_terminfo_skel.c \
57170832d3SAlbert Lee			$(ROOTTERMINFO)
58170832d3SAlbert Lee	TERMINFO=$(ROOTTERMINFO) $(TIGEN) -s \
59170832d3SAlbert Lee	    ../../../common/kmdb/kmdb_terminfo_skel.c \
607c478bd9Sstevel@tonic-gate	    -t ../../../common/mdb/mdb_termio.c \
617c478bd9Sstevel@tonic-gate	    $(SUPPORTED_TERMS) > $@
627c478bd9Sstevel@tonic-gate
63b272bda5Spetede$(MAPFILE_INTERMEDIATE): $(MAPFILE_SOURCES) $(MAPFILE_TEMPLATE)
64b272bda5Spetede	$(HDR2MAP) -t $(MAPFILE_TEMPLATE) $(MAPFILE_SOURCES) >$@
65b272bda5Spetede
66b272bda5Spetede$(MAPFILE): $(MAPFILE_INTERMEDIATE)
67b272bda5Spetede	$(CPP) -P $(SACPPFLAGS) <$(MAPFILE_INTERMEDIATE) >$@
687c478bd9Sstevel@tonic-gate
697c478bd9Sstevel@tonic-gatemdb_lex.c: ../../../common/mdb/mdb_lex.l mdb_grammar.h
707c478bd9Sstevel@tonic-gate	$(LEX) $(LFLAGS) ../../../common/mdb/mdb_lex.l > $@
717c478bd9Sstevel@tonic-gate
727c478bd9Sstevel@tonic-gatemdb_grammar.h mdb_grammar.c: ../../../common/mdb/mdb_grammar.y
737c478bd9Sstevel@tonic-gate	$(YACC) $(YFLAGS) ../../../common/mdb/mdb_grammar.y
747c478bd9Sstevel@tonic-gate	@$(MV) y.tab.h mdb_grammar.h
757c478bd9Sstevel@tonic-gate	@$(MV) y.tab.c mdb_grammar.c
767c478bd9Sstevel@tonic-gate
777c478bd9Sstevel@tonic-gate#
787c478bd9Sstevel@tonic-gate# These should really be combined into a dynamic rule, but there's a bug in
797c478bd9Sstevel@tonic-gate# dmake that'll cause it to get confused about dependencies if we do.
807c478bd9Sstevel@tonic-gate#
817c478bd9Sstevel@tonic-gate
827c478bd9Sstevel@tonic-gatekaif_off.h := CPPFLAGS += $(SACPPCFLAGS)
837c478bd9Sstevel@tonic-gate
84b272bda5Spetedekmdb_modlinktest.c: $(MAPFILE_INTERMEDIATE)
85b272bda5Spetede	$(MAP2LINKTEST) <$(MAPFILE_INTERMEDIATE) >$@
86b272bda5Spetede	$(CPP) -P $(SACPPFLAGS) <$(MAPFILE_INTERMEDIATE) >$(MAPFILE)
877c478bd9Sstevel@tonic-gate
887c478bd9Sstevel@tonic-gate#
897c478bd9Sstevel@tonic-gate# Dynamic rules for object construction
907c478bd9Sstevel@tonic-gate#
917c478bd9Sstevel@tonic-gate%.o: ../../../common/kmdb/%.c
927c478bd9Sstevel@tonic-gate	$(COMPILE.c) -o $@ $<
937c478bd9Sstevel@tonic-gate	$(CTFCONVERT_O)
947c478bd9Sstevel@tonic-gate
957c478bd9Sstevel@tonic-gate%.o: ../../../common/kmdb/kctl/%.c
967c478bd9Sstevel@tonic-gate	$(COMPILE.c) -o $@ $<
977c478bd9Sstevel@tonic-gate	$(CTFCONVERT_O)
987c478bd9Sstevel@tonic-gate
99*5d9d9091SRichard Lowe%.o: ../../../common/kmdb/kctl/%.S
1007c478bd9Sstevel@tonic-gate	$(COMPILE.s) -o $@ $<
1017c478bd9Sstevel@tonic-gate
1027c478bd9Sstevel@tonic-gate%.o: ../../../common/mdb/%.c
1037c478bd9Sstevel@tonic-gate	$(COMPILE.c) -o $@ $<
1047c478bd9Sstevel@tonic-gate	$(CTFCONVERT_O)
1057c478bd9Sstevel@tonic-gate
1067c478bd9Sstevel@tonic-gate%.o: ../../kmdb/%.c
1077c478bd9Sstevel@tonic-gate	$(COMPILE.c) -o $@ $<
1087c478bd9Sstevel@tonic-gate	$(CTFCONVERT_O)
1097c478bd9Sstevel@tonic-gate
110*5d9d9091SRichard Lowe%.o: ../../kmdb/%.S
1117c478bd9Sstevel@tonic-gate	$(COMPILE.s) -o $@ $<
1127c478bd9Sstevel@tonic-gate
1137c478bd9Sstevel@tonic-gate%.o: ../../kmdb/kctl/%.c
1147c478bd9Sstevel@tonic-gate	$(COMPILE.c) -o $@ $<
1157c478bd9Sstevel@tonic-gate	$(CTFCONVERT_O)
1167c478bd9Sstevel@tonic-gate
117*5d9d9091SRichard Lowe%.o: ../../kmdb/kctl/%.S
1187c478bd9Sstevel@tonic-gate	$(COMPILE.s) -o $@ $<
1197c478bd9Sstevel@tonic-gate
1207c478bd9Sstevel@tonic-gate%.o: ../../mdb/%.c
1217c478bd9Sstevel@tonic-gate	$(COMPILE.c) -o $@ $<
1227c478bd9Sstevel@tonic-gate	$(CTFCONVERT_O)
1237c478bd9Sstevel@tonic-gate
1247c478bd9Sstevel@tonic-gate%.o: %.c
1257c478bd9Sstevel@tonic-gate	$(COMPILE.c) -o $@ $<
1267c478bd9Sstevel@tonic-gate	$(CTFCONVERT_O)
1277c478bd9Sstevel@tonic-gate
128*5d9d9091SRichard Lowe%.o: %.S
1297c478bd9Sstevel@tonic-gate	$(COMPILE.s) -o $@ $<
1307c478bd9Sstevel@tonic-gate
131*5d9d9091SRichard Lowe%.o: kctl/%.S
1327c478bd9Sstevel@tonic-gate	$(COMPILE.s) -o $@ $<
1337c478bd9Sstevel@tonic-gate
1347c478bd9Sstevel@tonic-gate%.o: $(SRC)/common/net/util/%.c
1357c478bd9Sstevel@tonic-gate	$(COMPILE.c) $<
1367c478bd9Sstevel@tonic-gate	$(CTFCONVERT_O)
1377c478bd9Sstevel@tonic-gate
13869bb4bb4Scarlsonj%.o: $(SRC)/common/util/%.c
13969bb4bb4Scarlsonj	$(COMPILE.c) $<
14069bb4bb4Scarlsonj	$(CTFCONVERT_O)
141