xref: /illumos-gate/usr/src/cmd/mdb/Makefile.kmdb.targ (revision e43afc9605f99023dbdb4a7b5309de87e6016db6)
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# Copyright 2019 Joyent, Inc.
26#
27
28ROOTTERMINFO = $(ROOTSHLIB)/terminfo
29
30$(PROG).core: $(OBJS) $(KMDBLIBS) $(MAPFILE)
31	$(LD) -r $(BREDUCE) $(ZNOVERSION) $(ZDEFS) -Wl,-M$(MAPFILE) -o $@ $(OBJS) \
32	    $(KMDBLIBS)
33
34$(PROG): $(PROG).core $(KCTLOBJS)
35	$(LD) -dy -r -o $@ $@.core -Nmisc/ctf $(KCTLOBJS)
36	$(CTFMERGE) -l "$(UTS_LABEL)" -o $@ $(OBJS) $(KCTLOBJS)
37	$(KMDB_FPTEST)
38	$(POST_PROCESS)
39	$(SETDYNFLAG) -f DF_1_IGNMULDEF,DF_1_NOKSYMS $@
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
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