xref: /illumos-gate/usr/src/cmd/mdb/Makefile.kmdb.targ (revision 24da5b34f49324ed742a340010ed5bd3d4e06625)
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#ident	"%Z%%M%	%I%	%E% SMI"
26#
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	$(TIGEN) -s ../../../common/kmdb/kmdb_terminfo_skel.c \
59	    -t ../../../common/mdb/mdb_termio.c \
60	    $(SUPPORTED_TERMS) > $@
61
62$(MAPFILE_INTERMEDIATE): $(MAPFILE_SOURCES) $(MAPFILE_TEMPLATE)
63	$(HDR2MAP) -t $(MAPFILE_TEMPLATE) $(MAPFILE_SOURCES) >$@
64
65$(MAPFILE): $(MAPFILE_INTERMEDIATE)
66	$(CPP) -P $(SACPPFLAGS) <$(MAPFILE_INTERMEDIATE) >$@
67
68mdb_lex.c: ../../../common/mdb/mdb_lex.l mdb_grammar.h
69	$(LEX) $(LFLAGS) ../../../common/mdb/mdb_lex.l > $@
70
71mdb_grammar.h mdb_grammar.c: ../../../common/mdb/mdb_grammar.y
72	$(YACC) $(YFLAGS) ../../../common/mdb/mdb_grammar.y
73	@$(MV) y.tab.h mdb_grammar.h
74	@$(MV) y.tab.c mdb_grammar.c
75
76#
77# These should really be combined into a dynamic rule, but there's a bug in
78# dmake that'll cause it to get confused about dependencies if we do.
79#
80
81kaif_off.h := CPPFLAGS += $(SACPPCFLAGS)
82
83kmdb_modlinktest.c: $(MAPFILE_INTERMEDIATE)
84	$(MAP2LINKTEST) <$(MAPFILE_INTERMEDIATE) >$@
85	$(CPP) -P $(SACPPFLAGS) <$(MAPFILE_INTERMEDIATE) >$(MAPFILE)
86
87#
88# Dynamic rules for object construction
89#
90%.o: ../../../common/kmdb/%.c
91	$(COMPILE.c) -o $@ $<
92	$(CTFCONVERT_O)
93
94%.o: ../../../common/kmdb/kctl/%.c
95	$(COMPILE.c) -o $@ $<
96	$(CTFCONVERT_O)
97
98%.o: ../../../common/kmdb/kctl/%.s
99	$(COMPILE.s) -o $@ $<
100
101%.o: ../../../common/mdb/%.c
102	$(COMPILE.c) -o $@ $<
103	$(CTFCONVERT_O)
104
105%.o: ../../kmdb/%.c
106	$(COMPILE.c) -o $@ $<
107	$(CTFCONVERT_O)
108
109%.o: ../../kmdb/%.s
110	$(COMPILE.s) -o $@ $<
111
112%.o: ../../kmdb/kctl/%.c
113	$(COMPILE.c) -o $@ $<
114	$(CTFCONVERT_O)
115
116%.o: ../../kmdb/kctl/%.s
117	$(COMPILE.s) -o $@ $<
118
119%.o: ../../mdb/%.c
120	$(COMPILE.c) -o $@ $<
121	$(CTFCONVERT_O)
122
123%.o: %.c
124	$(COMPILE.c) -o $@ $<
125	$(CTFCONVERT_O)
126
127%.o: %.s
128	$(COMPILE.s) -o $@ $<
129
130%.o: kctl/%.s
131	$(COMPILE.s) -o $@ $<
132
133%.o: $(SRC)/common/net/util/%.c
134	$(COMPILE.c) $<
135	$(CTFCONVERT_O)
136
137%.o: $(SRC)/common/util/%.c
138	$(COMPILE.c) $<
139	$(CTFCONVERT_O)
140
141#
142# Lint
143#
144
145%.ln: ../../../common/kmdb/%.c
146	$(LINT.c) -c $<
147
148%.ln: ../../../common/kmdb/kctl/%.c
149	$(LINT.c) -c $<
150
151%.ln: ../../../common/kmdb/kctl/%.s
152	$(LINT.s) -c $<
153
154%.ln: ../../../common/mdb/%.c
155	$(LINT.c) -c $<
156
157%.ln: ../../kmdb/%.c
158	$(LINT.c) -c $<
159
160%.ln: ../../kmdb/%.s
161	$(LINT.s) -c $<
162
163%.ln: ../../kmdb/kctl/%.c
164	$(LINT.c) -c $<
165
166%.ln: ../../kmdb/kctl/%.s
167	$(LINT.s) -c $<
168
169%.ln: ../../mdb/%.c
170	$(LINT.c) -c $<
171
172%.ln: %.c
173	$(LINT.c) -c $<
174
175%.ln: %.s
176	$(LINT.s) -c $<
177
178%.ln: kctl/%.s
179	$(LINT.s) -c $<
180
181%.ln: $(SRC)/common/net/util/%.c
182	$(LINT.c) -c $<
183
184%.ln: $(SRC)/common/util/%.c
185	$(LINT.c) -c $<
186