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