xref: /titanic_50/usr/src/lib/libbsm/Makefile (revision dfb96a4f56fb431b915bc67e5d9d5c8d4f4f6679)
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 (the "License").
6# You may not use this file except in compliance with the License.
7#
8# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9# or http://www.opensolaris.org/os/licensing.
10# See the License for the specific language governing permissions
11# and limitations under the License.
12#
13# When distributing Covered Code, include this CDDL HEADER in each
14# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15# If applicable, add the following below this CDDL HEADER, with the
16# fields enclosed by brackets "[]" replaced with your own identifying
17# information: Portions Copyright [yyyy] [name of copyright owner]
18#
19# CDDL HEADER END
20#
21#
22# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
23# Use is subject to license terms.
24#
25# ident	"%Z%%M%	%I%	%E% SMI"
26#
27
28include ../Makefile.lib
29
30SUBDIRS =	$(MACH)
31$(BUILD64)SUBDIRS += $(MACH64)
32
33XGETFLAGS_ADT += -a
34
35all :=		TARGET= all
36clean :=	TARGET= clean
37clobber :=	TARGET= clobber
38delete :=	TARGET= delete
39install :=	TARGET= install
40lint :=		TARGET= lint
41package :=	TARGET= package
42
43.KEEP_STATE:
44
45COMMONDIR = common
46
47#
48# Macros for libbsm header files. These define user-level only interfaces.
49#
50GENHDRS = audit_uevents.h
51HDRS = libbsm.h devices.h devalloc.h adt.h adt_event.h audit_private.h
52GENSRCS =	$(COMMONDIR)/adt_xlate.c $(COMMONDIR)/adt_event.h
53COMMONHDRS =	$(HDRS:%=$(COMMONDIR)/%)
54ROOTHDRDIR = 	$(ROOT)/usr/include/bsm
55ROOTCHDRS = 	$(HDRS:%=$(ROOTHDRDIR)/%)
56ROOTHDRS = 	$(GENHDRS:%=$(ROOTHDRDIR)/%)
57
58CHECKCHDRS =	$(COMMONHDRS:%.h=%.check)
59CHECKHDRS =	$(GENHDRS:%.h=%.check)
60
61$(ROOTHDRS) := 	FILEMODE = 0644
62$(ROOTCHDRS) :=	FILEMODE = 0644
63
64all install lint package: $(GENSRCS) $(SUBDIRS)
65clean clobber delete: $(SUBDIRS)
66
67#
68# Macros for libbsm database files. These should probably be installed
69# from somewhere else. Until we find that better place, install them
70# from here.
71#
72
73ROOTETCSECURITY = 	$(ROOT)/etc/security
74$(ROOTETCSECURITY) := 	DIRMODE = 0755
75$(ROOTETCSECURITY) := 	OWNER = root
76$(ROOTETCSECURITY) := 	GROUP = sys
77
78ESFILES =		audit_class audit_control audit_event audit_user
79ESSRC =			$(ESFILES:%=%.txt)
80ETCSECURITYFILES =	$(ESFILES:%=$(ROOTETCSECURITY)/%)
81$(ETCSECURITYFILES) :=	FILEMODE = 0644
82$(ETCSECURITYFILES) :=	OWNER = root
83$(ETCSECURITYFILES) :=	GROUP = sys
84
85EESFILES =		audit_startup
86EESSRC =		$(EESFILES:%=%.txt)
87EETCSECURITYFILES =	$(EESFILES:%=$(ROOTETCSECURITY)/%)
88$(EETCSECURITYFILES) :=	FILEMODE = 0744
89$(EETCSECURITYFILES) :=	OWNER = root
90$(EETCSECURITYFILES) :=	GROUP = sys
91
92#
93# /etc/security/audit/localhost/files is a symbolic link to /var/audit.
94# This is provided so that auditreduce will work in the default configuration.
95#
96RESA=$(ROOTETCSECURITY)/audit
97RESAL=$(RESA)/localhost
98VARAUDIT=$(ROOT)/var/audit
99AUDITDIRS=$(RESA) $(RESAL) $(VARAUDIT)
100$(AUDITDIRS) := FILEMODE = 0750
101$(AUDITDIRS) := OWNER = root
102$(AUDITDIRS) := GROUP = sys
103
104ARSYMLNK=$(RESAL)/files
105
106#
107# message catalogue file
108#
109MSGFILES =	`$(GREP) -l gettext $(COMMONDIR)/*.c`
110POFILE =	libbsm.po
111
112#
113# Definitions for XML (DTD AND XSL)
114#
115DTD =		adt_record.dtd.1
116XSL =		adt_record.xsl.1
117ROOTXMLDIR =	$(ROOT)/usr/share/lib/xml
118ROOTDTDDIR=	$(ROOTXMLDIR)/dtd
119ROOTXSLDIR=	$(ROOTXMLDIR)/style
120ROOTDTD=	$(DTD:%=$(ROOTDTDDIR)/%)
121ROOTXSL=	$(XSL:%=$(ROOTXSLDIR)/%)
122ROOTXMLDIRS =	$(ROOTXMLDIR) $(ROOTDTDDIR) $(ROOTXSLDIR)
123ROOTXMLFILES =	$(ROOTDTD) $(ROOTXSL)
124
125$(ROOTXMLDIRS) :=  FILEMODE = 755
126$(ROOTXMLDIRS) :=  OWNER = root
127$(ROOTXMLDIRS) :=  GROUP = sys
128
129$(ROOTXMLFILES) :=  FILEMODE = 444
130$(ROOTXMLFILES) :=  OWNER = root
131$(ROOTXMLFILES) :=  GROUP = bin
132
133
134CPPFLAGS += -I$(COMMONDIR)
135CPPFLAGS += -D_REENTRANT
136
137CLEANFILES += $(GENSRCS) $(GENHDRS)
138
139ADTXMLFILE =	$(COMMONDIR)/adt.xml
140ADTXSDFILE =	$(COMMONDIR)/adt.xsd
141AUDITXML =	auditxml
142
143.KEEP_STATE:
144
145install: install_dirs install_data
146
147#		$(ROOTUSRLIB) $(ROOTLIBS) $(ROOTLINKS)
148
149install_h: $(ROOTHDRDIR) $(ROOTHDRS) $(ROOTCHDRS)
150
151check:	$(CHECKHDRS) $(CHECKCHDRS)
152	xmllint --schema $(ADTXSDFILE) --noout $(ADTXMLFILE)
153
154install_data: $(ESSRC) $(RESSRC) $(ROOTETCSECURITY) $(ETCSECURITYFILES) \
155	$(EETCSECURITYFILES) $(ROOTXMLFILES)
156
157install_dirs: $(AUDITDIRS) $(ARSYMLNK) $(ROOTXMLDIRS)
158
159audit_uevents.h: mkhdr.sh audit_event.txt
160	sh mkhdr.sh
161
162$(COMMONDIR)/adt_event.check:	$(COMMONDIR)/adt_event.h
163	$(DOT_C_CHECK) $<
164
165clean clobber: clean_files
166
167clean_files:
168	-$(RM) $(CLEANFILES)
169
170$(GENSRCS): $(ADTXMLFILE) $(AUDITXML)
171	$(PERL) $(AUDITXML) $(ADTXMLFILE)
172
173$(ETCSECURITYFILES) $(EETCSECURITYFILES) $(RESA): \
174	$(ETCSECURITY) \
175	$(ROOTETCSECURITY)
176
177$(RESAL): $(RESA)
178
179$(ARSYMLNK): $(RESAL)
180
181$(ROOTHDRDIR):
182	$(INS.dir)
183
184$(ROOTHDRDIR)/%:%
185	$(INS.file)
186
187$(ROOTHDRDIR)/%:$(COMMONDIR)/%
188	$(INS.file)
189
190$(ROOTXMLDIRS):
191	$(INS.dir)
192
193$(ROOTDTDDIR)/% $(ROOTXSLDIR)/%: %
194	$(INS.file)
195
196$(AUDITDIRS):
197	$(INS.dir)
198
199$(ARSYMLNK):
200	$(RM) $@
201	$(SYMLINK) ../../../../var/audit $@
202
203$(ETCSECURITY)/%: %.txt
204	$(INS.rename)
205
206$(ROOTETCSECURITY):
207	$(INS.dir)
208
209$(ROOTETCSECURITY)/%: %.txt
210	$(INS.rename)
211
212$(POFILE):	 pofile_MSGFILES
213
214_msg:	$(MSGDOMAINPOFILE)
215
216# has strings but doesn't use gettext
217adt_xlate.po: $(COMMONDIR)/adt_xlate.c
218	$(RM) adt_xlate.po
219	$(XGETTEXT) $(XGETFLAGS_ADT) $(COMMONDIR)/adt_xlate.c
220	$(SED) "/^domain/d" < messages.po > adt_xlate.po
221	$(RM) messages.po
222
223$(SUBDIRS):	FRC
224	@cd $@; pwd; $(MAKE) $(TARGET)
225
226FRC:
227
228include ../Makefile.targ
229include ../../Makefile.msg.targ
230