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