xref: /illumos-gate/usr/src/cmd/mdb/Makefile.libstandctf (revision b12258b69ac245658b0ca5ae070b3ff004186148)
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 2018 Joyent, Inc.
26#
27
28.KEEP_STATE:
29
30CTF_COMMON_SRCS = \
31	ctf_create.c \
32	ctf_decl.c \
33	ctf_error.c \
34	ctf_hash.c \
35	ctf_labels.c \
36	ctf_lookup.c \
37	ctf_open.c \
38	ctf_types.c \
39	ctf_util.c
40
41CTF_STUB_SRCS = \
42	ctf_subr.c
43
44MAPFILE = ../../../common/libstandctf/mapfile
45
46$(NOT_RELEASE_BUILD)CPPFLAGS += -DDEBUG
47CPPFLAGS += -I$(SRC)/common/ctf -I../../../common -DCTF_OLD_VERSIONS -D_MDB \
48    -Dvsnprintf=ctf_vsnprintf -Dassfail=kmdb_prom_assfail
49
50CSTD = $(CSTD_GNU99)
51C99LMODE = -Xc99=%all
52
53#
54# kmdb is a kernel module, so we'll use the kernel's build flags.
55CFLAGS64 += $(STAND_FLAGS_64)
56
57LDFLAGS = $(ZNOVERSION) $(BREDUCE) -M $(MAPFILE) -dy -r
58
59LIB = libstandctf.so
60OBJS = $(CTF_COMMON_SRCS:%.c=%.o) $(CTF_STUB_SRCS:%.c=%.o)
61LINTFILES = $(OBJS:%.o=%.ln)
62
63LINTFLAGS += -n -errtags=yes
64
65CERRWARN += $(CNOWARN_UNINIT)
66
67.NO_PARALLEL:
68.PARALLEL: $(OBJS)
69
70install all: $(LIB)
71
72$(LIB): $(OBJS) $(MAPFILE)
73	$(LD) $(LDFLAGS) -o $@ $(OBJS)
74
75clobber clean:
76	$(RM) $(LIB) $(OBJS) $(LINTFILES)
77
78lint: $(LINTFILES)
79	$(LINT) $(LINTFLAGS) $(LINTFILES)
80
81#
82# Dynamic rules for object construction
83#
84
85%.o: ../../../common/libstandctf/%.c
86	$(COMPILE.c) $<
87	$(CTFCONVERT_O)
88
89%.o: $(SRC)/common/ctf/%.c
90	$(COMPILE.c) $<
91	$(CTFCONVERT_O)
92
93#
94# Lint
95#
96
97%.ln: ../../../common/libstandctf/%.c
98	$(LINT.c) -c $<
99
100%.ln: $(SRC)/common/ctf/%.c
101	$(LINT.c) -c $<
102