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 #
     80 # /etc/security/audit/localhost/files is a symbolic link to /var/audit.
     81 # This is provided so that auditreduce will work in the default configuration.
     82 #
     83 RESA=$(ROOTETCSECURITY)/audit
     84 RESAL=$(RESA)/localhost
     85 VARAUDIT=$(ROOT)/var/audit
     86 AUDITDIRS=$(RESA) $(RESAL) $(VARAUDIT)
     87 $(AUDITDIRS) := FILEMODE = 0750
     88 
     89 ARSYMLNK=$(RESAL)/files
     90 
     91 #
     92 # message catalogue file
     93 #
     94 MSGFILES =	`$(GREP) -l gettext $(COMMONDIR)/*.c`
     95 POFILE =	libbsm.po
     96 
     97 #
     98 # Definitions for XML (DTD AND XSL)
     99 #
    100 DTD =		adt_record.dtd.1
    101 XSL =		adt_record.xsl.1
    102 ROOTXMLDIR =	$(ROOT)/usr/share/lib/xml
    103 ROOTDTDDIR=	$(ROOTXMLDIR)/dtd
    104 ROOTXSLDIR=	$(ROOTXMLDIR)/style
    105 ROOTDTD=	$(DTD:%=$(ROOTDTDDIR)/%)
    106 ROOTXSL=	$(XSL:%=$(ROOTXSLDIR)/%)
    107 ROOTXMLDIRS =	$(ROOTXMLDIR) $(ROOTDTDDIR) $(ROOTXSLDIR)
    108 ROOTXMLFILES =	$(ROOTDTD) $(ROOTXSL)
    109 
    110 $(ROOTXMLDIRS) :=  FILEMODE = 755
    111 
    112 $(ROOTXMLFILES) :=  FILEMODE = 444
    113 
    114 
    115 CPPFLAGS += -I$(COMMONDIR)
    116 CPPFLAGS += -D_REENTRANT
    117 
    118 CLEANFILES += $(GENSRCS) $(GENHDRS)
    119 
    120 ADTXMLFILE =	$(COMMONDIR)/adt.xml
    121 ADTXSDFILE =	$(COMMONDIR)/adt.xsd
    122 AUDITXML =	auditxml
    123 
    124 .KEEP_STATE:
    125 
    126 install: install_dirs install_data
    127 
    128 #		$(ROOTUSRLIB) $(ROOTLIBS) $(ROOTLINKS)
    129 
    130 install_h: $(ROOTHDRDIR) $(ROOTHDRS) $(ROOTCHDRS)
    131 
    132 check:	$(CHECKHDRS) $(CHECKCHDRS)
    133 	xmllint --schema $(ADTXSDFILE) --noout $(ADTXMLFILE)
    134 
    135 install_data: $(ESSRC) $(RESSRC) $(ROOTETCSECURITY) $(ETCSECURITYFILES) \
    136 	$(ROOTXMLFILES)
    137 
    138 install_dirs: $(AUDITDIRS) $(ARSYMLNK) $(ROOTXMLDIRS)
    139 
    140 audit_uevents.h: mkhdr.sh audit_event.txt
    141 	sh mkhdr.sh
    142 
    143 $(COMMONDIR)/adt_event.check:	$(COMMONDIR)/adt_event.h
    144 	$(DOT_C_CHECK) $<
    145 
    146 clean clobber: clean_files
    147 
    148 clean_files:
    149 	-$(RM) $(CLEANFILES)
    150 
    151 $(GENSRCS): $(ADTXMLFILE) $(AUDITXML)
    152 	$(PERL) $(AUDITXML) -o $(COMMONDIR) $(ADTXMLFILE)
    153 
    154 $(ETCSECURITYFILES) $(RESA): \
    155 	$(ETCSECURITY) \
    156 	$(ROOTETCSECURITY)
    157 
    158 $(RESAL): $(RESA)
    159 
    160 $(ARSYMLNK): $(RESAL)
    161 
    162 $(ROOTHDRDIR):
    163 	$(INS.dir)
    164 
    165 $(ROOTHDRDIR)/%:%
    166 	$(INS.file)
    167 
    168 $(ROOTHDRDIR)/%:$(COMMONDIR)/%
    169 	$(INS.file)
    170 
    171 $(ROOTXMLDIRS):
    172 	$(INS.dir)
    173 
    174 $(ROOTDTDDIR)/% $(ROOTXSLDIR)/%: %
    175 	$(INS.file)
    176 
    177 $(AUDITDIRS):
    178 	$(INS.dir)
    179 
    180 $(ARSYMLNK): 
    181 	$(RM) $@
    182 	$(SYMLINK) ../../../../var/audit $@
    183 
    184 $(ETCSECURITY)/%: %.txt
    185 	$(INS.rename)
    186 
    187 $(ROOTETCSECURITY):
    188 	$(INS.dir)
    189 
    190 $(ROOTETCSECURITY)/%: %.txt
    191 	$(INS.rename)
    192 
    193 $(POFILE):	 pofile_MSGFILES
    194 
    195 _msg:	$(MSGDOMAINPOFILE)
    196 
    197 # has strings but doesn't use gettext
    198 adt_xlate.po: $(COMMONDIR)/adt_xlate.c
    199 	$(RM) adt_xlate.po
    200 	$(XGETTEXT) $(XGETFLAGS_ADT) $(COMMONDIR)/adt_xlate.c
    201 	$(SED) "/^domain/d" < messages.po > adt_xlate.po
    202 	$(RM) messages.po
    203 
    204 $(SUBDIRS):	FRC
    205 	@cd $@; pwd; $(MAKE) $(TARGET)
    206 
    207 FRC:
    208 
    209 include ../Makefile.targ
    210 include ../../Makefile.msg.targ
    211