osquery-1/Makefile

125 lines
3.4 KiB
Makefile
Raw Normal View History

PLATFORM := $(shell uname -s)
2015-02-19 18:43:08 +00:00
VERSION := $(shell git describe --tags HEAD --always)
2015-05-05 20:55:49 +00:00
SHELL := $(shell which bash)
2015-04-01 04:18:56 +00:00
2015-05-05 20:55:49 +00:00
MAKE = make
ifeq ($(PLATFORM),FreeBSD)
MAKE = gmake
endif
DISTRO := $(shell . ./tools/lib.sh; _platform)
DISTRO_VERSION := $(shell . ./tools/lib.sh; _distro $(DISTRO))
ifeq ($(DISTRO),darwin)
ifeq ($(DISTRO_VERSION), 10.10)
BUILD_DIR = darwin
else
BUILD_DIR = darwin$(DISTRO_VERSION)
endif
else ifeq ($(DISTRO),freebsd)
BUILD_DIR = freebsd$(DISTRO_VERSION)
else
BUILD_DIR = $(DISTRO_VERSION)
endif
DEFINES := CTEST_OUTPUT_ON_FAILURE=1
2015-04-21 22:40:02 +00:00
.PHONY: docs build
2014-11-09 00:55:19 +00:00
all: .setup
2015-05-05 20:55:49 +00:00
cd build/$(BUILD_DIR) && cmake ../../ && \
$(DEFINES) $(MAKE) --no-print-directory $(MAKEFLAGS)
2015-03-09 00:00:14 +00:00
docs: .setup
2015-05-05 20:55:49 +00:00
cd build && cmake ../ && \
2015-03-09 00:00:14 +00:00
$(DEFINES) $(MAKE) docs --no-print-directory $(MAKEFLAGS)
2014-11-09 00:55:19 +00:00
debug: .setup
cd build/debug_$(BUILD_DIR) && DEBUG=True cmake ../../ && \
2015-04-01 04:18:56 +00:00
$(DEFINES) $(MAKE) --no-print-directory $(MAKEFLAGS)
2015-02-11 03:18:56 +00:00
test_debug: .setup
cd build/debug_$(BUILD_DIR) && DEBUG=True cmake ../../ && \
2015-04-01 04:18:56 +00:00
$(DEFINES) $(MAKE) test --no-print-directory $(MAKEFLAGS)
2015-02-11 03:18:56 +00:00
analyze: .setup
cd build/$(BUILD_DIR) && ANALYZE=True cmake ../../ && \
2015-04-01 04:18:56 +00:00
$(DEFINES) $(MAKE) --no-print-directory $(MAKEFLAGS)
2015-01-31 11:26:28 +00:00
sanitize: .setup
cd build/$(BUILD_DIR) && SANITIZE=True cmake ../../ && \
2015-04-01 04:18:56 +00:00
$(DEFINES) $(MAKE) --no-print-directory $(MAKEFLAGS)
2015-01-31 11:26:28 +00:00
2015-02-03 05:21:36 +00:00
sdk: .setup
2015-02-19 23:19:00 +00:00
cd build/$(BUILD_DIR) && SDK=True cmake ../../ && \
2015-04-01 04:18:56 +00:00
$(DEFINES) $(MAKE) --no-print-directory $(MAKEFLAGS)
2015-02-03 05:21:36 +00:00
test_sdk: .setup
2015-02-19 23:19:00 +00:00
cd build/$(BUILD_DIR) && SDK=True cmake ../../ && \
2015-04-01 04:18:56 +00:00
$(DEFINES) $(MAKE) test --no-print-directory $(MAKEFLAGS)
2015-02-03 05:21:36 +00:00
2015-02-19 01:19:45 +00:00
debug_sdk: .setup
cd build/debug_$(BUILD_DIR) && SDK=True DEBUG=True cmake ../../ && \
2015-04-01 04:18:56 +00:00
$(DEFINES) $(MAKE) --no-print-directory $(MAKEFLAGS)
2015-02-19 01:19:45 +00:00
test_debug_sdk: .setup
cd build/debug_$(BUILD_DIR) && SDK=True DEBUG=True cmake ../../ && \
2015-04-01 04:18:56 +00:00
$(DEFINES) $(MAKE) test --no-print-directory $(MAKEFLAGS)
2015-02-19 01:19:45 +00:00
2015-04-21 22:40:02 +00:00
build:
cd build/$(BUILD_DIR) && \
$(DEFINES) $(MAKE) --no-print-directory $(MAKEFLAGS)
debug_build:
cd build/debug_$(BUILD_DIR) && \
$(DEFINES) $(MAKE) --no-print-directory $(MAKEFLAGS)
test_build:
cd build/$(BUILD_DIR) && \
$(DEFINES) $(MAKE) test --no-print-directory $(MAKEFLAGS)
test_debug_build:
cd build/debug_$(BUILD_DIR) && \
$(DEFINES) $(MAKE) test --no-print-directory $(MAKEFLAGS)
2014-11-09 00:55:19 +00:00
deps: .setup
./tools/provision.sh build build/$(BUILD_DIR)
2015-05-05 20:55:49 +00:00
clean: .setup
cd build/$(BUILD_DIR) && cmake ../../ && \
$(DEFINES) $(MAKE) clean --no-print-directory $(MAKEFLAGS)
distclean:
2015-04-24 20:52:17 +00:00
rm -rf .sources build/$(BUILD_DIR) build/debug_$(BUILD_DIR) build/docs
2014-11-09 00:55:19 +00:00
ifeq ($(PLATFORM),Linux)
rm -rf build/linux
endif
2014-11-09 00:55:19 +00:00
.setup:
ifeq ($(DISTRO),unknown_version)
2015-04-01 04:18:56 +00:00
@echo Unknown, non-Redhat, non-Ubuntu based Linux distro
false
endif
@mkdir -p build/docs
@mkdir -p build/$(BUILD_DIR)
@mkdir -p build/debug_$(BUILD_DIR)
2014-11-09 00:55:19 +00:00
ifeq ($(PLATFORM),Linux)
@ln -snf $(BUILD_DIR) build/linux
@ln -snf debug_$(BUILD_DIR) build/debug_linux
2014-11-09 00:55:19 +00:00
endif
2015-05-04 21:15:19 +00:00
package: .setup
2015-01-11 07:02:32 +00:00
# Alias for packages (do not use CPack)
2015-05-04 21:15:19 +00:00
cd build/$(BUILD_DIR) && PACKAGE=True cmake ../../ && \
$(DEFINES) $(MAKE) packages --no-print-directory $(MAKEFLAGS)
packages: .setup
cd build/$(BUILD_DIR) && PACKAGE=True cmake ../../ && \
$(DEFINES) $(MAKE) packages --no-print-directory $(MAKEFLAGS)
2015-01-11 07:02:32 +00:00
2015-05-05 20:55:49 +00:00
sync: .setup
cd build/$(BUILD_DIR) && PACKAGE=True cmake ../../ && \
$(DEFINES) $(MAKE) sync --no-print-directory $(MAKEFLAGS)
2014-11-09 00:55:19 +00:00
%::
2015-05-05 20:55:49 +00:00
cd build/$(BUILD_DIR) && cmake ../../ && \
2015-04-01 04:18:56 +00:00
$(DEFINES) $(MAKE) --no-print-directory $@