1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339
|
#SETools main Makefile
TOPDIR = $(shell pwd)
MAKEFILE = Makefile
SETOOLS_VER := $(shell cat VERSION)
MAKE ?= make
CC ?= gcc
YACC = bison -y
LEX = flex -olex.yy.c
LIBS = -lfl_pic -lm
PREFIX ?= $(DESTDIR)/usr
YFLAGS ?=
LFLAGS ?=
INCLUDE_DIR = $(PREFIX)/include
SHARED_LIB_INSTALL_DIR = $(PREFIX)/lib
STATIC_LIB_INSTALL_DIR = $(SHARED_LIB_INSTALL_DIR)
#SETOOLS_INCLUDE = $(INCLUDE_DIR)/setools-$(SETOOLS_VER)
TCLVER = $(shell env tclsh tcl_vars)
TCL_LIBS = -ltk$(TCLVER) -ltcl$(TCLVER) -ldl $(LIBS)
# File location defaults; used in various places in code
# Change these if you want different defaults
SELINUX_DIR = /selinux
SELINUX_POLICY_DIR = /etc/selinux/refpolicy-targeted
POLICY_INSTALL_DIR = $(SELINUX_POLICY_DIR)/policy
POLICY_SRC_DIR = /etc/selinux/refpolicy/src/policy
MANDIR = $(PREFIX)/share/man
POLICY_SRC_FILE = $(POLICY_SRC_DIR)/policy.conf
DEFAULT_LOG_FILE = /var/log/messages
# Install directories
# Binaries go here
BINDIR = $(PREFIX)/bin
SBINDIR = $(PREFIX)/sbin
# The code uses the specified path below. If you change this, DO NOT add
# a trailing path seperator ("/"). For example, use "/usr/share/setools"
# instead of "/usr/share/setools/". This probably needs to become more
# robust in the future.
#
INSTALL_LIBDIR = $(PREFIX)/share/setools-$(SETOOLS_VER)
# all apps that have a te/fc file need to be listed here
POLICYINSTALLDIRS =
# Help files here
INSTALL_HELPDIR = $(INSTALL_LIBDIR)/docs
# Compile options
# If debug is zero, an optimized version is created
DEBUG = 0
# If GPROF is not zero, compile and link with gprof profiling data
USEGPROF = 0
# Determine whether setools is linked dynamically with
# internal libraries - the dynamic versions of the setools
# libraries are always created and installed, this just determines
# how the setools applications link.
DYNAMIC = 0
# This determines:
# 1. whether libapol uses libselinux
# to find the default policies. NOTE: libselinux must
# be version 1.18 or greater.
# 2. whether libsefs will be built into apol and awish
# Useful to create a version of apol that runs on non-selinux machines.
# Set this to 0 for non-selinux machines.
USE_LIBSELINUX = 1
# -DAPOL_PERFORM_TEST
# simple performance measure tests (shouldn't normally use)
# set PERFORM_TEST to 1 to use
PERFORM_TEST = 0
# You should not need to edit anything after this point.
ifeq ($(USE_LIBSELINUX), 1)
LIBSELINUX = -lselinux
LDFLAGS += $(LIBSELINUX)
USE_LIBSEFS = 1
else
LIBSELINUX =
USE_LIBSEFS = 0
endif
ifeq ($(USE_LIBSELINUX), 1)
CC_DEFINES += -DLIBSELINUX
endif
ifeq ($(USE_LIBSEFS), 1)
CC_DEFINES += -DLIBSEFS
endif
ifeq ($(PERFORM_TEST), 1)
CC_DEFINES += -DAPOL_PERFORM_TEST
endif
ifeq ($(DEBUG), 0)
CFLAGS += -Wall -O2 -fPIC $(CC_DEFINES)
else
CFLAGS += -Wall -g -fPIC $(CC_DEFINES) -DDEBUG
#CFLAGS = -Wall -ansi -pedantic -g $(CC_DEFINES)
endif
ifneq ($(USEGPROF), 0)
CFLAGS += -pg
LDFLAGS += -pg
endif
ifneq ($(DYNAMIC), 0)
LDFLAGS += -ldl
endif
# Exports
export CC YACC LEX LIBS MAKE CFLAGS TOPDIR LDFLAGS CC_DEFINES YFLAGS LFLAGS
export DYNAMIC LIBSELINUX USE_LIBSEFS
export INCLUDE_DIR TCLVER TCL_LIBS
export SHARED_LIB_INSTALL_DIR STATIC_LIB_INSTALL_DIR
export SELINUX_DIR POLICY_INSTALL_DIR POLICY_SRC_DIR DEFAULT_LOG_FILE
export POLICY_SRC_DIR POLICY_SRC_FILE
export BINDIR SBINDIR INSTALL_LIBDIR INSTALL_HELPDIR POLICYINSTALLDIR
export MANDIR PREFIX
# Top Level Targets
all: all-libs all-nogui all-gui
all-nogui: corelibs sediff sechecker secmds
all-gui: all-libs apol awish seaudit sediffx
all-libs: corelibs guilibs
corelibs: libapol libseaudit
ifeq ($(USE_LIBSEFS), 1)
corelibs: libsefs
endif
guilibs: libapol-tcl
libapol-tcl apol: CFLAGS += $(TCL_INCLUDE)
#Libraries
libapol:
$(MAKE) -C libapol libapol libapolso
libapol-tcl:
$(MAKE) -C libapol libapol-tcl libapol-tclso
libseaudit:
$(MAKE) -C libseaudit libseaudit libseauditso
libsefs:
$(MAKE) -C libsefs libsefs libsefsso
# Tools
apol: libapol libapol-tcl
$(MAKE) -C apol apol
awish: libapol libapol-tcl
$(MAKE) -C awish awish
seaudit: libapol libseaudit
$(MAKE) -C seaudit all
sediff: libapol
$(MAKE) -C sediff sediff
sediffx: libapol
$(MAKE) -C sediff sediffx
secmds: libapol
$(MAKE) -C secmds all
sechecker: libapol
$(MAKE) -C sechecker sechecker
# Some tools optionally use libsefs if available
ifeq ($(USE_LIBSEFS), 1)
apol awish sechecker secmds: libsefs
endif
docs:
$(MAKE) -C docs-src $@
# Install Targets
install: all install-dirs \
install-dev install-apol install-awish \
install-secmds install-seaudit install-sediff \
install-docs install-sechecker
install-nogui: all-nogui install-dirs install-dev install-secmds \
install-sediff-nogui install-sechecker
# Install directories - sort gets rid of make warnings on duplicates
install-dirs: $(sort $(BINDIR) $(SBINDIR) $(MANDIR) $(SHARED_LIB_INSTALL_DIR) $(INSTALL_LIBDIR) $(INSTALL_HELPDIR))
$(sort $(BINDIR) $(SBINDIR) $(MANDIR) $(SHARED_LIB_INSTALL_DIR) $(INSTALL_LIBDIR) $(INSTALL_HELPDIR)):
test -d $@ || install -m 755 -d $@
# Install Libraries
install-dev: install-libapol install-libseaudit
ifeq ($(USE_LIBSEFS), 1)
install-dev: install-libsefs
endif
# Individual Install Targets
install-apol: $(BINDIR) $(INSTALL_LIBDIR)
$(MAKE) -C apol install
install-awish: $(BINDIR)
$(MAKE) -C awish install
install-secmds: $(BINDIR) $(SBINDIR) $(INSTALL_LIBDIR)
$(MAKE) -C secmds install
install-seaudit: $(SBINDIR) $(INSTALL_LIBDIR)
$(MAKE) -C seaudit install
install-sediff: $(BINDIR) $(INSTALL_LIBDIR)
$(MAKE) -C sediff install
install-sediff-nogui: $(BINDIR) $(INSTALL_LIBDIR)
$(MAKE) -C sediff install-nogui
install-sediffx: $(BINDIR) $(INSTALL_LIBDIR)
$(MAKE) -C sediff install
install-sechecker: $(SBINDIR) $(INSTALL_LIBDIR)
$(MAKE) -C sechecker install
install-sechecker-profiles: $(INSTALL_LIBDIR)
$(MAKE) -C sechecker install-profiles
# Install the BWidgets package
install-bwidget:
$(MAKE) -C packages install
# Install LogWatch config files to plug-in seaudit-report to LogWatch
install-logwatch-files:
$(MAKE) -C seaudit install-logwatch-service
# Install Documentation
install-docs: docs
$(MAKE) -C docs-src install
# Install Libraries
install-libapol: $(INSTALL_LIBDIR) $(SHARED_LIB_INSTALL_DIR)
$(MAKE) -C libapol install
install-libseaudit: $(INSTALL_LIBDIR) $(SHARED_LIB_INSTALL_DIR)
$(MAKE) -C libseaudit install
install-libsefs: $(INSTALL_LIBDIR) $(SHARED_LIB_INSTALL_DIR)
$(MAKE) -C libsefs install
# Install Policy
install-policy: $(POLICYINSTALLDIR) install-secmds-policy \
install-libapol-policy install-libseaudit-policy
ifeq ($(USE_LIBSEFS), 1)
install-policy: install-libsefs-policy
endif
install-secmds-policy: $(BINDIR)
$(MAKE) -C secmds install-policy
install-libapol-policy: $(SHARED_LIB_INSTALL_DIR)
$(MAKE) -C libapol install-policy
install-libseaudit-policy: $(SHARED_LIB_INSTALL_DIR)
$(MAKE) -C libseaudit install-policy
install-libsefs-policy: $(SHARED_LIB_INSTALL_DIR)
$(MAKE) -C libsefs install-policy
# Help
help:
@echo "Make targets for setools: "
@echo " install: build and install everything (selinux required)"
@echo " install-nogui: build and install all non-GUI tools (selinux required)"
@echo ""
@echo " install-apol: build and install apol (selinux not required)"
@echo " install-secmds: build and install command line tools (selinux required for some tools)"
@echo " install-seaudit: build and install seaudit and seaudit-report (selinux not required)"
@echo " install-sediff: build and install sediff command-line tool (selinux not required)"
@echo " install-sediffx: build and install sediff GUI tool (selinux not required)"
@echo " install-sechecker: build and install sechecker (selinux not required)"
@echo ""
@echo " install-dev: build and install headers and libraries"
@echo " install-docs: install setools documentation"
@echo " install-policy: install SELinux policy and label files"
@echo " install-bwidget: install BWidgets-1.4.1 package (requires Tcl/Tk)"
@echo ""
@echo " install-logwatch-files: install LogWatch config files for seaudit-report (LogWatch required)"
@echo " "
@echo " all: build everything, but don't install"
@echo " all-nogui: only build non-GUI tools and libraries"
@echo ""
@echo " apol: build policy analysis tool"
@echo " secmds: build setools command line tools"
@echo " seaudit: build audit log analysis tools"
@echo " sediff: build semantic policy diff command line tool"
@echo " sediffx: build semantic policy diff GUI tool"
@echo " sechecker: build policy checking tool"
@echo " awish: build TCL/TK wish interpreter with SE Linux tools extensions."
@echo " Useful for de-bugging problems with TCL/TK scripts."
@echo " "
@echo " clean: clean up interim files"
@echo " bare: more extensive clean up"
# Other Targets
clean:
$(MAKE) -C apol $@
$(MAKE) -C awish $@
$(MAKE) -C libapol $@
$(MAKE) -C libseaudit $@
$(MAKE) -C libsefs $@
$(MAKE) -C seaudit $@
$(MAKE) -C secmds $@
$(MAKE) -C sechecker $@
$(MAKE) -C sediff $@
rm -f *~
rm -f lib/*.a lib/*.so lib/*.so.1
bare:
$(MAKE) -C apol $@
$(MAKE) -C awish $@
$(MAKE) -C libapol $@
$(MAKE) -C libseaudit $@
$(MAKE) -C libsefs $@
$(MAKE) -C seaudit $@
$(MAKE) -C secmds $@
$(MAKE) -C sechecker $@
$(MAKE) -C sediff $@
$(MAKE) -C packages $@
rm -f *~
rm -rf ./lib
remove-docs:
$(MAKE) -C docs-src $@
.PHONY: clean bare help\
libapol libapol-tcl libseaudit libsefs
|