xref: /titanic_41/usr/src/cmd/mdb/Makefile.kmdb.targ (revision 7206bf49b1fe641544165ee97f63856da95e0868)
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
26ROOTTERMINFO = $(ROOTSHLIB)/terminfo
27
28$(PROG).core: $(OBJS) $(KMDBLIBS) $(MAPFILE)
29	$(LD) -r $(BREDUCE) $(ZNOVERSION) $(ZDEFS) -M$(MAPFILE) -o $@ $(OBJS) \
30	    $(KMDBLIBS)
31
32$(PROG): $(PROG).core $(KCTLOBJS)
33	$(LD) -dy -r -o $@ $@.core -Nmisc/ctf $(KCTLOBJS)
34	$(CTFMERGE) -L VERSION -o $@ $(OBJS) $(KCTLOBJS)
35	$(KMDB_FPTEST)
36	$(POST_PROCESS)
37	$(SETDYNFLAG) -f DF_1_IGNMULDEF,DF_1_NOKSYMS $@
38
39clean.lint:
40	$(RM) $(ALLLINTFILES)
41
42clean:
43	$(RM) $(OBJS) $(KCTLOBJS) $(PROG).core $(MAPFILE)
44	$(RM) $(MAPFILE_INTERMEDIATE)
45	$(RM) kmdb_terminfo.c kmdb_modlinktest.c kmdb_modlinktest.o
46	$(RM) kaif_off.h kmdb_context_off.h
47	$(RM) mdb_lex.c mdb_grammar.c mdb_grammar.h y.tab.h y.tab.c y.output
48
49clobber: clean clean.lint
50	$(RM) $(PROG)
51
52dmods:
53
54#
55# Specialized object construction
56#
57kmdb_terminfo.c: 	../../../common/mdb/mdb_termio.c \
58			../../../common/kmdb/kmdb_terminfo_skel.c \
59			$(ROOTTERMINFO)
60	TERMINFO=$(ROOTTERMINFO) $(TIGEN) -s \
61	    ../../../common/kmdb/kmdb_terminfo_skel.c \
62	    -t ../../../common/mdb/mdb_termio.c \
63	    $(SUPPORTED_TERMS) > $@
64
65$(MAPFILE_INTERMEDIATE): $(MAPFILE_SOURCES) $(MAPFILE_TEMPLATE)
66	$(HDR2MAP) -t $(MAPFILE_TEMPLATE) $(MAPFILE_SOURCES) >$@
67
68$(MAPFILE): $(MAPFILE_INTERMEDIATE)
69	$(CPP) -P $(SACPPFLAGS) <$(MAPFILE_INTERMEDIATE) >$@
70
71mdb_lex.c: ../../../common/mdb/mdb_lex.l mdb_grammar.h
72	$(LEX) $(LFLAGS) ../../../common/mdb/mdb_lex.l > $@
73
74mdb_grammar.h mdb_grammar.c: ../../../common/mdb/mdb_grammar.y
75	$(YACC) $(YFLAGS) ../../../common/mdb/mdb_grammar.y
76	@$(MV) y.tab.h mdb_grammar.h
77	@$(MV) y.tab.c mdb_grammar.c
78
79#
80# These should really be combined into a dynamic rule, but there's a bug in
81# dmake that'll cause it to get confused about dependencies if we do.
82#
83
84kaif_off.h := CPPFLAGS += $(SACPPCFLAGS)
85
86kmdb_modlinktest.c: $(MAPFILE_INTERMEDIATE)
87	$(MAP2LINKTEST) <$(MAPFILE_INTERMEDIATE) >$@
88	$(CPP) -P $(SACPPFLAGS) <$(MAPFILE_INTERMEDIATE) >$(MAPFILE)
89
90#
91# Dynamic rules for object construction
92#
93%.o: ../../../common/kmdb/%.c
94	$(COMPILE.c) -o $@ $<
95	$(CTFCONVERT_O)
96
97%.o: ../../../common/kmdb/kctl/%.c
98	$(COMPILE.c) -o $@ $<
99	$(CTFCONVERT_O)
100
101%.o: ../../../common/kmdb/kctl/%.s
102	$(COMPILE.s) -o $@ $<
103
104%.o: ../../../common/mdb/%.c
105	$(COMPILE.c) -o $@ $<
106	$(CTFCONVERT_O)
107
108%.o: ../../kmdb/%.c
109	$(COMPILE.c) -o $@ $<
110	$(CTFCONVERT_O)
111
112%.o: ../../kmdb/%.s
113	$(COMPILE.s) -o $@ $<
114
115%.o: ../../kmdb/kctl/%.c
116	$(COMPILE.c) -o $@ $<
117	$(CTFCONVERT_O)
118
119%.o: ../../kmdb/kctl/%.s
120	$(COMPILE.s) -o $@ $<
121
122%.o: ../../mdb/%.c
123	$(COMPILE.c) -o $@ $<
124	$(CTFCONVERT_O)
125
126%.o: %.c
127	$(COMPILE.c) -o $@ $<
128	$(CTFCONVERT_O)
129
130%.o: %.s
131	$(COMPILE.s) -o $@ $<
132
133%.o: kctl/%.s
134	$(COMPILE.s) -o $@ $<
135
136%.o: $(SRC)/common/net/util/%.c
137	$(COMPILE.c) $<
138	$(CTFCONVERT_O)
139
140%.o: $(SRC)/common/util/%.c
141	$(COMPILE.c) $<
142	$(CTFCONVERT_O)
143
144#
145# Lint
146#
147
148%.ln: ../../../common/kmdb/%.c
149	$(LINT.c) -c $<
150
151%.ln: ../../../common/kmdb/kctl/%.c
152	$(LINT.c) -c $<
153
154%.ln: ../../../common/kmdb/kctl/%.s
155	$(LINT.s) -c $<
156
157%.ln: ../../../common/mdb/%.c
158	$(LINT.c) -c $<
159
160%.ln: ../../kmdb/%.c
161	$(LINT.c) -c $<
162
163%.ln: ../../kmdb/%.s
164	$(LINT.s) -c $<
165
166%.ln: ../../kmdb/kctl/%.c
167	$(LINT.c) -c $<
168
169%.ln: ../../kmdb/kctl/%.s
170	$(LINT.s) -c $<
171
172%.ln: ../../mdb/%.c
173	$(LINT.c) -c $<
174
175%.ln: %.c
176	$(LINT.c) -c $<
177
178%.ln: %.s
179	$(LINT.s) -c $<
180
181%.ln: kctl/%.s
182	$(LINT.s) -c $<
183
184%.ln: $(SRC)/common/net/util/%.c
185	$(LINT.c) -c $<
186
187%.ln: $(SRC)/common/util/%.c
188	$(LINT.c) -c $<
189