xref: /titanic_41/usr/src/lib/libbsm/Makefile (revision dc5982c9e1ebe3315aac975f1c4f1ad46c83c2d2)
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 2009 Sun Microsystems, Inc.  All rights reserved.
23# Use is subject to license terms.
24#
25
26include ../Makefile.lib
27
28SUBDIRS =	$(MACH)
29$(BUILD64)SUBDIRS += $(MACH64)
30
31XGETFLAGS_ADT += -a
32
33all :=		TARGET= all
34clean :=	TARGET= clean
35clobber :=	TARGET= clobber
36delete :=	TARGET= delete
37install :=	TARGET= install
38lint :=		TARGET= lint
39package :=	TARGET= package
40
41.KEEP_STATE:
42
43COMMONDIR = common
44
45#
46# Macros for libbsm header files. These define user-level only interfaces.
47#
48GENHDRS = audit_uevents.h
49HDRS = libbsm.h devices.h devalloc.h adt.h adt_event.h audit_private.h
50GENSRCS =	$(COMMONDIR)/adt_xlate.c $(COMMONDIR)/adt_event.h
51COMMONHDRS =	$(HDRS:%=$(COMMONDIR)/%)
52ROOTHDRDIR = 	$(ROOT)/usr/include/bsm
53ROOTCHDRS = 	$(HDRS:%=$(ROOTHDRDIR)/%)
54ROOTHDRS = 	$(GENHDRS:%=$(ROOTHDRDIR)/%)
55
56CHECKCHDRS =	$(COMMONHDRS:%.h=%.check)
57CHECKHDRS =	$(GENHDRS:%.h=%.check)
58
59$(ROOTHDRS) := 	FILEMODE = 0644
60$(ROOTCHDRS) :=	FILEMODE = 0644
61
62all install lint package: $(GENSRCS) $(SUBDIRS)
63clean clobber delete: $(SUBDIRS)
64
65#
66# Macros for libbsm database files. These should probably be installed
67# from somewhere else. Until we find that better place, install them
68# from here.
69#
70
71ROOTETCSECURITY = 	$(ROOT)/etc/security
72$(ROOTETCSECURITY) := 	DIRMODE = 0755
73
74ESFILES =		audit_class audit_control audit_event audit_user
75ESSRC =			$(ESFILES:%=%.txt)
76ETCSECURITYFILES =	$(ESFILES:%=$(ROOTETCSECURITY)/%)
77$(ETCSECURITYFILES) :=	FILEMODE = 0644
78
79#
80# /etc/security/audit/localhost/files is a symbolic link to /var/audit.
81# This is provided so that auditreduce will work in the default configuration.
82#
83RESA=$(ROOTETCSECURITY)/audit
84RESAL=$(RESA)/localhost
85VARAUDIT=$(ROOT)/var/audit
86AUDITDIRS=$(RESA) $(RESAL) $(VARAUDIT)
87$(AUDITDIRS) := FILEMODE = 0750
88
89ARSYMLNK=$(RESAL)/files
90
91#
92# message catalogue file
93#
94MSGFILES =	`$(GREP) -l gettext $(COMMONDIR)/*.c`
95POFILE =	libbsm.po
96
97#
98# Definitions for XML (DTD AND XSL)
99#
100DTD =		adt_record.dtd.1
101XSL =		adt_record.xsl.1
102ROOTXMLDIR =	$(ROOT)/usr/share/lib/xml
103ROOTDTDDIR=	$(ROOTXMLDIR)/dtd
104ROOTXSLDIR=	$(ROOTXMLDIR)/style
105ROOTDTD=	$(DTD:%=$(ROOTDTDDIR)/%)
106ROOTXSL=	$(XSL:%=$(ROOTXSLDIR)/%)
107ROOTXMLDIRS =	$(ROOTXMLDIR) $(ROOTDTDDIR) $(ROOTXSLDIR)
108ROOTXMLFILES =	$(ROOTDTD) $(ROOTXSL)
109
110$(ROOTXMLDIRS) :=  FILEMODE = 755
111
112$(ROOTXMLFILES) :=  FILEMODE = 444
113
114
115CPPFLAGS += -I$(COMMONDIR)
116CPPFLAGS += -D_REENTRANT
117
118CLEANFILES += $(GENSRCS) $(GENHDRS)
119
120ADTXMLFILE =	$(COMMONDIR)/adt.xml
121ADTXSDFILE =	$(COMMONDIR)/adt.xsd
122AUDITXML =	auditxml
123
124.KEEP_STATE:
125
126install: install_dirs install_data
127
128#		$(ROOTUSRLIB) $(ROOTLIBS) $(ROOTLINKS)
129
130install_h: $(ROOTHDRDIR) $(ROOTHDRS) $(ROOTCHDRS)
131
132check:	$(CHECKHDRS) $(CHECKCHDRS)
133	xmllint --schema $(ADTXSDFILE) --noout $(ADTXMLFILE)
134
135install_data: $(ESSRC) $(RESSRC) $(ROOTETCSECURITY) $(ETCSECURITYFILES) \
136	$(ROOTXMLFILES)
137
138install_dirs: $(AUDITDIRS) $(ARSYMLNK) $(ROOTXMLDIRS)
139
140audit_uevents.h: mkhdr.sh audit_event.txt
141	sh mkhdr.sh
142
143$(COMMONDIR)/adt_event.check:	$(COMMONDIR)/adt_event.h
144	$(DOT_C_CHECK) $<
145
146clean clobber: clean_files
147
148clean_files:
149	-$(RM) $(CLEANFILES)
150
151$(GENSRCS): $(ADTXMLFILE) $(AUDITXML)
152	$(PERL) $(AUDITXML) -o $(COMMONDIR) $(ADTXMLFILE)
153
154$(ETCSECURITYFILES) $(RESA): \
155	$(ETCSECURITY) \
156	$(ROOTETCSECURITY)
157
158$(RESAL): $(RESA)
159
160$(ARSYMLNK): $(RESAL)
161
162$(ROOTHDRDIR):
163	$(INS.dir)
164
165$(ROOTHDRDIR)/%:%
166	$(INS.file)
167
168$(ROOTHDRDIR)/%:$(COMMONDIR)/%
169	$(INS.file)
170
171$(ROOTXMLDIRS):
172	$(INS.dir)
173
174$(ROOTDTDDIR)/% $(ROOTXSLDIR)/%: %
175	$(INS.file)
176
177$(AUDITDIRS):
178	$(INS.dir)
179
180$(ARSYMLNK):
181	$(RM) $@
182	$(SYMLINK) ../../../../var/audit $@
183
184$(ETCSECURITY)/%: %.txt
185	$(INS.rename)
186
187$(ROOTETCSECURITY):
188	$(INS.dir)
189
190$(ROOTETCSECURITY)/%: %.txt
191	$(INS.rename)
192
193$(POFILE):	 pofile_MSGFILES
194
195_msg:	$(MSGDOMAINPOFILE)
196
197# has strings but doesn't use gettext
198adt_xlate.po: $(COMMONDIR)/adt_xlate.c
199	$(RM) adt_xlate.po
200	$(XGETTEXT) $(XGETFLAGS_ADT) $(COMMONDIR)/adt_xlate.c
201	$(SED) "/^domain/d" < messages.po > adt_xlate.po
202	$(RM) messages.po
203
204$(SUBDIRS):	FRC
205	@cd $@; pwd; $(MAKE) $(TARGET)
206
207FRC:
208
209include ../Makefile.targ
210include ../../Makefile.msg.targ
211