17c478bd9Sstevel@tonic-gate#
27c478bd9Sstevel@tonic-gate# CDDL HEADER START
37c478bd9Sstevel@tonic-gate#
47c478bd9Sstevel@tonic-gate# The contents of this file are subject to the terms of the
524da5b34Srie# Common Development and Distribution License (the "License").
624da5b34Srie# You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate#
87c478bd9Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate# See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate# and limitations under the License.
127c478bd9Sstevel@tonic-gate#
137c478bd9Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate#
197c478bd9Sstevel@tonic-gate# CDDL HEADER END
207c478bd9Sstevel@tonic-gate#
217c478bd9Sstevel@tonic-gate#
2224da5b34Srie# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
237c478bd9Sstevel@tonic-gate# Use is subject to license terms.
247c478bd9Sstevel@tonic-gate#
25bc1f688bSRobert Mustacchi# Copyright 2018 Joyent, Inc.
26bc1f688bSRobert Mustacchi#
277c478bd9Sstevel@tonic-gate
287c478bd9Sstevel@tonic-gate.KEEP_STATE:
297c478bd9Sstevel@tonic-gate
307c478bd9Sstevel@tonic-gateCTF_COMMON_SRCS = \
317c478bd9Sstevel@tonic-gate	ctf_create.c \
327c478bd9Sstevel@tonic-gate	ctf_decl.c \
337c478bd9Sstevel@tonic-gate	ctf_error.c \
347c478bd9Sstevel@tonic-gate	ctf_hash.c \
357c478bd9Sstevel@tonic-gate	ctf_labels.c \
367c478bd9Sstevel@tonic-gate	ctf_lookup.c \
377c478bd9Sstevel@tonic-gate	ctf_open.c \
387c478bd9Sstevel@tonic-gate	ctf_types.c \
397c478bd9Sstevel@tonic-gate	ctf_util.c
407c478bd9Sstevel@tonic-gate
417c478bd9Sstevel@tonic-gateCTF_STUB_SRCS = \
427c478bd9Sstevel@tonic-gate	ctf_subr.c
437c478bd9Sstevel@tonic-gate
447c478bd9Sstevel@tonic-gateMAPFILE = ../../../common/libstandctf/mapfile
457c478bd9Sstevel@tonic-gate
467c478bd9Sstevel@tonic-gate$(NOT_RELEASE_BUILD)CPPFLAGS += -DDEBUG
477c478bd9Sstevel@tonic-gateCPPFLAGS += -I$(SRC)/common/ctf -I../../../common -DCTF_OLD_VERSIONS -D_MDB \
480a47c91cSRobert Mustacchi    -Dvsnprintf=ctf_vsnprintf -Dassfail=kmdb_prom_assfail
497c478bd9Sstevel@tonic-gate
50bc1f688bSRobert MustacchiCSTD = $(CSTD_GNU99)
51bc1f688bSRobert Mustacchi
525a0af816SRobert Mustacchi#
535a0af816SRobert Mustacchi# We cannot currently use the stack protector in the kmdb standalone
545a0af816SRobert Mustacchi# environment.
555a0af816SRobert Mustacchi#
565a0af816SRobert MustacchiSTACKPROTECT = none
575a0af816SRobert Mustacchi
587c478bd9Sstevel@tonic-gate#
597c478bd9Sstevel@tonic-gate# kmdb is a kernel module, so we'll use the kernel's build flags.
607c478bd9Sstevel@tonic-gateCFLAGS64 += $(STAND_FLAGS_64)
617c478bd9Sstevel@tonic-gate
62*82d0151aSRichard LoweLDFLAGS = $(ZNOVERSION) $(BREDUCE) -Wl,-M$(MAPFILE) -r
637c478bd9Sstevel@tonic-gate
647c478bd9Sstevel@tonic-gateLIB = libstandctf.so
657c478bd9Sstevel@tonic-gateOBJS = $(CTF_COMMON_SRCS:%.c=%.o) $(CTF_STUB_SRCS:%.c=%.o)
667c478bd9Sstevel@tonic-gate
67d3b5f563SJohn LevonCERRWARN += $(CNOWARN_UNINIT)
687014882cSRichard Lowe
697c478bd9Sstevel@tonic-gate.NO_PARALLEL:
707c478bd9Sstevel@tonic-gate.PARALLEL: $(OBJS)
717c478bd9Sstevel@tonic-gate
727c478bd9Sstevel@tonic-gateinstall all: $(LIB)
737c478bd9Sstevel@tonic-gate
747c478bd9Sstevel@tonic-gate$(LIB): $(OBJS) $(MAPFILE)
757c478bd9Sstevel@tonic-gate	$(LD) $(LDFLAGS) -o $@ $(OBJS)
767c478bd9Sstevel@tonic-gate
777c478bd9Sstevel@tonic-gateclobber clean:
7885f4cb87SRichard Lowe	$(RM) $(LIB) $(OBJS)
797c478bd9Sstevel@tonic-gate
807c478bd9Sstevel@tonic-gate#
817c478bd9Sstevel@tonic-gate# Dynamic rules for object construction
827c478bd9Sstevel@tonic-gate#
837c478bd9Sstevel@tonic-gate
847c478bd9Sstevel@tonic-gate%.o: ../../../common/libstandctf/%.c
857c478bd9Sstevel@tonic-gate	$(COMPILE.c) $<
867c478bd9Sstevel@tonic-gate	$(CTFCONVERT_O)
877c478bd9Sstevel@tonic-gate
887c478bd9Sstevel@tonic-gate%.o: $(SRC)/common/ctf/%.c
897c478bd9Sstevel@tonic-gate	$(COMPILE.c) $<
907c478bd9Sstevel@tonic-gate	$(CTFCONVERT_O)
91