xref: /illumos-gate/usr/src/cmd/mdb/Makefile.kmdb.targ (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
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, Version 1.0 only
6# (the "License").  You may not use this file except in compliance
7# with the License.
8#
9# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10# or http://www.opensolaris.org/os/licensing.
11# See the License for the specific language governing permissions
12# and limitations under the License.
13#
14# When distributing Covered Code, include this CDDL HEADER in each
15# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16# If applicable, add the following below this CDDL HEADER, with the
17# fields enclosed by brackets "[]" replaced with your own identifying
18# information: Portions Copyright [yyyy] [name of copyright owner]
19#
20# CDDL HEADER END
21#
22#
23# Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
24# Use is subject to license terms.
25#
26#ident	"%Z%%M%	%I%	%E% SMI"
27#
28
29$(PROG).core: $(OBJS) $(KMDBLIBS) $(MAPFILE)
30	$(LD) -r -Breduce -znoversion -zdefs -M$(MAPFILE) -o $@ $(OBJS) \
31	    $(KMDBLIBS)
32
33$(PROG): $(PROG).core $(KCTLOBJS)
34	$(LD) -dy -r -o $@ $@.core -Nmisc/ctf $(KCTLOBJS)
35	$(CTFMERGE) -L VERSION -o $@ $(OBJS) $(KCTLOBJS)
36	$(KMDB_FPTEST)
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) 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): $(MAPFILE_SOURCES) $(MAPFILE_TEMPLATE)
63	$(HDR2MAP) -t $(MAPFILE_TEMPLATE) $(MAPFILE_SOURCES) >$@.i
64	$(CPP) -P $(SACPPFLAGS) <$@.i >$@
65	$(RM) $@.i
66
67mdb_lex.c: ../../../common/mdb/mdb_lex.l mdb_grammar.h
68	$(LEX) $(LFLAGS) ../../../common/mdb/mdb_lex.l > $@
69
70mdb_grammar.h mdb_grammar.c: ../../../common/mdb/mdb_grammar.y
71	$(YACC) $(YFLAGS) ../../../common/mdb/mdb_grammar.y
72	@$(MV) y.tab.h mdb_grammar.h
73	@$(MV) y.tab.c mdb_grammar.c
74
75#
76# These should really be combined into a dynamic rule, but there's a bug in
77# dmake that'll cause it to get confused about dependencies if we do.
78#
79
80kaif_off.h := CPPFLAGS += $(SACPPCFLAGS)
81
82kmdb_modlinktest.c: $(MAPFILE)
83	$(MAP2LINKTEST) <$(MAPFILE) >$@
84
85#
86# Dynamic rules for object construction
87#
88%.o: ../../../common/kmdb/%.c
89	$(COMPILE.c) -o $@ $<
90	$(CTFCONVERT_O)
91
92%.o: ../../../common/kmdb/kctl/%.c
93	$(COMPILE.c) -o $@ $<
94	$(CTFCONVERT_O)
95
96%.o: ../../../common/kmdb/kctl/%.s
97	$(COMPILE.s) -o $@ $<
98
99%.o: ../../../common/mdb/%.c
100	$(COMPILE.c) -o $@ $<
101	$(CTFCONVERT_O)
102
103%.o: ../../kmdb/%.c
104	$(COMPILE.c) -o $@ $<
105	$(CTFCONVERT_O)
106
107%.o: ../../kmdb/%.s
108	$(COMPILE.s) -o $@ $<
109
110%.o: ../../kmdb/kctl/%.c
111	$(COMPILE.c) -o $@ $<
112	$(CTFCONVERT_O)
113
114%.o: ../../kmdb/kctl/%.s
115	$(COMPILE.s) -o $@ $<
116
117%.o: ../../mdb/%.c
118	$(COMPILE.c) -o $@ $<
119	$(CTFCONVERT_O)
120
121%.o: %.c
122	$(COMPILE.c) -o $@ $<
123	$(CTFCONVERT_O)
124
125%.o: %.s
126	$(COMPILE.s) -o $@ $<
127
128%.o: kctl/%.s
129	$(COMPILE.s) -o $@ $<
130
131%.o: $(SRC)/common/net/util/%.c
132	$(COMPILE.c) $<
133	$(CTFCONVERT_O)
134
135#
136# Lint
137#
138
139%.ln: ../../../common/kmdb/%.c
140	$(LINT.c) -c $<
141
142%.ln: ../../../common/kmdb/kctl/%.c
143	$(LINT.c) -c $<
144
145%.ln: ../../../common/kmdb/kctl/%.s
146	$(LINT.s) -c $<
147
148%.ln: ../../../common/mdb/%.c
149	$(LINT.c) -c $<
150
151%.ln: ../../kmdb/%.c
152	$(LINT.c) -c $<
153
154%.ln: ../../kmdb/%.s
155	$(LINT.s) -c $<
156
157%.ln: ../../kmdb/kctl/%.c
158	$(LINT.c) -c $<
159
160%.ln: ../../kmdb/kctl/%.s
161	$(LINT.s) -c $<
162
163%.ln: ../../mdb/%.c
164	$(LINT.c) -c $<
165
166%.ln: %.c
167	$(LINT.c) -c $<
168
169%.ln: %.s
170	$(LINT.s) -c $<
171
172%.ln: kctl/%.s
173	$(LINT.s) -c $<
174
175%.ln: $(SRC)/common/net/util/%.c
176	$(LINT.c) -c $<
177