xref: /illumos-gate/usr/src/cmd/mdb/Makefile.libstandctf (revision 2cbc828d66d6088914f685ae0e77169ecc9fc7f9)
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# We cannot currently use the stack protector in the kmdb standalone
55# environment.
56#
57STACKPROTECT = none
58
59#
60# kmdb is a kernel module, so we'll use the kernel's build flags.
61CFLAGS64 += $(STAND_FLAGS_64)
62
63LDFLAGS = $(ZNOVERSION) $(BREDUCE) -Wl,-M$(MAPFILE) -dy -r
64
65LIB = libstandctf.so
66OBJS = $(CTF_COMMON_SRCS:%.c=%.o) $(CTF_STUB_SRCS:%.c=%.o)
67
68CERRWARN += $(CNOWARN_UNINIT)
69
70.NO_PARALLEL:
71.PARALLEL: $(OBJS)
72
73install all: $(LIB)
74
75$(LIB): $(OBJS) $(MAPFILE)
76	$(LD) $(LDFLAGS) -o $@ $(OBJS)
77
78clobber clean:
79	$(RM) $(LIB) $(OBJS)
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