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