Makefiles need to specify C99 mode consistently
[unleashed.git] / usr / src / cmd / mdb / Makefile.mdb
blob1be57f3dc3580d2fd732731e39c776df5bb06da3
2 # CDDL HEADER START
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.
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.
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]
19 # CDDL HEADER END
22 # Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
23 # Use is subject to license terms.
27 # Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
28 # Copyright (c) 2012 by Delphix. All rights reserved.
29 # Copyright (c) 2012 Joyent, Inc. All rights reserved.
30 # Copyright 2018 Jason King
33 .KEEP_STATE:
34 .SUFFIXES:
36 SRCS += \
37         ffs.c \
38         mdb.c \
39         mdb_addrvec.c \
40         mdb_argvec.c \
41         mdb_callb.c \
42         mdb_cmdbuf.c \
43         mdb_cmds.c \
44         mdb_conf.c \
45         mdb_context.c \
46         mdb_create.c \
47         mdb_ctf.c \
48         mdb_ctf_open.c \
49         mdb_debug.c \
50         mdb_disasm.c \
51         mdb_dump.c \
52         mdb_err.c \
53         mdb_evset.c \
54         mdb_fdio.c \
55         mdb_fmt.c \
56         mdb_frame.c \
57         mdb_gelf.c \
58         mdb_help.c \
59         mdb_io.c \
60         mdb_kb_kvm.c \
61         mdb_kproc.c \
62         mdb_kvm.c \
63         mdb_logio.c \
64         mdb_list.c \
65         mdb_macalias.c \
66         mdb_main.c \
67         mdb_memio.c \
68         mdb_modapi.c \
69         mdb_module.c \
70         mdb_module_load.c \
71         mdb_nm.c \
72         mdb_nv.c \
73         mdb_pipeio.c \
74         mdb_print.c \
75         mdb_proc.c \
76         mdb_pservice.c \
77         mdb_rawfile.c \
78         mdb_set.c \
79         mdb_shell.c \
80         mdb_signal.c \
81         mdb_stdlib.c \
82         mdb_string.c \
83         mdb_strio.c \
84         mdb_tab.c \
85         mdb_target.c \
86         mdb_tdb.c \
87         mdb_termio.c \
88         mdb_typedef.c \
89         mdb_umem.c \
90         mdb_value.c \
91         mdb_vcb.c \
92         mdb_wcb.c \
93         mdb_whatis.c
95 $(NOT_RELEASE_BUILD)CPPFLAGS += -DDEBUG
96 CPPFLAGS += -D_MDB -I. -I../.. -I../../../common
98 CSTD=   $(CSTD_GNU99)
100 LDLIBS += -lncurses -lkvm -lproc -lrtld_db -lctf -lumem -ldisasm -lscf
101 LDLIBS += -ldemangle-sys
103 CERRWARN += -Wno-uninitialized
104 CERRWARN += -Wno-char-subscripts
105 CERRWARN += -Wno-clobbered
106 CERRWARN += -Wno-parentheses
107 CERRWARN += -Wno-unused-label
108 CERRWARN += -Wno-unused-variable
109 CERRWARN += -Wno-implicit-function-declaration
110 mdb_grammar.o := CERRWARN += -Wno-type-limits
112 PROG = mdb
113 OBJS = $(SRCS:%.c=%.o) mdb_demangle.o mdb_lex.o mdb_grammar.o
115 LINK = adb
116 ROOTLINK = $(ROOTBIN)/$(LINK)
117 ROOTLINK32 = $(LINK:%=$(ROOTBIN32)/%)
118 ROOTLINK64 = $(LINK:%=$(ROOTBIN64)/%)
120 .NO_PARALLEL:
121 .PARALLEL: $(OBJS)
123 all: $(PROG)
125 $(PROG): $(OBJS)
126         $(LINK.c) $(OBJS) -o $@ $(LDLIBS)
127         $(CTFMERGE) -L VERSION -o $@ $(OBJS)
128         $(POST_PROCESS)
130 $(ROOTLINK32): $(ROOTPROG32)
131         $(RM) $@
132         $(LN) $(ROOTPROG32) $@
134 $(ROOTLINK64): $(ROOTPROG64)
135         $(RM) $@
136         $(LN) $(ROOTPROG64) $@
138 mdb_lex.c: ../../../common/mdb/mdb_lex.l mdb_grammar.h
139         $(LEX) $(LFLAGS) ../../../common/mdb/mdb_lex.l > $@
141 mdb_grammar.h mdb_grammar.c: ../../../common/mdb/mdb_grammar.y
142         $(YACC) $(YFLAGS) ../../../common/mdb/mdb_grammar.y
143         @$(MV) y.tab.h mdb_grammar.h
144         @$(MV) y.tab.c mdb_grammar.c
146 mdb_conf.o := CPPFLAGS += -DMDB_VERSION='$(MDB_VERSION)'
148 inet_ntop.o := CPPFLAGS += -Dsnprintf=mdb_snprintf
150 ffs.o ffs.ln := CPPFLAGS += -Dffs=mdb_ffs
152 %.o: ../../../common/mdb/%.c
153         $(COMPILE.c) $<
154         $(CTFCONVERT_O)
156 # cxxabi.h is easiest to get into header search path by just using c++ for the
157 # one object that needs it (mdb_demangle.o), but we need to make sure to avoid
158 # a libstdc++ link-time dependency
159 %.o: ../../../common/mdb/%.cc
160         $(COMPILE.cc) -fno-rtti -fno-exceptions $<
161         $(CTFCONVERT_O)
163 %.o: ../../mdb/%.c
164         $(COMPILE.c) $<
165         $(CTFCONVERT_O)
167 %.o: %.c
168         $(COMPILE.c) $<
169         $(CTFCONVERT_O)
171 %.o: $(SRC)/common/net/util/%.c
172         $(COMPILE.c) $<
173         $(CTFCONVERT_O)
175 %.o: $(SRC)/common/util/%.c
176         $(COMPILE.c) $<
177         $(CTFCONVERT_O)
179 clean:
180         $(RM) $(OBJS)
181         $(RM) mdb_lex.c mdb_grammar.c mdb_grammar.h y.tab.h y.tab.c y.output
183 clobber: clean
184         $(RM) $(PROG)
186 dmods: