1# CDDL HEADER START
2#
3# The contents of this file are subject to the terms of the
4# Common Development and Distribution License (the "License").
5# You may not use this file except in compliance with the License.
6#
7# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
8# or http://www.opensolaris.org/os/licensing.
9# See the License for the specific language governing permissions
10# and limitations under the License.
11#
12# When distributing Covered Code, include this CDDL HEADER in each
13# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
14# If applicable, add the following below this CDDL HEADER, with the
15# fields enclosed by brackets "[]" replaced with your own identifying
16# information: Portions Copyright [yyyy] [name of copyright owner]
17#
18# CDDL HEADER END
19#
20#
21# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
22# Use is subject to license terms.
23#
24# lib/libunistat/Makefile.com
25#
26# include global definitions
27include ../../../Makefile.master
28
29LIBRARY= libunistat.a
30VERS= .1
31
32OBJECTS= spcs_s_u.o spcs_log.o
33
34# include library definitions
35include ../../Makefile.lib
36
37SRCS=		$(OBJECTS:%.o=../common/%.c)
38SRCDIR=		../common
39
40LIBS 	+=	$(DYNLIB) $(LINTLIB)
41
42# definitions for lint
43
44LINTFLAGS	+= -u -I..
45LINTFLAGS	+= -erroff=E_UNDEFINED_SYMBOL
46LINTFLAGS	+= -erroff=E_STATIC_UNUSED
47LINTFLAGS	+= -erroff=E_BAD_PTR_INT_COMB_ARG
48LINTFLAGS	+= -erroff=E_VAR_USED_BEFORE_SET
49LINTFLAGS	+= -erroff=E_SEC_FORBIDDEN_WARN_CFTIME
50LINTFLAGS	+= -erroff=E_SEC_PRINTF_VAR_FMT
51LINTFLAGS	+= -erroff=E_OLD_STYLE_DECL_OR_BAD_TYPE
52LINTFLAGS	+= -erroff=E_YACC_ERROR
53LINTFLAGS	+= -erroff=E_FUNC_RET_MAYBE_IGNORED2
54LINTFLAGS	+= -erroff=E_FUNC_RET_ALWAYS_IGNOR2
55LINTOUT=	lint.out
56LINTOUT_INTER=	lintinter.out
57
58LINTSRC=	$(LINTLIB:%.ln=%)
59ROOTLINTDIR=	$(ROOTLIBDIR)
60ROOTLINT=	$(LINTSRC:%=$(ROOTLINTDIR)/%)
61
62CLEANFILES +=	$(LINTOUT) $(LINTLIB) $(LINTOUT_INTER) $(LINT_INTER) 
63
64all:=	  TARGET= all
65clean:=   TARGET= clean
66clobber:= TARGET= clobber
67install:= TARGET= install
68lint:=	  TARGET= lint
69lintinter:=	  TARGET= lintinter
70
71MODS=	dsw \
72	rdc \
73	spcs \
74	sdbc \
75	solaris \
76	sv
77
78ERRS=	$(MODS:%=$(SRCDIR)/%/%.err)
79MSGS=	$(MODS:%=$(SRCDIR)/%/%.msg)
80EDEFS=	$(MODS:%=$(SRCDIR)/%/%.edef)
81TRNKS=	$(MODS:%=$(SRCDIR)/%/%.trnk)
82DTRNKS=	$(MODS:%=$(SRCDIR)/%/%.dtrnk)
83
84ERRGEN_DIR=	$(SRC)/cmd/avs/errgen
85ERRGEN=		$(ERRGEN_DIR)/errgen
86
87# production (non-debug)
88DFLAGS =	-DISSTATIC=static
89
90# development (debug) - cstyle prohibits use of "STATIC"
91DFLAGS =	-g -DISSTATIC=" "
92
93CFLAGS +=	-v $(DFLAGS) -I. -DLIBSPCS_CLIENT\
94		-I$(JAVAINC) -I$(JAVAINCSOL)\
95		-DLIBUNISTAT_LOCALE=\"/usr/install/unistat/locale\"
96CFLAGS64 +=	-v $(DFLAGS) -I. -DLIBSPCS_CLIENT\
97		-I$(JAVAINC) -I$(JAVAINCSOL)\
98		-DLIBUNISTAT_LOCALE=\"/usr/install/unistat/locale\"
99LDLIBS +=	-lc
100
101$(LINTLIB) :=	SRCS = ../common/llib-lunistat
102$(LINTLIB) :=	LINTFLAGS = -nvx -DLIBSPCS_CLIENT -I$(JAVAINC) -I$(JAVAINCSOL)\
103		-DISSTATIC=static \
104		-DLIBUNISTAT_LOCALE=\"/usr/install/unistat/locale\"
105$(LINTLIB) :=	LINTFLAGS64 = -nvx -Xarch=v9 -DLIBSPCS_CLIENT \
106			-I$(JAVAINC) -I$(JAVAINCSOL) \
107			-DISSTATIC=static \
108		-DLIBUNISTAT_LOCALE=\"/usr/install/unistat/locale\"
109
110$(LINT_INTER) :=	SRCS += ../common/llib-lunistat
111$(LINT_INTER) :=	LINTFLAGS = -nvx -DLIBSPCS_CLIENT -I$(JAVAINC) -I$(JAVAINCSOL)\
112		-DISSTATIC=static \
113		-DLIBUNISTAT_LOCALE=\"/usr/install/unistat/locale\"
114$(LINT_INTER) :=	LINTFLAGS64 = -nvx -Xarch=v9 -DLIBSPCS_CLIENT \
115			-I$(JAVAINC) -I$(JAVAINCSOL) \
116			-DISSTATIC=static \
117		-DLIBUNISTAT_LOCALE=\"/usr/install/unistat/locale\"
118
119COMMENT=	"/* THIS FILE IS AUTOMATICALLY GENERATED: DO NOT EDIT */"
120
121CLEANFILES +=	*.h *.po\
122		$(SRCDIR)/*/*.msg\
123		$(SRCDIR)/*/*.properties\
124		$(SRCDIR)/*/*.exc\
125		$(SRCDIR)/*/*.edef\
126		$(SRCDIR)/*/*.trnk\
127		$(SRCDIR)/*/*.dtrnk
128
129# note that the properties files are generated in ../libspcs/java
130
131.SUFFIXES: .err .exc .properties .edef .msg .trnk .dtrnk
132
133.err.msg: 
134	$(ERRGEN) -m `basename $*` <$*.err >$*.msg
135
136.err.edef:
137	$(ERRGEN) -c `basename $*` <$*.err >$*.edef
138
139.err.trnk:
140	$(ERRGEN) -t `basename $*` <$*.err >$*.trnk
141
142.err.dtrnk:
143	$(ERRGEN) -x `basename $*` <$*.err >$*.dtrnk
144
145all:	spcs_etext.h spcs_errors.h spcs_etrinkets.h spcs_dtrinkets.h $(LIB)
146
147spcs_dtrinkets.h: $(ERRGEN) $(DTRNKS)
148	@echo $(COMMENT) > $@
149	cat $(DTRNKS) >>spcs_dtrinkets.h
150
151spcs_etrinkets.h: $(ERRGEN) $(TRNKS)
152	@echo $(COMMENT) > $@
153	cat $(TRNKS) $(SRCDIR)/spcs_etrinkets.stub >> $@
154
155spcs_etext.h: $(ERRGEN) $(MSGS)
156	@echo $(COMMENT) > $@
157	$(CAT) $(MSGS) $(SRCDIR)/spcs_etext.stub >> $@
158	$(SED) "s/	\"/	gettext(\"/" < $@ |\
159		 sed "s/\",/\"),/" > temp 
160	xgettext -d unistat temp ; rm temp
161
162spcs_errors.h: $(ERRGEN) $(EDEFS)
163	@echo $(COMMENT) > $@
164	$(CAT) $(EDEFS) $(SRCDIR)/spcs_errors.stub >> $@
165
166$(ERRGEN):
167	@cd $(ERRGEN_DIR); pwd; $(MAKE) install
168
169
170.KEEP_STATE:
171
172FRC:
173
174lint: lintcheck $(LINTLIB)
175lintinter: $(LINT_INTER)
176
177# include library targets
178include ../../Makefile.targ
179
180objs/%.o pics/%.o: ../common/%.c
181	$(COMPILE.c) -o $@ $<
182	$(POST_PROCESS_O)
183
184# install rule for lint library target
185$(ROOTLINTDIR)/%:	../common/%
186	$(INS.file)
187