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# ident	"%Z%%M%	%I%	%E% SMI"
27#
28
29include	$(SRC)/Makefile.psm
30
31LIBRARY =	libpiclfrudr.a
32VERS =		.1
33
34OBJECTS =	piclfrudr.o
35
36# include library definitions
37include $(SRC)/lib/Makefile.lib
38
39ROOT_PLATFORM = $(USR_PLAT_DIR)/SUNW,Sun-Fire-V240
40
41include	$(SRC)/cmd/picl/plugins/Makefile.com
42
43SRCS =		$(OBJECTS:%.o=%.c)
44
45LIBS =		$(DYNLIB)
46
47ROOTLIBDIR	= $(ROOT_PLAT_PLUGINDIR)
48ROOTLIBDIR	:= OWNER = root
49ROOTLIBDIR	:= GROUP = sys
50
51PLAT_PLATFORM = $(USR_PLAT_DIR)/SUNW,Sun-Fire-V440
52PLAT_PLATFORM := OWNER= root
53PLAT_PLATFORM := GROUP= sys
54
55PLAT_LIB_DIR = $(PLAT_PLATFORM:%=%/lib)
56PLAT_LIB_DIR := OWNER= root
57PLAT_LIB_DIR := GROUP= bin
58
59PLAT_PICL_DIR = $(PLAT_LIB_DIR:%=%/picl)
60PLAT_PICL_DIR := OWNER= root
61PLAT_PICL_DIR := GROUP= sys
62
63PLAT_PLUGINS_DIRS = $(PLAT_PICL_DIR:%=%/plugins)
64PLAT_PLUGINS_DIRS := OWNER= root
65PLAT_PLUGINS_DIRS := GROUP= sys
66
67USR_PLAT_PLUGINS_DYNLIBS = $(PLAT_PLUGINS_DIRS:%=%/$(DYNLIB))
68USR_PLAT_PLUGINS_LIBLINKS = $(PLAT_PLUGINS_DIRS:%=%/$(LIBLINKS))
69MPXU_DYNLIB_DIR = ../../../../SUNW,Sun-Fire-V240/lib/picl/plugins
70
71CONFS		= fru_PS0.conf fru_PS1.conf
72CONFS		+= fru_HDD0.conf fru_HDD1.conf fru_HDD2.conf
73CONFS		+= fru_HDD3.conf
74CONFS		+= fru_SC.conf
75CONFS		+= fru_usb-a-1.conf fru_usb-a-2.conf
76ROOTCONF=	$(CONFS:%=$(ROOTLIBDIR)/%)
77$(ROOTCONF)	:= FILEMODE = 0644
78MAININFO=	$(CONFS:%.conf=%.info)
79OTHERINFOS	= fru_PS0_data.info fru_PS1_data.info
80OTHERINFOS	+= fru_HDD0_data.info fru_HDD1_data.info
81OTHERINFOS	+= fru_HDD2_data.info fru_HDD3_data.info
82OTHERINFOS	+= fru_SC_data.info SB-tables.info
83OTHERINFOS	+= fru_usb-a-1_data.info fru_usb-a-2_data.info
84
85LINTSRC =	$(LINTLIB:%.ln=%)
86ROOTLINTDIR =	$(ROOTLIBDIR)
87ROOTLINT =	$(LINTSRC:%=$(ROOTLINTDIR)/%)
88
89CLEANFILES =	$(LINTOUT) $(LINTLIB)
90
91CPPFLAGS +=	-D_REENTRANT
92CPPFLAGS +=	-I$(SRC)/cmd/picl/plugins/lib/picld_pluginutil
93CPPFLAGS +=	-I$(SRC)/uts/sun4u/mpxu
94CPPFLAGS +=	-I$(SRC)/uts/sun4u/ -I$(SRC)/uts/common/
95CPPFLAGS +=	-I$(SRC)/uts/sun4u/sys/i2c/clients
96
97CFLAGS +=	$(CCVERBOSE)
98
99DYNFLAGS +=	-R/usr/platform/\$$PLATFORM/lib/picl/plugins
100DYNFLAGS +=	-R/usr/platform/sun4u/lib/picl/plugins:/usr/lib/picl/plugins
101LDLIBS +=	-L$(SRC)/cmd/picl/plugins/lib/picld_pluginutil/$(MACH)
102LDLIBS +=	-L$(DEVTREE_SRC_DIR)
103LDLIBS +=	-L$(SRC)/lib/libpicltree/$(MACH)
104LDLIBS +=	-L$(SRC)/cmd/picl/plugins/common/memcfg
105LDLIBS +=	-L$(SRC)/cmd/picl/plugins/common/devtree
106LDLIBS +=	-L$(SRC)/cmd/picl/plugins/common/piclevent
107LDLIBS +=	-L$(SRC)/cmd/picl/plugins/sun4u/envmon
108LDLIBS +=	-L$(SRC)/cmd/picl/plugins/common/frutree
109LDLIBS +=	-L$(ROOT)/usr/lib/picl/plugins
110LDLIBS +=	-lc -ldevinfo -ldevice
111LDLIBS +=	-lpicltree -lpicld_pluginutil -lnvpair -lkstat
112LDLIBS +=	-lpiclevent -lpiclenvmon -lpiclfrutree
113
114.KEEP_STATE:
115
116SUBDIRS =
117
118POFILE = piclfrudr.po
119
120all :=		TARGET= all
121install :=	TARGET= install
122clean :=	TARGET= clean
123clobber :=	TARGET= clobber
124lint :=		TARGET= lint
125_msg :=		TARGET= _msg
126
127all: $(LIBS) $(LIBLINKS) $(CONFS)
128
129install:	$(ROOTLIBDIR) all $(ROOTLIBS) $(ROOTLINKS) $(ROOTCONF) \
130		$(PLAT_PLATFORM) $(PLAT_LIB_DIR) $(PLAT_PICL_DIR) \
131		$(USR_PLAT_PLUGINS_DYNLIBS) $(USR_PLAT_PLUGINS_LIBLINKS)
132
133$(CONFS): $(MAININFO) $(OTHERINFOS)
134	@$(RM) -f $@
135	@echo "# Copyright 2003 Sun Microsystems, Inc. " \
136	"All rights reserved." > $@
137	@echo "# This is a generated file. #ident lines identify sources" >> $@
138	$(CPP) -P $(@:%.conf=%.info) | \
139	$(SED) -e '/^[  ]*$$/d' >> $@
140	@$(CHMOD) 644 $@
141
142_msg:	$(MSGDOMAIN) $(POFILE)
143	$(RM) $(MSGDOMAIN)/$(POFILE)
144	$(CP) $(POFILE) $(MSGDOMAIN)/mpxu_$(POFILE)
145
146$(MSGDOMAIN):
147	$(INS.dir)
148
149$(LIBLINKS):	FRC
150	$(RM) $@; $(SYMLINK) $(DYNLIB) $@
151
152# include library targets
153include $(SRC)/lib/Makefile.targ
154include	$(SRC)/cmd/picl/plugins/Makefile.targ
155
156$(ROOT_PLAT_PLUGINDIR)/%: % $(ROOT_PLAT_PLUGINDIR)
157	$(INS.file) ;\
158	$(RM) -r $(ROOT_PLAT_PLUGINDIR)/$(LIBLINKS) ;\
159	$(SYMLINK) ./$(DYNLIB) $(ROOT_PLAT_PLUGINDIR)/$(LIBLINKS)
160
161$(PLAT_PLATFORM):
162	$(INS.dir)
163$(PLAT_LIB_DIR):
164	$(INS.dir)
165$(PLAT_PICL_DIR):
166	$(INS.dir)
167
168$(PLAT_PLUGINS_DIRS):
169	$(INS.dir)
170
171$(USR_PLAT_PLUGINS_DYNLIBS): $(PLAT_PLUGINS_DIRS)
172	$(RM) -r $@ ;\
173	$(SYMLINK) $(MPXU_DYNLIB_DIR)/$(DYNLIB) $@
174
175$(USR_PLAT_PLUGINS_LIBLINKS): $(PLAT_PLUGINS_DIRS)
176	$(RM) -r $@ ;\
177	$(SYMLINK) $(MPXU_DYNLIB_DIR)/$(DYNLIB) $@
178
179$(ROOTLINTDIR)/%: ../%
180	$(INS.file)
181
182lint:
183	$(LINT.c) $(SRCS)
184
185$(SUBDIRS): FRC
186	@cd $@; pwd; $(MAKE) $(TARGET)
187
188FRC:
189