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