osquery-1/Makefile
Teddy Reed 41ab6f3161 Organizing osquery python testing
Move /osquery/python_tests/* to /tools/tests
Move test_extensions process controls to test_base module
Use test_base.Testing to implement each module's main()
  - This applies a default argparse with --build
  - test_base.ARGS is the argparse-parsed namespace
  - Use test_base.ARGS.build for the platform-specific dir
Move WatchdogTests to /tools/tests/test_watchdog.py
2015-03-02 16:23:22 -08:00

81 lines
2.3 KiB
Makefile

PLATFORM := $(shell uname -s)
VERSION := $(shell git describe --tags HEAD --always)
MAKE = make
ifeq ($(PLATFORM),Darwin)
BUILD_DIR=darwin
else ifeq ($(PLATFORM),FreeBSD)
BUILD_DIR=freebsd
MAKE=gmake
else
DISTRO := $(shell if [ -f "/etc/redhat-release" ]; then echo "Centos"; fi)
ifeq ($(DISTRO),Centos)
BUILD_DIR := $(shell cat /etc/redhat-release | grep -o "release [6-7]" | sed 's/release /centos/g')
else
DISTRO := $(shell if [ -f "/etc/lsb-release" ]; then echo "Ubuntu"; fi)
BUILD_DIR := $(shell lsb_release -sc)
endif
endif
DEFINES := CTEST_OUTPUT_ON_FAILURE=1
all: .setup
cd build/$(BUILD_DIR) && cmake ../.. && \
$(DEFINES) $(MAKE) --no-print-directory $(MAKEFLAGS)
debug: .setup
cd build/$(BUILD_DIR) && DEBUG=True cmake ../../ && \
$(DEFINES) $(MAKE) --no-print-directory $(MAKEFLAGS)
test_debug: .setup
cd build/$(BUILD_DIR) && DEBUG=True cmake ../../ && \
$(DEFINES) $(MAKE) test --no-print-directory $(MAKEFLAGS)
analyze: .setup
cd build/$(BUILD_DIR) && ANALYZE=True cmake ../../ && \
$(DEFINES) $(MAKE) --no-print-directory $(MAKEFLAGS)
sanitize: .setup
cd build/$(BUILD_DIR) && SANITIZE=True cmake ../../ && \
$(DEFINES) $(MAKE) --no-print-directory $(MAKEFLAGS)
sdk: .setup
cd build/$(BUILD_DIR) && SDK=True cmake ../../ && \
$(DEFINES) $(MAKE) --no-print-directory $(MAKEFLAGS)
test_sdk: .setup
cd build/$(BUILD_DIR) && SDK=True cmake ../../ && \
$(DEFINES) $(MAKE) test --no-print-directory $(MAKEFLAGS)
debug_sdk: .setup
cd build/$(BUILD_DIR) && SDK=True DEBUG=True cmake ../../ && \
$(DEFINES) $(MAKE) --no-print-directory $(MAKEFLAGS)
test_debug_sdk: .setup
cd build/$(BUILD_DIR) && SDK=True DEBUG=True cmake ../../ && \
$(DEFINES) $(MAKE) test --no-print-directory $(MAKEFLAGS)
deps: .setup
./tools/provision.sh build build/$(BUILD_DIR)
distclean:
rm -rf .sources build/$(BUILD_DIR) doxygen/html doxygen/latex
ifeq ($(PLATFORM),Linux)
rm -rf build/linux
endif
.setup:
export CTEST_OUTPUT_ON_FAILURE=1
mkdir -p build/$(BUILD_DIR)
ifeq ($(PLATFORM),Linux)
ln -snf $(BUILD_DIR) build/linux
endif
package:
# Alias for packages (do not use CPack)
cd build/$(BUILD_DIR) && cmake ../../ && \
$(DEFINES) $(MAKE) packages --no-print-directory $(MAKEFLAGS)
%::
cd build/$(BUILD_DIR) && cmake ../.. && \
$(DEFINES) $(MAKE) --no-print-directory $@