xref: /illumos-gate/usr/src/cmd/mdb/Makefile.kmdb.targ (revision b8052df9f609edb713f6828c9eecc3d7be19dfb3)
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# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
23# Use is subject to license terms.
24#
25# Copyright 2019 Joyent, Inc.
26#
27
28ROOTTERMINFO = $(ROOTSHLIB)/terminfo
29
30$(PROG).core: $(OBJS) $(KMDBLIBS) $(MAPFILE)
31	$(LD) -r $(BREDUCE) $(ZNOVERSION) $(ZDEFS) -Wl,-M$(MAPFILE) -o $@ $(OBJS) \
32	    $(KMDBLIBS)
33
34$(PROG): $(PROG).core $(KCTLOBJS)
35	$(LD) -ztype=kmod -o $@ $@.core -Nmisc/ctf $(KCTLOBJS)
36	$(CTFMERGE) -l "$(UTS_LABEL)" -o $@ $(OBJS) $(KCTLOBJS)
37	$(POST_PROCESS)
38	$(SETDYNFLAG) -f DF_1_IGNMULDEF,DF_1_NOKSYMS $@
39
40clean:
41	$(RM) $(OBJS) $(KCTLOBJS) $(PROG).core $(MAPFILE)
42	$(RM) $(MAPFILE_INTERMEDIATE)
43	$(RM) kmdb_terminfo.c kmdb_modlinktest.c kmdb_modlinktest.o
44	$(RM) kaif_off.h kmdb_context_off.h
45	$(RM) mdb_lex.c mdb_grammar.c mdb_grammar.h y.tab.h y.tab.c y.output
46
47clobber: clean
48	$(RM) $(PROG)
49
50dmods:
51
52#
53# Specialized object construction
54#
55kmdb_terminfo.c:	../../../common/mdb/mdb_termio.c \
56			../../../common/kmdb/kmdb_terminfo_skel.c \
57			$(ROOTTERMINFO)
58	TERMINFO=$(ROOTTERMINFO) $(TIGEN) -s \
59	    ../../../common/kmdb/kmdb_terminfo_skel.c \
60	    -t ../../../common/mdb/mdb_termio.c \
61	    $(SUPPORTED_TERMS) > $@
62
63$(MAPFILE_INTERMEDIATE): $(MAPFILE_SOURCES) $(MAPFILE_TEMPLATE)
64	$(HDR2MAP) -t $(MAPFILE_TEMPLATE) $(MAPFILE_SOURCES) >$@
65
66$(MAPFILE): $(MAPFILE_INTERMEDIATE)
67	$(CPP) -P $(SACPPFLAGS) <$(MAPFILE_INTERMEDIATE) >$@
68
69mdb_lex.c: ../../../common/mdb/mdb_lex.l mdb_grammar.h
70	$(LEX) $(LFLAGS) ../../../common/mdb/mdb_lex.l > $@
71
72mdb_grammar.h mdb_grammar.c: ../../../common/mdb/mdb_grammar.y
73	$(YACC) $(YFLAGS) ../../../common/mdb/mdb_grammar.y
74	@$(MV) y.tab.h mdb_grammar.h
75	@$(MV) y.tab.c mdb_grammar.c
76
77#
78# These should really be combined into a dynamic rule, but there's a bug in
79# dmake that'll cause it to get confused about dependencies if we do.
80#
81
82kaif_off.h := CPPFLAGS += $(SACPPCFLAGS)
83
84kmdb_modlinktest.c: $(MAPFILE_INTERMEDIATE)
85	$(MAP2LINKTEST) <$(MAPFILE_INTERMEDIATE) >$@
86	$(CPP) -P $(SACPPFLAGS) <$(MAPFILE_INTERMEDIATE) >$(MAPFILE)
87
88#
89# Dynamic rules for object construction
90#
91%.o: ../../../common/kmdb/%.c
92	$(COMPILE.c) -o $@ $<
93	$(CTFCONVERT_O)
94
95%.o: ../../../common/kmdb/kctl/%.c
96	$(COMPILE.c) -o $@ $<
97	$(CTFCONVERT_O)
98
99%.o: ../../../common/kmdb/kctl/%.s
100	$(COMPILE.s) -o $@ $<
101
102%.o: ../../../common/mdb/%.c
103	$(COMPILE.c) -o $@ $<
104	$(CTFCONVERT_O)
105
106%.o: ../../kmdb/%.c
107	$(COMPILE.c) -o $@ $<
108	$(CTFCONVERT_O)
109
110%.o: ../../kmdb/%.s
111	$(COMPILE.s) -o $@ $<
112
113%.o: ../../kmdb/kctl/%.c
114	$(COMPILE.c) -o $@ $<
115	$(CTFCONVERT_O)
116
117%.o: ../../kmdb/kctl/%.s
118	$(COMPILE.s) -o $@ $<
119
120%.o: ../../mdb/%.c
121	$(COMPILE.c) -o $@ $<
122	$(CTFCONVERT_O)
123
124%.o: %.c
125	$(COMPILE.c) -o $@ $<
126	$(CTFCONVERT_O)
127
128%.o: %.s
129	$(COMPILE.s) -o $@ $<
130
131%.o: kctl/%.s
132	$(COMPILE.s) -o $@ $<
133
134%.o: $(SRC)/common/net/util/%.c
135	$(COMPILE.c) $<
136	$(CTFCONVERT_O)
137
138%.o: $(SRC)/common/util/%.c
139	$(COMPILE.c) $<
140	$(CTFCONVERT_O)
141