xref: /illumos-gate/usr/src/lib/libbsm/Makefile (revision b3fbe5e6c0ab1f506cd04f8dd39bf9656909f535)
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, Version 1.0 only
6# (the "License").  You may not use this file except in compliance
7# with the License.
8#
9# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10# or http://www.opensolaris.org/os/licensing.
11# See the License for the specific language governing permissions
12# and limitations under the License.
13#
14# When distributing Covered Code, include this CDDL HEADER in each
15# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16# If applicable, add the following below this CDDL HEADER, with the
17# fields enclosed by brackets "[]" replaced with your own identifying
18# information: Portions Copyright [yyyy] [name of copyright owner]
19#
20# CDDL HEADER END
21#
22#
23# Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
24# Use is subject to license terms.
25#
26# ident	"%Z%%M%	%I%	%E% SMI"
27#
28# lib/libbsm/Makefile
29#
30
31include ../../Makefile.master
32include ../Makefile.lib
33
34SUBDIRS=	spec .WAIT $(MACH) $(BUILD64) $(MACH64)
35
36XGETFLAGS_ADT += -a
37
38all :=		TARGET= all
39clean :=	TARGET= clean
40clobber :=	TARGET= clobber
41delete :=	TARGET= delete
42install :=	TARGET= install
43lint :=		TARGET= lint
44package :=	TARGET= package
45
46.KEEP_STATE:
47
48all clean clobber delete install lint package: $(SUBDIRS)
49
50OBJECTS=	adr.o \
51		adrf.o \
52		adrm.o \
53		adt.o \
54		adt_token.o \
55		adt_xlate.o \
56		au_open.o \
57		au_preselect.o \
58		au_to.o \
59		au_usermask.o \
60		audit_allocate.o \
61		audit_class.o \
62		audit_cron.o \
63		audit_crontab.o \
64		audit_at.o \
65		audit_event.o \
66		audit_ftpd.o \
67		audit_halt.o \
68		audit_inetd.o \
69		audit_kadmind.o \
70		audit_krb5kdc.o \
71		audit_login.o \
72		audit_mountd.o \
73		audit_mgrs.o \
74		audit_newgrp.o \
75		audit_plugin.o \
76		audit_reboot.o \
77		audit_rexd.o \
78		audit_rexecd.o \
79		audit_rshd.o \
80		audit_settid.o \
81		audit_shutdown.o \
82		audit_uadmin.o \
83		audit_user.o \
84		bsm.o \
85		generic.o \
86		getacinfo.o \
87		getacval.o \
88		getauditflags.o \
89		getdaent.o \
90		getdment.o \
91		getfaudflgs.o
92
93COMMONDIR = common
94
95#
96# Macros for libbsm header files. These define user-level only interfaces.
97#
98GENHDRS = audit_uevents.h
99HDRS = libbsm.h devices.h adt.h adt_event.h audit_private.h
100COMMONHDRS =	$(HDRS:%=$(COMMONDIR)/%)
101ROOTHDRDIR = 	$(ROOT)/usr/include/bsm
102ROOTCHDRS = 	$(HDRS:%=$(ROOTHDRDIR)/%)
103ROOTHDRS = 	$(GENHDRS:%=$(ROOTHDRDIR)/%)
104
105CHECKCHDRS =	$(COMMONHDRS:%.h=%.check)
106CHECKHDRS =	$(GENHDRS:%.h=%.check)
107
108$(ROOTHDRS) := 	FILEMODE = 0644
109$(ROOTCHDRS) :=	FILEMODE = 0644
110
111#
112# Macros for libbsm database files. These should probably be installed
113# from somewhere else. Until we find that better place, install them
114# from here.
115#
116
117ROOTETCSECURITY = 	$(ROOT)/etc/security
118$(ROOTETCSECURITY) := 	DIRMODE = 0755
119$(ROOTETCSECURITY) := 	OWNER = root
120$(ROOTETCSECURITY) := 	GROUP = sys
121
122ESFILES =		audit_class audit_event
123ESSRC =			$(ESFILES:%=%.txt)
124ETCSECURITYFILES =	$(ESFILES:%=$(ROOTETCSECURITY)/%)
125$(ETCSECURITYFILES) :=	FILEMODE = 0644
126$(ETCSECURITYFILES) :=	OWNER = root
127$(ETCSECURITYFILES) :=	GROUP = sys
128
129EESFILES =		audit_startup
130EESSRC =		$(EESFILES:%=%.txt)
131EETCSECURITYFILES =	$(EESFILES:%=$(ROOTETCSECURITY)/%)
132$(EETCSECURITYFILES) :=	FILEMODE = 0744
133$(EETCSECURITYFILES) :=	OWNER = root
134$(EETCSECURITYFILES) :=	GROUP = sys
135
136RESFILES = 		audit_control audit_user
137RESSRC =		$(RESFILES:%=%.txt)
138ROOTETCSECURITYFILES =	$(RESFILES:%=$(ROOTETCSECURITY)/%)
139$(ROOTETCSECURITYFILES) := FILEMODE = 0640
140$(ROOTETCSECURITYFILES) := OWNER = root
141$(ROOTETCSECURITYFILES) := GROUP = sys
142
143#
144# /etc/security/audit/localhost/files is a symbolic link to /var/audit.
145# This is provided so that auditreduce will work in the default configuration.
146#
147RESA=$(ROOTETCSECURITY)/audit
148RESAL=$(RESA)/localhost
149VARAUDIT=$(ROOT)/var/audit
150AUDITDIRS=$(RESA) $(RESAL) $(VARAUDIT)
151$(AUDITDIRS) := FILEMODE = 0750
152$(AUDITDIRS) := OWNER = root
153$(AUDITDIRS) := GROUP = sys
154
155ARSYMLNK=$(RESAL)/files
156
157#
158# message catalogue file
159#
160TEXT_DOMAIN= SUNW_OST_OSLIB
161POFILE= libbsm.po
162CATALOG=libbsm.po
163POFILES= $(OBJECTS:%.o=%.po)
164
165#
166# Definitions for XML (DTD AND XSL)
167#
168DTD =		adt_record.dtd.1
169XSL =		adt_record.xsl.1
170ROOTXMLDIR =	$(ROOT)/usr/share/lib/xml
171ROOTDTDDIR=	$(ROOTXMLDIR)/dtd
172ROOTXSLDIR=	$(ROOTXMLDIR)/style
173ROOTDTD=	$(DTD:%=$(ROOTDTDDIR)/%)
174ROOTXSL=	$(XSL:%=$(ROOTXSLDIR)/%)
175ROOTXMLDIRS =	$(ROOTXMLDIR) $(ROOTDTDDIR) $(ROOTXSLDIR)
176ROOTXMLFILES =	$(ROOTDTD) $(ROOTXSL)
177
178$(ROOTXMLDIRS) :=  FILEMODE = 755
179$(ROOTXMLDIRS) :=  OWNER = root
180$(ROOTXMLDIRS) :=  GROUP = sys
181
182$(ROOTXMLFILES) :=  FILEMODE = 444
183$(ROOTXMLFILES) :=  OWNER = root
184$(ROOTXMLFILES) :=  GROUP = bin
185
186
187CPPFLAGS += -I$(COMMONDIR)
188CPPFLAGS += -D_REENTRANT
189
190.KEEP_STATE:
191
192install: install_dirs install_data
193
194#		$(ROOTUSRLIB) $(ROOTLIBS) $(ROOTLINKS)
195
196install_h: $(ROOTHDRDIR) $(ROOTHDRS) $(ROOTCHDRS)
197
198check:	$(CHECKHDRS) $(CHECKCHDRS)
199
200install_data: $(ESSRC) $(RESSRC) $(ROOTETCSECURITY) $(ETCSECURITYFILES) \
201	$(EETCSECURITYFILES) $(ROOTETCSECURITYFILES) $(ROOTXMLFILES)
202
203install_dirs: $(AUDITDIRS) $(ARSYMLNK) $(ROOTXMLDIRS)
204
205audit_uevents.h: mkhdr.sh audit_event.txt
206	sh mkhdr.sh
207
208$(ETCSECURITYFILES) $(EETCSECURITYFILES) $(ROOTETCSECURITYFILES) $(RESA): \
209	$(ETCSECURITY) \
210	$(ROOTETCSECURITY)
211
212$(RESAL): $(RESA)
213
214$(ARSYMLNK): $(RESAL)
215
216$(ROOTHDRDIR):
217	$(INS.dir)
218
219$(ROOTHDRDIR)/%:%
220	$(INS.file)
221
222$(ROOTHDRDIR)/%:$(COMMONDIR)/%
223	$(INS.file)
224
225$(ROOTXMLDIRS):
226	$(INS.dir)
227
228$(ROOTDTDDIR)/% $(ROOTXSLDIR)/%: %
229	$(INS.file)
230
231$(AUDITDIRS):
232	$(INS.dir)
233
234$(ARSYMLNK):
235	$(RM) $@
236	$(SYMLINK) ../../../../var/audit $@
237
238$(ETCSECURITY)/%: %.txt
239	$(INS.rename)
240
241$(ROOTETCSECURITY):
242	$(INS.dir)
243
244$(ROOTETCSECURITY)/%: %.txt
245	$(INS.rename)
246
247%.po: $(COMMONDIR)/%.c
248	$(COMPILE.cpp) $<  > $<.i
249	$(BUILD.po)
250
251_msg: $(MSGDOMAIN) $(POFILE)
252	$(RM) $(MSGDOMAIN)/$(CATALOG)
253	$(CP) $(POFILE) $(MSGDOMAIN)
254
255catalog: _msg
256
257po_clean:
258	$(RM) $(POFILES) $(POFILE)
259
260clobber: po_clean
261
262$(POFILE): .WAIT $(POFILES)
263	$(RM) $@
264	$(CAT) $(POFILES) > $@
265
266# has strings but doesn't use gettext
267adt_xlate.po: $(COMMONDIR)/adt_xlate.c
268	$(RM) adt_xlate.po
269	$(XGETTEXT) $(XGETFLAGS_ADT) $(COMMONDIR)/adt_xlate.c
270	$(SED) "/^domain/d" < messages.po > adt_xlate.po
271	$(RM) messages.po
272
273$(MSGDOMAIN):
274	$(INS.dir)
275
276
277spec $(MACH) $(MACH64) :	FRC
278	@cd $@; pwd; $(MAKE) $(TARGET)
279
280FRC:
281