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)
51
52#
53# We cannot currently use the stack protector in the kmdb standalone
54# environment.
55#
56STACKPROTECT = none
57
58#
59# kmdb is a kernel module, so we'll use the kernel's build flags.
60CFLAGS64 += $(STAND_FLAGS_64)
61
62LDFLAGS = $(ZNOVERSION) $(BREDUCE) -Wl,-M$(MAPFILE) -r
63
64LIB = libstandctf.so
65OBJS = $(CTF_COMMON_SRCS:%.c=%.o) $(CTF_STUB_SRCS:%.c=%.o)
66
67CERRWARN += $(CNOWARN_UNINIT)
68
69.NO_PARALLEL:
70.PARALLEL: $(OBJS)
71
72install all: $(LIB)
73
74$(LIB): $(OBJS) $(MAPFILE)
75	$(LD) $(LDFLAGS) -o $@ $(OBJS)
76
77clobber clean:
78	$(RM) $(LIB) $(OBJS)
79
80#
81# Dynamic rules for object construction
82#
83
84%.o: ../../../common/libstandctf/%.c
85	$(COMPILE.c) $<
86	$(CTFCONVERT_O)
87
88%.o: $(SRC)/common/ctf/%.c
89	$(COMPILE.c) $<
90	$(CTFCONVERT_O)
91