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