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