xref: /titanic_41/usr/src/cmd/mdb/Makefile.kmdb.targ (revision f841f6ad96ea6675d6c6b35c749eaac601799fdf)
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 2006 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#
138# Lint
139#
140
141%.ln: ../../../common/kmdb/%.c
142	$(LINT.c) -c $<
143
144%.ln: ../../../common/kmdb/kctl/%.c
145	$(LINT.c) -c $<
146
147%.ln: ../../../common/kmdb/kctl/%.s
148	$(LINT.s) -c $<
149
150%.ln: ../../../common/mdb/%.c
151	$(LINT.c) -c $<
152
153%.ln: ../../kmdb/%.c
154	$(LINT.c) -c $<
155
156%.ln: ../../kmdb/%.s
157	$(LINT.s) -c $<
158
159%.ln: ../../kmdb/kctl/%.c
160	$(LINT.c) -c $<
161
162%.ln: ../../kmdb/kctl/%.s
163	$(LINT.s) -c $<
164
165%.ln: ../../mdb/%.c
166	$(LINT.c) -c $<
167
168%.ln: %.c
169	$(LINT.c) -c $<
170
171%.ln: %.s
172	$(LINT.s) -c $<
173
174%.ln: kctl/%.s
175	$(LINT.s) -c $<
176
177%.ln: $(SRC)/common/net/util/%.c
178	$(LINT.c) -c $<
179