xref: /illumos-gate/usr/src/lib/libbsm/Makefile (revision 8523fda3525b37e02f4d11efc8cf763bf08204ec)
17c478bd9Sstevel@tonic-gate#
27c478bd9Sstevel@tonic-gate# CDDL HEADER START
37c478bd9Sstevel@tonic-gate#
47c478bd9Sstevel@tonic-gate# The contents of this file are subject to the terms of the
52d84dfe8Sgww# Common Development and Distribution License (the "License").
62d84dfe8Sgww# You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate#
87c478bd9Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate# See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate# and limitations under the License.
127c478bd9Sstevel@tonic-gate#
137c478bd9Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate#
197c478bd9Sstevel@tonic-gate# CDDL HEADER END
207c478bd9Sstevel@tonic-gate#
217c478bd9Sstevel@tonic-gate#
2224fe0b3bSjmcp# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
237c478bd9Sstevel@tonic-gate# Use is subject to license terms.
247c478bd9Sstevel@tonic-gate#
257c478bd9Sstevel@tonic-gate
267c478bd9Sstevel@tonic-gateinclude ../Makefile.lib
277c478bd9Sstevel@tonic-gate
28f808c858SrafSUBDIRS =	$(MACH)
29f808c858Sraf$(BUILD64)SUBDIRS += $(MACH64)
307c478bd9Sstevel@tonic-gate
317c478bd9Sstevel@tonic-gateXGETFLAGS_ADT += -a
327c478bd9Sstevel@tonic-gate
337c478bd9Sstevel@tonic-gateall :=		TARGET= all
347c478bd9Sstevel@tonic-gateclean :=	TARGET= clean
357c478bd9Sstevel@tonic-gateclobber :=	TARGET= clobber
367c478bd9Sstevel@tonic-gatedelete :=	TARGET= delete
377c478bd9Sstevel@tonic-gateinstall :=	TARGET= install
387c478bd9Sstevel@tonic-gatelint :=		TARGET= lint
397c478bd9Sstevel@tonic-gatepackage :=	TARGET= package
407c478bd9Sstevel@tonic-gate
417c478bd9Sstevel@tonic-gate.KEEP_STATE:
427c478bd9Sstevel@tonic-gate
437c478bd9Sstevel@tonic-gateCOMMONDIR = common
447c478bd9Sstevel@tonic-gate
457c478bd9Sstevel@tonic-gate#
467c478bd9Sstevel@tonic-gate# Macros for libbsm header files. These define user-level only interfaces.
477c478bd9Sstevel@tonic-gate#
487c478bd9Sstevel@tonic-gateGENHDRS = audit_uevents.h
4945916cd2SjpkHDRS = libbsm.h devices.h devalloc.h adt.h adt_event.h audit_private.h
50c0c79a3fStz204579GENSRCS =	$(COMMONDIR)/adt_xlate.c $(COMMONDIR)/adt_event.h
517c478bd9Sstevel@tonic-gateCOMMONHDRS =	$(HDRS:%=$(COMMONDIR)/%)
527c478bd9Sstevel@tonic-gateROOTHDRDIR = 	$(ROOT)/usr/include/bsm
537c478bd9Sstevel@tonic-gateROOTCHDRS = 	$(HDRS:%=$(ROOTHDRDIR)/%)
547c478bd9Sstevel@tonic-gateROOTHDRS = 	$(GENHDRS:%=$(ROOTHDRDIR)/%)
557c478bd9Sstevel@tonic-gate
567c478bd9Sstevel@tonic-gateCHECKCHDRS =	$(COMMONHDRS:%.h=%.check)
577c478bd9Sstevel@tonic-gateCHECKHDRS =	$(GENHDRS:%.h=%.check)
587c478bd9Sstevel@tonic-gate
597c478bd9Sstevel@tonic-gate$(ROOTHDRS) := 	FILEMODE = 0644
607c478bd9Sstevel@tonic-gate$(ROOTCHDRS) :=	FILEMODE = 0644
617c478bd9Sstevel@tonic-gate
62c0c79a3fStz204579all install lint package: $(GENSRCS) $(SUBDIRS)
63c0c79a3fStz204579clean clobber delete: $(SUBDIRS)
64c0c79a3fStz204579
657c478bd9Sstevel@tonic-gate#
667c478bd9Sstevel@tonic-gate# Macros for libbsm database files. These should probably be installed
677c478bd9Sstevel@tonic-gate# from somewhere else. Until we find that better place, install them
687c478bd9Sstevel@tonic-gate# from here.
697c478bd9Sstevel@tonic-gate#
707c478bd9Sstevel@tonic-gate
717c478bd9Sstevel@tonic-gateROOTETCSECURITY = 	$(ROOT)/etc/security
727c478bd9Sstevel@tonic-gate$(ROOTETCSECURITY) := 	DIRMODE = 0755
737c478bd9Sstevel@tonic-gate
74f229d58bSgwwESFILES =		audit_class audit_control audit_event audit_user
757c478bd9Sstevel@tonic-gateESSRC =			$(ESFILES:%=%.txt)
767c478bd9Sstevel@tonic-gateETCSECURITYFILES =	$(ESFILES:%=$(ROOTETCSECURITY)/%)
777c478bd9Sstevel@tonic-gate$(ETCSECURITYFILES) :=	FILEMODE = 0644
787c478bd9Sstevel@tonic-gate
797c478bd9Sstevel@tonic-gate#
807c478bd9Sstevel@tonic-gate# /etc/security/audit/localhost/files is a symbolic link to /var/audit.
817c478bd9Sstevel@tonic-gate# This is provided so that auditreduce will work in the default configuration.
827c478bd9Sstevel@tonic-gate#
837c478bd9Sstevel@tonic-gateRESA=$(ROOTETCSECURITY)/audit
847c478bd9Sstevel@tonic-gateRESAL=$(RESA)/localhost
857c478bd9Sstevel@tonic-gateVARAUDIT=$(ROOT)/var/audit
867c478bd9Sstevel@tonic-gateAUDITDIRS=$(RESA) $(RESAL) $(VARAUDIT)
877c478bd9Sstevel@tonic-gate$(AUDITDIRS) := FILEMODE = 0750
887c478bd9Sstevel@tonic-gate
897c478bd9Sstevel@tonic-gateARSYMLNK=$(RESAL)/files
907c478bd9Sstevel@tonic-gate
917c478bd9Sstevel@tonic-gate#
927c478bd9Sstevel@tonic-gate# message catalogue file
937c478bd9Sstevel@tonic-gate#
9445916cd2SjpkMSGFILES =	`$(GREP) -l gettext $(COMMONDIR)/*.c`
957c478bd9Sstevel@tonic-gatePOFILE =	libbsm.po
967c478bd9Sstevel@tonic-gate
977c478bd9Sstevel@tonic-gate#
987c478bd9Sstevel@tonic-gate# Definitions for XML (DTD AND XSL)
997c478bd9Sstevel@tonic-gate#
1007c478bd9Sstevel@tonic-gateDTD =		adt_record.dtd.1
1017c478bd9Sstevel@tonic-gateXSL =		adt_record.xsl.1
1027c478bd9Sstevel@tonic-gateROOTXMLDIR =	$(ROOT)/usr/share/lib/xml
1037c478bd9Sstevel@tonic-gateROOTDTDDIR=	$(ROOTXMLDIR)/dtd
1047c478bd9Sstevel@tonic-gateROOTXSLDIR=	$(ROOTXMLDIR)/style
1057c478bd9Sstevel@tonic-gateROOTDTD=	$(DTD:%=$(ROOTDTDDIR)/%)
1067c478bd9Sstevel@tonic-gateROOTXSL=	$(XSL:%=$(ROOTXSLDIR)/%)
1077c478bd9Sstevel@tonic-gateROOTXMLDIRS =	$(ROOTXMLDIR) $(ROOTDTDDIR) $(ROOTXSLDIR)
1087c478bd9Sstevel@tonic-gateROOTXMLFILES =	$(ROOTDTD) $(ROOTXSL)
1097c478bd9Sstevel@tonic-gate
1107c478bd9Sstevel@tonic-gate$(ROOTXMLDIRS) :=  FILEMODE = 755
1117c478bd9Sstevel@tonic-gate
1127c478bd9Sstevel@tonic-gate$(ROOTXMLFILES) :=  FILEMODE = 444
1137c478bd9Sstevel@tonic-gate
1147c478bd9Sstevel@tonic-gate
1157c478bd9Sstevel@tonic-gateCPPFLAGS += -I$(COMMONDIR)
1167c478bd9Sstevel@tonic-gateCPPFLAGS += -D_REENTRANT
1177c478bd9Sstevel@tonic-gate
118c0c79a3fStz204579CLEANFILES += $(GENSRCS) $(GENHDRS)
119c0c79a3fStz204579
120c0c79a3fStz204579ADTXMLFILE =	$(COMMONDIR)/adt.xml
121c0c79a3fStz204579ADTXSDFILE =	$(COMMONDIR)/adt.xsd
122c0c79a3fStz204579AUDITXML =	auditxml
123c0c79a3fStz204579
1247c478bd9Sstevel@tonic-gate.KEEP_STATE:
1257c478bd9Sstevel@tonic-gate
1267c478bd9Sstevel@tonic-gateinstall: install_dirs install_data
1277c478bd9Sstevel@tonic-gate
1287c478bd9Sstevel@tonic-gate#		$(ROOTUSRLIB) $(ROOTLIBS) $(ROOTLINKS)
1297c478bd9Sstevel@tonic-gate
1307c478bd9Sstevel@tonic-gateinstall_h: $(ROOTHDRDIR) $(ROOTHDRS) $(ROOTCHDRS)
1317c478bd9Sstevel@tonic-gate
1327c478bd9Sstevel@tonic-gatecheck:	$(CHECKHDRS) $(CHECKCHDRS)
133c0c79a3fStz204579	xmllint --schema $(ADTXSDFILE) --noout $(ADTXMLFILE)
1347c478bd9Sstevel@tonic-gate
1357c478bd9Sstevel@tonic-gateinstall_data: $(ESSRC) $(RESSRC) $(ROOTETCSECURITY) $(ETCSECURITYFILES) \
136*8523fda3SJan Friedel	$(ROOTXMLFILES)
1377c478bd9Sstevel@tonic-gate
1387c478bd9Sstevel@tonic-gateinstall_dirs: $(AUDITDIRS) $(ARSYMLNK) $(ROOTXMLDIRS)
1397c478bd9Sstevel@tonic-gate
1407c478bd9Sstevel@tonic-gateaudit_uevents.h: mkhdr.sh audit_event.txt
1417c478bd9Sstevel@tonic-gate	sh mkhdr.sh
1427c478bd9Sstevel@tonic-gate
143c0c79a3fStz204579$(COMMONDIR)/adt_event.check:	$(COMMONDIR)/adt_event.h
144c0c79a3fStz204579	$(DOT_C_CHECK) $<
145c0c79a3fStz204579
146c0c79a3fStz204579clean clobber: clean_files
147c0c79a3fStz204579
148c0c79a3fStz204579clean_files:
149c0c79a3fStz204579	-$(RM) $(CLEANFILES)
150c0c79a3fStz204579
151c0c79a3fStz204579$(GENSRCS): $(ADTXMLFILE) $(AUDITXML)
1520ad2061eSgww	$(PERL) $(AUDITXML) -o $(COMMONDIR) $(ADTXMLFILE)
153c0c79a3fStz204579
154*8523fda3SJan Friedel$(ETCSECURITYFILES) $(RESA): \
1557c478bd9Sstevel@tonic-gate	$(ETCSECURITY) \
1567c478bd9Sstevel@tonic-gate	$(ROOTETCSECURITY)
1577c478bd9Sstevel@tonic-gate
1587c478bd9Sstevel@tonic-gate$(RESAL): $(RESA)
1597c478bd9Sstevel@tonic-gate
1607c478bd9Sstevel@tonic-gate$(ARSYMLNK): $(RESAL)
1617c478bd9Sstevel@tonic-gate
1627c478bd9Sstevel@tonic-gate$(ROOTHDRDIR):
1637c478bd9Sstevel@tonic-gate	$(INS.dir)
1647c478bd9Sstevel@tonic-gate
1657c478bd9Sstevel@tonic-gate$(ROOTHDRDIR)/%:%
1667c478bd9Sstevel@tonic-gate	$(INS.file)
1677c478bd9Sstevel@tonic-gate
1687c478bd9Sstevel@tonic-gate$(ROOTHDRDIR)/%:$(COMMONDIR)/%
1697c478bd9Sstevel@tonic-gate	$(INS.file)
1707c478bd9Sstevel@tonic-gate
1717c478bd9Sstevel@tonic-gate$(ROOTXMLDIRS):
1727c478bd9Sstevel@tonic-gate	$(INS.dir)
1737c478bd9Sstevel@tonic-gate
1747c478bd9Sstevel@tonic-gate$(ROOTDTDDIR)/% $(ROOTXSLDIR)/%: %
1757c478bd9Sstevel@tonic-gate	$(INS.file)
1767c478bd9Sstevel@tonic-gate
1777c478bd9Sstevel@tonic-gate$(AUDITDIRS):
1787c478bd9Sstevel@tonic-gate	$(INS.dir)
1797c478bd9Sstevel@tonic-gate
1807c478bd9Sstevel@tonic-gate$(ARSYMLNK):
1817c478bd9Sstevel@tonic-gate	$(RM) $@
1827c478bd9Sstevel@tonic-gate	$(SYMLINK) ../../../../var/audit $@
1837c478bd9Sstevel@tonic-gate
1847c478bd9Sstevel@tonic-gate$(ETCSECURITY)/%: %.txt
1857c478bd9Sstevel@tonic-gate	$(INS.rename)
1867c478bd9Sstevel@tonic-gate
1877c478bd9Sstevel@tonic-gate$(ROOTETCSECURITY):
1887c478bd9Sstevel@tonic-gate	$(INS.dir)
1897c478bd9Sstevel@tonic-gate
1907c478bd9Sstevel@tonic-gate$(ROOTETCSECURITY)/%: %.txt
1917c478bd9Sstevel@tonic-gate	$(INS.rename)
1927c478bd9Sstevel@tonic-gate
19345916cd2Sjpk$(POFILE):	 pofile_MSGFILES
1947c478bd9Sstevel@tonic-gate
19545916cd2Sjpk_msg:	$(MSGDOMAINPOFILE)
1967c478bd9Sstevel@tonic-gate
1977c478bd9Sstevel@tonic-gate# has strings but doesn't use gettext
1987c478bd9Sstevel@tonic-gateadt_xlate.po: $(COMMONDIR)/adt_xlate.c
1997c478bd9Sstevel@tonic-gate	$(RM) adt_xlate.po
2007c478bd9Sstevel@tonic-gate	$(XGETTEXT) $(XGETFLAGS_ADT) $(COMMONDIR)/adt_xlate.c
2017c478bd9Sstevel@tonic-gate	$(SED) "/^domain/d" < messages.po > adt_xlate.po
2027c478bd9Sstevel@tonic-gate	$(RM) messages.po
2037c478bd9Sstevel@tonic-gate
204f808c858Sraf$(SUBDIRS):	FRC
2057c478bd9Sstevel@tonic-gate	@cd $@; pwd; $(MAKE) $(TARGET)
2067c478bd9Sstevel@tonic-gate
2077c478bd9Sstevel@tonic-gateFRC:
20845916cd2Sjpk
20945916cd2Sjpkinclude ../Makefile.targ
21045916cd2Sjpkinclude ../../Makefile.msg.targ
211