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# kmdb is a kernel module, so we'll use the kernel's build flags.
70CFLAGS64 += $(STAND_FLAGS_64)
71
72ASFLAGS += -P -D_ASM
73
74LINTFLAGS += -n -errtags=yes
75CLINTFILES = $(SRCS:%.c=%.ln)
76LINTFILES = $(CLINTFILES:%.s=%.ln)
77
78CERRWARN += -_gcc=-Wno-parentheses
79
80LIB = libstand.a
81COBJS = $(SRCS:%.c=%.o)
82OBJS = $(COBJS:%.s=%.o)
83
84.NO_PARALLEL:
85.PARALLEL: $(OBJS) $(LINTFILES)
86
87install all: $(LIB)
88
89$(LIB): $(OBJS)
90	$(AR) r $(LIB) $(OBJS)
91
92clobber clean:
93	$(RM) $(LIB) $(OBJS) $(LINTFILES)
94
95lint: $(LINTFILES)
96	$(LINT) $(LINTFLAGS) $(LINTFILES)
97
98#
99# Dynamic rules for object construction
100#
101
102%.o: ../../../common/libstand/%.c
103	$(COMPILE.c) $<
104	$(CTFCONVERT_O)
105
106%.o: $(SRC)/common/util/%.c
107	$(COMPILE.c) $<
108	$(CTFCONVERT_O)
109
110%.o: $(SRC)/common/util/i386/%.s
111	$(COMPILE.s) $<
112
113%.o: ../../libstand/%.c
114	$(COMPILE.c) -o $@ $<
115	$(CTFCONVERT_O)
116
117%.o: ../../libstand/%.s
118	$(COMPILE.s) -o $@ $<
119
120#
121# Lint
122#
123
124%.ln: ../../../common/libstand/%.c
125	$(LINT.c) -c $<
126
127%.ln: $(SRC)/common/util/%.c
128	$(LINT.c) -c $<
129
130%.ln: $(SRC)/common/util/i386/%.s
131	$(LINT.s) -c $<
132
133%.ln: ../../libstand/%.c
134	$(LINT.c) -c $<
135
136%.ln: %.s
137	$(LINT.s) -c $<
138