xref: /illumos-gate/usr/src/cmd/mdb/Makefile.libstand (revision 28ab0ca48b3e331cbbb231b1c8325f9f24f9af95)
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
27.KEEP_STATE:
28.SUFFIXES:
29
30include ../../Makefile.libstand
31
32SRCS_COMMON += \
33	bcmp.c \
34	bcopy.c \
35	bsearch.c \
36	bzero.c \
37	ctime.c \
38	ctype.c \
39	errno.c \
40	getopt.c \
41	memchr.c \
42	memcmp.c \
43	memcpy.c \
44	memccpy.c \
45	memmove.c \
46	memset.c \
47	qsort.c \
48	string.c \
49	strtol.c \
50	strtoul.c
51
52sparcv9_SRCS= \
53	multi3.c
54
55SRCS += $(SRCS_COMMON) $($(MACH64)_SRCS)
56
57# We don't want thread-specific errno's in kmdb, as we're single-threaded.
58DTS_ERRNO=
59
60INCDIRS = \
61	../../../common/libstand \
62	../../libstand \
63	$(ROOT)/usr/include
64
65$(NOT_RELEASE_BUILD)CPPFLAGS += -DDEBUG
66CPPFLAGS = $(INCDIRS:%=-I%) -D_KMDB
67
68#
69# We cannot currently use the stack protector in kmdb's standalone
70# environment.
71#
72STACKPROTECT = none
73
74#
75# kmdb is a kernel module, so we'll use the kernel's build flags.
76CFLAGS64 += $(STAND_FLAGS_64)
77
78ASFLAGS += -P -D_ASM
79
80LINTFLAGS += -n -errtags=yes
81CLINTFILES = $(SRCS:%.c=%.ln)
82LINTFILES = $(CLINTFILES:%.s=%.ln)
83
84CERRWARN += -_gcc=-Wno-parentheses
85
86LIB = libstand.a
87COBJS = $(SRCS:%.c=%.o)
88OBJS = $(COBJS:%.s=%.o)
89
90.NO_PARALLEL:
91.PARALLEL: $(OBJS) $(LINTFILES)
92
93install all: $(LIB)
94
95$(LIB): $(OBJS)
96	$(AR) r $(LIB) $(OBJS)
97
98clobber clean:
99	$(RM) $(LIB) $(OBJS) $(LINTFILES)
100
101lint: $(LINTFILES)
102	$(LINT) $(LINTFLAGS) $(LINTFILES)
103
104#
105# Dynamic rules for object construction
106#
107
108%.o: ../../../common/libstand/%.c
109	$(COMPILE.c) $<
110	$(CTFCONVERT_O)
111
112%.o: $(SRC)/common/util/%.c
113	$(COMPILE.c) $<
114	$(CTFCONVERT_O)
115
116%.o: $(SRC)/common/util/i386/%.s
117	$(COMPILE.s) $<
118
119%.o: ../../libstand/%.c
120	$(COMPILE.c) -o $@ $<
121	$(CTFCONVERT_O)
122
123%.o: ../../libstand/%.s
124	$(COMPILE.s) -o $@ $<
125
126#
127# Lint
128#
129
130%.ln: ../../../common/libstand/%.c
131	$(LINT.c) -c $<
132
133%.ln: $(SRC)/common/util/%.c
134	$(LINT.c) -c $<
135
136%.ln: $(SRC)/common/util/i386/%.s
137	$(LINT.s) -c $<
138
139%.ln: ../../libstand/%.c
140	$(LINT.c) -c $<
141
142%.ln: %.s
143	$(LINT.s) -c $<
144