xref: /illumos-gate/usr/src/cmd/mdb/Makefile.libstand (revision 5d9d9091)
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, Version 1.0 only
6# (the "License").  You may not use this file except in compliance
7# with the License.
8#
9# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10# or http://www.opensolaris.org/os/licensing.
11# See the License for the specific language governing permissions
12# and limitations under the License.
13#
14# When distributing Covered Code, include this CDDL HEADER in each
15# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16# If applicable, add the following below this CDDL HEADER, with the
17# fields enclosed by brackets "[]" replaced with your own identifying
18# information: Portions Copyright [yyyy] [name of copyright owner]
19#
20# CDDL HEADER END
21#
22#
23# Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
24# Use is subject to license terms.
25#
26# Copyright 2022 Garrett D'Amore
27#
28
29.KEEP_STATE:
30.SUFFIXES:
31
32include ../../Makefile.libstand
33
34SRCS += \
35	bcmp.c \
36	bcopy.c \
37	bsearch.c \
38	bzero.c \
39	ctime.c \
40	ctype.c \
41	errno.c \
42	getopt.c \
43	memchr.c \
44	memcmp.c \
45	memcpy.c \
46	memccpy.c \
47	memmove.c \
48	memset.c \
49	qsort.c \
50	string.c \
51	strtol.c \
52	strtoul.c
53
54
55# We don't want thread-specific errno's in kmdb, as we're single-threaded.
56DTS_ERRNO=
57
58INCDIRS = \
59	../../../common/libstand \
60	../../libstand \
61	$(ROOT)/usr/include
62
63$(NOT_RELEASE_BUILD)CPPFLAGS += -DDEBUG
64CPPFLAGS = $(INCDIRS:%=-I%) -D_KMDB
65
66#
67# We cannot currently use the stack protector in kmdb's standalone
68# environment.
69#
70STACKPROTECT = none
71
72#
73# kmdb is a kernel module, so we'll use the kernel's build flags.
74CFLAGS64 += $(STAND_FLAGS_64)
75
76ASFLAGS += -D_ASM
77ASFLAGS64 += -D_ASM
78
79LINTFLAGS += -n -errtags=yes
80CLINTFILES = $(SRCS:%.c=%.ln)
81
82CERRWARN += -_gcc=-Wno-parentheses
83
84LIB = libstand.a
85COBJS = $(SRCS:%.c=%.o)
86OBJS = $(COBJS:%.S=%.o)
87
88.NO_PARALLEL:
89.PARALLEL: $(OBJS) $(LINTFILES)
90
91install all: $(LIB)
92
93$(LIB): $(OBJS)
94	$(AR) r $(LIB) $(OBJS)
95
96clobber clean:
97	$(RM) $(LIB) $(OBJS) $(LINTFILES)
98
99lint: $(LINTFILES)
100	$(LINT) $(LINTFLAGS) $(LINTFILES)
101
102#
103# Dynamic rules for object construction
104#
105
106%.o: ../../../common/libstand/%.c
107	$(COMPILE.c) $<
108	$(CTFCONVERT_O)
109
110%.o: $(SRC)/common/util/%.c
111	$(COMPILE.c) $<
112	$(CTFCONVERT_O)
113
114%.o: $(SRC)/common/util/i386/%.S
115	$(COMPILE.s) $<
116
117%.o: ../../libstand/%.c
118	$(COMPILE.c) -o $@ $<
119	$(CTFCONVERT_O)
120
121%.o: ../../libstand/%.S
122	$(COMPILE.s) -o $@ $<
123