osquery-1/Makefile
mike@arpaia.co f3a047fadc add version of osquery to sync tarball
```
[root@localhost vagrant]# make sync
mkdir -p build/sync
rm -rf build/sync/osquery*
cp -R osquery build/sync
cp -R include/osquery build/sync
cp -R build/centos6/sdk/generated/ build/sync/osquery
cp osquery.thrift build/sync/osquery/extensions
find build/sync -type f -name "CMakeLists.txt" -exec rm -f {} \;
mkdir -p build/sync/code-analysis
cd build/sync/code-analysis && SDK=True cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON ../../../
CMake Warning at CMakeLists.txt:95 (message):
  Requested dependencies may have changed, run: make deps

-- Building for CentOS
-- Found components for DL
-- Found readline library
-- Looking for include files libunwind.h, unwind.h
-- Looking for include files libunwind.h, unwind.h - not found
-- Found RocksDB
-- Thrift version 0.9.1
-- Found library dependency /usr/lib/x86_64-linux-gnu/libboost_thread.a
-- Found library dependency /usr/lib/x86_64-linux-gnu/librt.a
-- Found library dependency /usr/lib/x86_64-linux-gnu/libboost_system.a
-- Found library dependency /usr/lib/x86_64-linux-gnu/libboost_filesystem.a
-- Configuring done
-- Generating done
-- Build files have been written to: /vagrant/build/sync/code-analysis
SDK=True
python tools/codegen/gentargets.py -i build/sync/code-analysis/compile_commands.json > build/sync/osquery/TARGETS
cd build/sync && tar -zcf osquery-sync-1.4.1-29-g472c605.tar.gz osquery
The output file is located at build/sync/osquery-sync-1.4.1-29-g472c605.tar.gz
```
2015-02-19 10:43:08 -08:00

95 lines
2.8 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
SYNC_DIR=build/sync
all: .setup
cd build/$(BUILD_DIR) && cmake ../.. && \
$(MAKE) --no-print-directory $(MAKEFLAGS)
debug: .setup
cd build/$(BUILD_DIR) && DEBUG=True cmake ../../ && \
$(MAKE) --no-print-directory $(MAKEFLAGS)
test_debug: .setup
cd build/$(BUILD_DIR)/sdk && DEBUG=True cmake ../../../ && \
$(MAKE) test --no-print-directory $(MAKEFLAGS)
analyze: .setup
cd build/$(BUILD_DIR) && ANALYZE=True cmake ../../ && \
$(MAKE) --no-print-directory $(MAKEFLAGS)
sanitize: .setup
cd build/$(BUILD_DIR) && SANITIZE=True cmake ../../ && \
$(MAKE) --no-print-directory $(MAKEFLAGS)
sdk: .setup
cd build/$(BUILD_DIR)/sdk && SDK=True cmake ../../../ && \
$(MAKE) --no-print-directory $(MAKEFLAGS)
test_sdk: .setup
cd build/$(BUILD_DIR)/sdk && SDK=True cmake ../../../ && \
$(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 $(SYNC_DIR)
ifeq ($(PLATFORM),Linux)
rm -rf build/linux
endif
.setup:
mkdir -p build/$(BUILD_DIR)/generated
mkdir -p build/$(BUILD_DIR)/sdk/generated
ifeq ($(PLATFORM),Linux)
ln -snf $(BUILD_DIR) build/linux
endif
package:
# Alias for packages (do not use CPack)
cd build/$(BUILD_DIR) && cmake ../../ && \
$(MAKE) packages --no-print-directory $(MAKEFLAGS)
sync:
mkdir -p $(SYNC_DIR)
rm -rf $(SYNC_DIR)/osquery*
@
@# merge the headers with the implementation files
cp -R osquery $(SYNC_DIR)
cp -R include/osquery $(SYNC_DIR)
cp -R build/$(BUILD_DIR)/sdk/generated/ $(SYNC_DIR)/osquery
cp osquery.thrift $(SYNC_DIR)/osquery/extensions
@
@# delete all of the old CMake files
find $(SYNC_DIR) -type f -name "CMakeLists.txt" -exec rm -f {} \;
@
@# make the targets file
mkdir -p $(SYNC_DIR)/code-analysis
cd $(SYNC_DIR)/code-analysis && SDK=True cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON ../../../
SDK=True
python tools/codegen/gentargets.py -i $(SYNC_DIR)/code-analysis/compile_commands.json > $(SYNC_DIR)/osquery/TARGETS
@
@# wrap it up in a tarball
cd $(SYNC_DIR) && tar -zcf osquery-sync-$(VERSION).tar.gz osquery
@echo "The output file is located at $(SYNC_DIR)/osquery-sync-$(VERSION).tar.gz"
%::
cd build/$(BUILD_DIR) && cmake ../.. && $(MAKE) --no-print-directory $@