xref: /titanic_41/usr/src/lib/libbsm/Makefile (revision a62774df315360f02521d6470eab7d5080137dad)
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
79EESFILES =		audit_startup
80EESSRC =		$(EESFILES:%=%.txt)
81EETCSECURITYFILES =	$(EESFILES:%=$(ROOTETCSECURITY)/%)
82$(EETCSECURITYFILES) :=	FILEMODE = 0744
83
84#
85# /etc/security/audit/localhost/files is a symbolic link to /var/audit.
86# This is provided so that auditreduce will work in the default configuration.
87#
88RESA=$(ROOTETCSECURITY)/audit
89RESAL=$(RESA)/localhost
90VARAUDIT=$(ROOT)/var/audit
91AUDITDIRS=$(RESA) $(RESAL) $(VARAUDIT)
92$(AUDITDIRS) := FILEMODE = 0750
93
94ARSYMLNK=$(RESAL)/files
95
96#
97# message catalogue file
98#
99MSGFILES =	`$(GREP) -l gettext $(COMMONDIR)/*.c`
100POFILE =	libbsm.po
101
102#
103# Definitions for XML (DTD AND XSL)
104#
105DTD =		adt_record.dtd.1
106XSL =		adt_record.xsl.1
107ROOTXMLDIR =	$(ROOT)/usr/share/lib/xml
108ROOTDTDDIR=	$(ROOTXMLDIR)/dtd
109ROOTXSLDIR=	$(ROOTXMLDIR)/style
110ROOTDTD=	$(DTD:%=$(ROOTDTDDIR)/%)
111ROOTXSL=	$(XSL:%=$(ROOTXSLDIR)/%)
112ROOTXMLDIRS =	$(ROOTXMLDIR) $(ROOTDTDDIR) $(ROOTXSLDIR)
113ROOTXMLFILES =	$(ROOTDTD) $(ROOTXSL)
114
115$(ROOTXMLDIRS) :=  FILEMODE = 755
116
117$(ROOTXMLFILES) :=  FILEMODE = 444
118
119
120CPPFLAGS += -I$(COMMONDIR)
121CPPFLAGS += -D_REENTRANT
122
123CLEANFILES += $(GENSRCS) $(GENHDRS)
124
125ADTXMLFILE =	$(COMMONDIR)/adt.xml
126ADTXSDFILE =	$(COMMONDIR)/adt.xsd
127AUDITXML =	auditxml
128
129.KEEP_STATE:
130
131install: install_dirs install_data
132
133#		$(ROOTUSRLIB) $(ROOTLIBS) $(ROOTLINKS)
134
135install_h: $(ROOTHDRDIR) $(ROOTHDRS) $(ROOTCHDRS)
136
137check:	$(CHECKHDRS) $(CHECKCHDRS)
138	xmllint --schema $(ADTXSDFILE) --noout $(ADTXMLFILE)
139
140install_data: $(ESSRC) $(RESSRC) $(ROOTETCSECURITY) $(ETCSECURITYFILES) \
141	$(EETCSECURITYFILES) $(ROOTXMLFILES)
142
143install_dirs: $(AUDITDIRS) $(ARSYMLNK) $(ROOTXMLDIRS)
144
145audit_uevents.h: mkhdr.sh audit_event.txt
146	sh mkhdr.sh
147
148$(COMMONDIR)/adt_event.check:	$(COMMONDIR)/adt_event.h
149	$(DOT_C_CHECK) $<
150
151clean clobber: clean_files
152
153clean_files:
154	-$(RM) $(CLEANFILES)
155
156$(GENSRCS): $(ADTXMLFILE) $(AUDITXML)
157	$(PERL) $(AUDITXML) -o $(COMMONDIR) $(ADTXMLFILE)
158
159$(ETCSECURITYFILES) $(EETCSECURITYFILES) $(RESA): \
160	$(ETCSECURITY) \
161	$(ROOTETCSECURITY)
162
163$(RESAL): $(RESA)
164
165$(ARSYMLNK): $(RESAL)
166
167$(ROOTHDRDIR):
168	$(INS.dir)
169
170$(ROOTHDRDIR)/%:%
171	$(INS.file)
172
173$(ROOTHDRDIR)/%:$(COMMONDIR)/%
174	$(INS.file)
175
176$(ROOTXMLDIRS):
177	$(INS.dir)
178
179$(ROOTDTDDIR)/% $(ROOTXSLDIR)/%: %
180	$(INS.file)
181
182$(AUDITDIRS):
183	$(INS.dir)
184
185$(ARSYMLNK):
186	$(RM) $@
187	$(SYMLINK) ../../../../var/audit $@
188
189$(ETCSECURITY)/%: %.txt
190	$(INS.rename)
191
192$(ROOTETCSECURITY):
193	$(INS.dir)
194
195$(ROOTETCSECURITY)/%: %.txt
196	$(INS.rename)
197
198$(POFILE):	 pofile_MSGFILES
199
200_msg:	$(MSGDOMAINPOFILE)
201
202# has strings but doesn't use gettext
203adt_xlate.po: $(COMMONDIR)/adt_xlate.c
204	$(RM) adt_xlate.po
205	$(XGETTEXT) $(XGETFLAGS_ADT) $(COMMONDIR)/adt_xlate.c
206	$(SED) "/^domain/d" < messages.po > adt_xlate.po
207	$(RM) messages.po
208
209$(SUBDIRS):	FRC
210	@cd $@; pwd; $(MAKE) $(TARGET)
211
212FRC:
213
214include ../Makefile.targ
215include ../../Makefile.msg.targ
216