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