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